use of org.apache.iceberg.TableScan in project presto by prestodb.
the class IcebergSplitManager method getSplits.
@Override
public ConnectorSplitSource getSplits(ConnectorTransactionHandle transaction, ConnectorSession session, ConnectorTableLayoutHandle layout, SplitSchedulingContext splitSchedulingContext) {
IcebergTableLayoutHandle layoutHandle = (IcebergTableLayoutHandle) layout;
IcebergTableHandle table = layoutHandle.getTable();
if (!table.getSnapshotId().isPresent()) {
return new FixedSplitSource(ImmutableList.of());
}
Table icebergTable;
if (catalogType == HADOOP) {
icebergTable = getHadoopIcebergTable(resourceFactory, session, table.getSchemaTableName());
} else {
ExtendedHiveMetastore metastore = ((IcebergHiveMetadata) transactionManager.get(transaction)).getMetastore();
icebergTable = getHiveIcebergTable(metastore, hdfsEnvironment, session, table.getSchemaTableName());
}
TableScan tableScan = icebergTable.newScan().filter(toIcebergExpression(table.getPredicate())).useSnapshot(table.getSnapshotId().get());
// TODO Use residual. Right now there is no way to propagate residual to presto but at least we can
// propagate it at split level so the parquet pushdown can leverage it.
IcebergSplitSource splitSource = new IcebergSplitSource(session, tableScan.planTasks());
return splitSource;
}
use of org.apache.iceberg.TableScan in project drill by apache.
the class IcebergGroupScan method initTableScan.
public static TableScan initTableScan(IcebergFormatPlugin formatPlugin, String path, LogicalExpression condition) {
TableScan tableScan = new HadoopTables(formatPlugin.getFsConf()).load(path).newScan();
Map<String, String> properties = formatPlugin.getConfig().getProperties();
if (properties != null) {
for (Map.Entry<String, String> entry : properties.entrySet()) {
tableScan = tableScan.option(entry.getKey(), entry.getValue());
}
}
if (condition != null) {
Expression expression = condition.accept(DrillExprToIcebergTranslator.INSTANCE, null);
tableScan = tableScan.filter(expression);
}
Snapshot snapshot = formatPlugin.getConfig().getSnapshot();
if (snapshot != null) {
tableScan = snapshot.apply(tableScan);
}
Boolean caseSensitive = formatPlugin.getConfig().getCaseSensitive();
if (caseSensitive != null) {
tableScan = tableScan.caseSensitive(caseSensitive);
}
Boolean includeColumnStats = formatPlugin.getConfig().getIncludeColumnStats();
if (includeColumnStats != null && includeColumnStats) {
tableScan = tableScan.includeColumnStats();
}
Boolean ignoreResiduals = formatPlugin.getConfig().getIgnoreResiduals();
if (ignoreResiduals != null && ignoreResiduals) {
tableScan = tableScan.ignoreResiduals();
}
return tableScan;
}
Aggregations