use of com.facebook.presto.spi.ConnectorTableLayoutResult in project presto by prestodb.
the class AtopMetadata method getTableLayouts.
@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns) {
AtopTableHandle tableHandle = (AtopTableHandle) table;
Optional<Map<ColumnHandle, Domain>> domains = constraint.getSummary().getDomains();
Domain endTimeDomain = Domain.all(TIMESTAMP_WITH_TIME_ZONE);
Domain startTimeDomain = Domain.all(TIMESTAMP_WITH_TIME_ZONE);
if (domains.isPresent()) {
if (domains.get().containsKey(START_TIME_HANDLE)) {
startTimeDomain = domains.get().get(START_TIME_HANDLE);
}
if (domains.get().containsKey(END_TIME_HANDLE)) {
endTimeDomain = domains.get().get(END_TIME_HANDLE);
}
}
AtopTableLayoutHandle layoutHandle = new AtopTableLayoutHandle(tableHandle, startTimeDomain, endTimeDomain);
ConnectorTableLayout tableLayout = getTableLayout(session, layoutHandle);
return ImmutableList.of(new ConnectorTableLayoutResult(tableLayout, constraint.getSummary()));
}
use of com.facebook.presto.spi.ConnectorTableLayoutResult in project presto by prestodb.
the class LocalFileMetadata method getTableLayouts.
@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns) {
LocalFileTableHandle tableHandle = (LocalFileTableHandle) table;
ConnectorTableLayout layout = new ConnectorTableLayout(new LocalFileTableLayoutHandle(tableHandle, constraint.getSummary()));
return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
use of com.facebook.presto.spi.ConnectorTableLayoutResult in project presto by prestodb.
the class InformationSchemaMetadata method getTableLayouts.
@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns) {
InformationSchemaTableHandle handle = (InformationSchemaTableHandle) table;
ConnectorTableLayout layout = new ConnectorTableLayout(new InformationSchemaTableLayoutHandle(handle, constraint.getSummary()));
return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
use of com.facebook.presto.spi.ConnectorTableLayoutResult in project presto by prestodb.
the class KafkaMetadata method getTableLayouts.
@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns) {
KafkaTableHandle handle = convertTableHandle(table);
ConnectorTableLayout layout = new ConnectorTableLayout(new KafkaTableLayoutHandle(handle));
return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
use of com.facebook.presto.spi.ConnectorTableLayoutResult in project presto by prestodb.
the class AbstractTestHiveClient method getAllSplits.
private List<ConnectorSplit> getAllSplits(ConnectorTableHandle tableHandle, TupleDomain<ColumnHandle> tupleDomain) throws InterruptedException {
try (Transaction transaction = newTransaction()) {
ConnectorSession session = newSession();
ConnectorMetadata metadata = transaction.getMetadata();
List<ConnectorTableLayoutResult> tableLayoutResults = metadata.getTableLayouts(session, tableHandle, new Constraint<>(tupleDomain, bindings -> true), Optional.empty());
ConnectorTableLayoutHandle layoutHandle = getOnlyElement(tableLayoutResults).getTableLayout().getHandle();
return getAllSplits(splitManager.getSplits(transaction.getTransactionHandle(), session, layoutHandle));
}
}
Aggregations