use of io.trino.plugin.mongodb.MongoIndex.MongodbIndexKey in project trino by trinodb.
the class MongoMetadata method getTableProperties.
@Override
public ConnectorTableProperties getTableProperties(ConnectorSession session, ConnectorTableHandle table) {
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().isEmpty()) {
continue;
}
if (columns.get(key.getName()) != null) {
localProperties.add(new SortingProperty<>(columns.get(key.getName()), key.getSortOrder().get()));
}
}
}
return new ConnectorTableProperties(TupleDomain.all(), Optional.empty(), partitioningColumns, Optional.empty(), localProperties.build());
}
Aggregations