@Override public RelNode copy(RelTraitSet traitSet, List<RelNode> inputs) { return new EnumerableTableScan(getCluster(), traitSet, table, elementType); }
@Override public RelNode copy(RelTraitSet traitSet, List<RelNode> inputs) { return new EnumerableTableScan(getCluster(), traitSet, table, elementType); }
@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 void onMatch(RelOptRuleCall call) { EnumerableTableScan rel = call.rel(0); call.transformTo(new PhysTable(rel.getCluster())); } }
public void onMatch(RelOptRuleCall call) { EnumerableTableScan rel = call.rel(0); call.transformTo(new PhysTable(rel.getCluster())); } }
public RelNode convert(RelNode rel) { final EnumerableTableScan scan = (EnumerableTableScan) rel; return new MockJdbcTableScan(scan.getCluster(), scan.getTable(), (JdbcConvention) getOutConvention()); } }
private Expression fieldExpression(ParameterExpression row_, int i, PhysType physType, JavaRowFormat format) { final Expression e = format.field(row_, i, null, physType.getJavaFieldType(i)); final RelDataType relFieldType = physType.getRowType().getFieldList().get(i).getType(); switch (relFieldType.getSqlTypeName()) { case ARRAY: case MULTISET: // We can't represent a multiset or array as a List<Employee>, because // the consumer does not know the element type. // The standard element type is List. // We need to convert to a List<List>. final JavaTypeFactory typeFactory = (JavaTypeFactory) getCluster().getTypeFactory(); final PhysType elementPhysType = PhysTypeImpl.of( typeFactory, relFieldType.getComponentType(), JavaRowFormat.CUSTOM); final MethodCallExpression e2 = Expressions.call(BuiltInMethod.AS_ENUMERABLE2.method, e); final RelDataType dummyType = this.rowType; final Expression e3 = elementPhysType.convertTo(e2, PhysTypeImpl.of(typeFactory, dummyType, JavaRowFormat.LIST)); return Expressions.call(e3, BuiltInMethod.ENUMERABLE_TO_LIST.method); default: return e; } }
private Expression fieldExpression(ParameterExpression row_, int i, PhysType physType, JavaRowFormat format) { final Expression e = format.field(row_, i, null, physType.getJavaFieldType(i)); final RelDataType relFieldType = physType.getRowType().getFieldList().get(i).getType(); switch (relFieldType.getSqlTypeName()) { case ARRAY: case MULTISET: // We can't represent a multiset or array as a List<Employee>, because // the consumer does not know the element type. // The standard element type is List. // We need to convert to a List<List>. final JavaTypeFactory typeFactory = (JavaTypeFactory) getCluster().getTypeFactory(); final PhysType elementPhysType = PhysTypeImpl.of( typeFactory, relFieldType.getComponentType(), JavaRowFormat.CUSTOM); final MethodCallExpression e2 = Expressions.call(BuiltInMethod.AS_ENUMERABLE2.method, e); final RelDataType dummyType = this.rowType; final Expression e3 = elementPhysType.convertTo(e2, PhysTypeImpl.of(typeFactory, dummyType, JavaRowFormat.LIST)); return Expressions.call(e3, BuiltInMethod.ENUMERABLE_TO_LIST.method); default: return e; } }
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()); }