use of com.facebook.presto.spi.ConnectorTableLayout in project presto by prestodb.
the class MetadataManager method getInfo.
@Override
public Optional<Object> getInfo(Session session, TableLayoutHandle handle) {
ConnectorId connectorId = handle.getConnectorId();
ConnectorMetadata metadata = getMetadata(session, connectorId);
ConnectorTableLayout tableLayout = metadata.getTableLayout(session.toConnectorSession(connectorId), handle.getConnectorHandle());
return metadata.getInfo(tableLayout.getHandle());
}
use of com.facebook.presto.spi.ConnectorTableLayout in project presto by prestodb.
the class ExampleMetadata method getTableLayouts.
@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns) {
ExampleTableHandle tableHandle = (ExampleTableHandle) table;
ConnectorTableLayout layout = new ConnectorTableLayout(new ExampleTableLayoutHandle(tableHandle));
return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
use of com.facebook.presto.spi.ConnectorTableLayout 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);
long startTimestamp = 0;
long endTimestamp = 0;
Optional<Map<ColumnHandle, Domain>> domains = constraint.getSummary().getDomains();
if (domains.isPresent()) {
Map<ColumnHandle, Domain> columnHandleDomainMap = domains.get();
for (Map.Entry<ColumnHandle, Domain> entry : columnHandleDomainMap.entrySet()) {
if (entry.getKey() instanceof KafkaColumnHandle && ((KafkaColumnHandle) entry.getKey()).getName().equals(KafkaInternalFieldDescription.OFFSET_TIMESTAMP_FIELD.getColumnName())) {
Range span = entry.getValue().getValues().getRanges().getSpan();
Marker low = span.getLow();
Marker high = span.getHigh();
if (!low.isLowerUnbounded()) {
startTimestamp = (long) low.getValue();
}
if (!high.isUpperUnbounded()) {
endTimestamp = (long) high.getValue();
}
}
}
}
ConnectorTableLayout layout = new ConnectorTableLayout(new KafkaTableLayoutHandle(handle, startTimestamp, endTimestamp));
return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
use of com.facebook.presto.spi.ConnectorTableLayout in project presto by prestodb.
the class MongoMetadata method getTableLayouts.
@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns) {
MongoTableHandle tableHandle = (MongoTableHandle) table;
// TODO: sharding key
Optional<Set<ColumnHandle>> partitioningColumns = Optional.empty();
ImmutableList.Builder<LocalProperty<ColumnHandle>> localProperties = ImmutableList.builder();
MongoTable tableInfo = mongoSession.getTable(tableHandle.getSchemaTableName());
Map<String, ColumnHandle> columns = getColumnHandles(session, tableHandle);
for (MongoIndex index : tableInfo.getIndexes()) {
for (MongodbIndexKey key : index.getKeys()) {
if (!key.getSortOrder().isPresent()) {
continue;
}
if (columns.get(key.getName()) != null) {
localProperties.add(new SortingProperty<>(columns.get(key.getName()), key.getSortOrder().get()));
}
}
}
ConnectorTableLayout layout = new ConnectorTableLayout(new MongoTableLayoutHandle(tableHandle, constraint.getSummary()), Optional.empty(), TupleDomain.all(), Optional.empty(), partitioningColumns, Optional.empty(), localProperties.build());
return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
use of com.facebook.presto.spi.ConnectorTableLayout in project presto by prestodb.
the class IcebergAbstractMetadata method getTableLayouts.
@Override
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns) {
IcebergTableHandle handle = (IcebergTableHandle) table;
ConnectorTableLayout layout = new ConnectorTableLayout(new IcebergTableLayoutHandle(handle, constraint.getSummary()));
return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}
Aggregations