private PlannerOp planEnumerableTableScan(EnumerableTableScan scan, RelDataType rowType) { final String tableSpace = scan.getTable().getQualifiedName().get(0); final TableImpl tableImpl = (TableImpl) scan.getTable().unwrap(org.apache.calcite.schema.Table.class ); Table table = tableImpl.tableManager.getTable(); ScanStatement scanStatement = new ScanStatement(tableSpace, table, null); return new TableScanOp(scanStatement); }
@Override public void onMatch(RelOptRuleCall call) { final EnumerableTableScan access = call.rel(0); final RelTraitSet traits = access.getTraitSet().plus(DrillRel.DRILL_LOGICAL); call.transformTo(new DrillScanRel(access.getCluster(), traits, access.getTable())); } }
public RelNode convert(RelNode rel) { final EnumerableTableScan scan = (EnumerableTableScan) rel; return new MockJdbcTableScan(scan.getCluster(), scan.getTable(), (JdbcConvention) getOutConvention()); } }
public RelNode convert(RelNode rel) { final EnumerableTableScan scan = (EnumerableTableScan) rel; return new MockJdbcTableScan(scan.getCluster(), scan.getTable(), (JdbcConvention) getOutConvention()); } }
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, GuavaUtils.convertToUnshadedImmutableList(ImmutableList.of())); // return an EnumerableTableScan with fileSelection being part of digest of TableScan node. return DirPrunedEnumerableTableScan.create(oldScan.getCluster(), newOptTableImpl, newFileSelection.toString()); }