/** Creates a BindableTableScan. */ public static BindableTableScan create(RelOptCluster cluster, RelOptTable relOptTable) { return create(cluster, relOptTable, ImmutableList.of(), identity(relOptTable)); }
/** Creates a BindableTableScan. */ public static BindableTableScan create(RelOptCluster cluster, RelOptTable relOptTable) { return create(cluster, relOptTable, ImmutableList.of(), identity(relOptTable)); }
protected void apply(RelOptRuleCall call, Filter filter, TableScan scan) { final ImmutableIntList projects; final ImmutableList.Builder<RexNode> filters = ImmutableList.builder(); if (scan instanceof Bindables.BindableTableScan) { final Bindables.BindableTableScan bindableScan = (Bindables.BindableTableScan) scan; filters.addAll(bindableScan.filters); projects = bindableScan.projects; } else { projects = scan.identity(); } final Mapping mapping = Mappings.target(projects, scan.getTable().getRowType().getFieldCount()); filters.add( RexUtil.apply(mapping, filter.getCondition())); call.transformTo( Bindables.BindableTableScan.create(scan.getCluster(), scan.getTable(), filters.build(), projects)); } }
protected void apply(RelOptRuleCall call, Project project, TableScan scan) { final RelOptTable table = scan.getTable(); assert table.unwrap(ProjectableFilterableTable.class) != null; final Mappings.TargetMapping mapping = project.getMapping(); if (mapping == null || Mappings.isIdentity(mapping)) { return; } final ImmutableIntList projects; final ImmutableList<RexNode> filters; if (scan instanceof Bindables.BindableTableScan) { final Bindables.BindableTableScan bindableScan = (Bindables.BindableTableScan) scan; filters = bindableScan.filters; projects = bindableScan.projects; } else { filters = ImmutableList.of(); projects = scan.identity(); } final List<Integer> projects2 = Mappings.apply((Mapping) mapping, projects); call.transformTo( Bindables.BindableTableScan.create(scan.getCluster(), scan.getTable(), filters, projects2)); } }
protected void apply(RelOptRuleCall call, Project project, TableScan scan) { final RelOptTable table = scan.getTable(); assert table.unwrap(ProjectableFilterableTable.class) != null; final Mappings.TargetMapping mapping = project.getMapping(); if (mapping == null || Mappings.isIdentity(mapping)) { return; } final ImmutableIntList projects; final ImmutableList<RexNode> filters; if (scan instanceof Bindables.BindableTableScan) { final Bindables.BindableTableScan bindableScan = (Bindables.BindableTableScan) scan; filters = bindableScan.filters; projects = bindableScan.projects; } else { filters = ImmutableList.of(); projects = scan.identity(); } final List<Integer> projects2 = Mappings.apply((Mapping) mapping, projects); call.transformTo( Bindables.BindableTableScan.create(scan.getCluster(), scan.getTable(), filters, projects2)); } }
protected void apply(RelOptRuleCall call, Filter filter, TableScan scan) { final ImmutableIntList projects; final ImmutableList.Builder<RexNode> filters = ImmutableList.builder(); if (scan instanceof Bindables.BindableTableScan) { final Bindables.BindableTableScan bindableScan = (Bindables.BindableTableScan) scan; filters.addAll(bindableScan.filters); projects = bindableScan.projects; } else { projects = scan.identity(); } final Mapping mapping = Mappings.target(projects, scan.getTable().getRowType().getFieldCount()); filters.add( RexUtil.apply(mapping, filter.getCondition())); call.transformTo( Bindables.BindableTableScan.create(scan.getCluster(), scan.getTable(), filters.build(), projects)); } }
@Override public void onMatch(RelOptRuleCall call) { final LogicalTableScan scan = call.rel(0); final RelOptTable table = scan.getTable(); if (BindableTableScan.canHandle(table)) { call.transformTo( BindableTableScan.create(scan.getCluster(), table)); } } }
@Override public void onMatch(RelOptRuleCall call) { final LogicalTableScan scan = call.rel(0); final RelOptTable table = scan.getTable(); if (BindableTableScan.canHandle(table)) { call.transformTo( BindableTableScan.create(scan.getCluster(), table)); } } }