use of com.facebook.presto.spi.connector.ConnectorPartitioningHandle in project presto by prestodb.
the class RaptorMetadata method getNewTableLayout.
@Override
public Optional<ConnectorNewTableLayout> getNewTableLayout(ConnectorSession session, ConnectorTableMetadata metadata) {
ImmutableMap.Builder<String, RaptorColumnHandle> map = ImmutableMap.builder();
long columnId = 1;
for (ColumnMetadata column : metadata.getColumns()) {
map.put(column.getName(), new RaptorColumnHandle(connectorId, column.getName(), columnId, column.getType()));
columnId++;
}
Optional<DistributionInfo> distribution = getOrCreateDistribution(map.build(), metadata.getProperties());
if (!distribution.isPresent()) {
return Optional.empty();
}
List<String> partitionColumns = distribution.get().getBucketColumns().stream().map(RaptorColumnHandle::getColumnName).collect(toList());
ConnectorPartitioningHandle partitioning = getPartitioningHandle(distribution.get().getDistributionId());
return Optional.of(new ConnectorNewTableLayout(partitioning, partitionColumns));
}
Aggregations