Search in sources :

Example 1 with DynamicDrillTable

use of org.apache.drill.exec.planner.logical.DynamicDrillTable in project drill by apache.

the class FileSystemPartitionDescriptor method createNewTableScanFromSelection.

private TableScan createNewTableScanFromSelection(EnumerableTableScan oldScan, List<String> newFiles, String cacheFileRoot, boolean wasAllPartitionsPruned, MetadataContext metaContext) {
    final RelOptTableImpl t = (RelOptTableImpl) oldScan.getTable();
    final FormatSelection formatSelection = (FormatSelection) table.getSelection();
    final FileSelection newFileSelection = new FileSelection(null, newFiles, getBaseTableLocation(), cacheFileRoot, wasAllPartitionsPruned, formatSelection.getSelection().getDirStatus());
    newFileSelection.setMetaContext(metaContext);
    final FormatSelection newFormatSelection = new FormatSelection(formatSelection.getFormat(), newFileSelection);
    final DrillTranslatableTable newTable = new DrillTranslatableTable(new DynamicDrillTable(table.getPlugin(), table.getStorageEngineName(), table.getUserName(), newFormatSelection));
    final RelOptTableImpl newOptTableImpl = RelOptTableImpl.create(t.getRelOptSchema(), t.getRowType(), newTable);
    // return an EnumerableTableScan with fileSelection being part of digest of TableScan node.
    return DirPrunedEnumerableTableScan.create(oldScan.getCluster(), newOptTableImpl, newFileSelection.toString());
}
Also used : FileSelection(org.apache.drill.exec.store.dfs.FileSelection) DrillTranslatableTable(org.apache.drill.exec.planner.logical.DrillTranslatableTable) DynamicDrillTable(org.apache.drill.exec.planner.logical.DynamicDrillTable) RelOptTableImpl(org.apache.calcite.prepare.RelOptTableImpl) FormatSelection(org.apache.drill.exec.store.dfs.FormatSelection)

Aggregations

RelOptTableImpl (org.apache.calcite.prepare.RelOptTableImpl)1 DrillTranslatableTable (org.apache.drill.exec.planner.logical.DrillTranslatableTable)1 DynamicDrillTable (org.apache.drill.exec.planner.logical.DynamicDrillTable)1 FileSelection (org.apache.drill.exec.store.dfs.FileSelection)1 FormatSelection (org.apache.drill.exec.store.dfs.FormatSelection)1