Search in sources :

Example 1 with Snapshot

use of org.apache.drill.exec.store.iceberg.snapshot.Snapshot 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;
}
Also used : TableScan(org.apache.iceberg.TableScan) Snapshot(org.apache.drill.exec.store.iceberg.snapshot.Snapshot) Expression(org.apache.iceberg.expressions.Expression) LogicalExpression(org.apache.drill.common.expression.LogicalExpression) HadoopTables(org.apache.iceberg.hadoop.HadoopTables) Map(java.util.Map)

Aggregations

Map (java.util.Map)1 LogicalExpression (org.apache.drill.common.expression.LogicalExpression)1 Snapshot (org.apache.drill.exec.store.iceberg.snapshot.Snapshot)1 TableScan (org.apache.iceberg.TableScan)1 Expression (org.apache.iceberg.expressions.Expression)1 HadoopTables (org.apache.iceberg.hadoop.HadoopTables)1