/** Returns an identity projection. */ public ImmutableIntList identity() { return identity(table); }
/** Returns an identity projection. */ public ImmutableIntList identity() { return identity(table); }
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, 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)); } }
final int[] projectInts; if (projects == null || projects.equals(TableScan.identity(rel.getTable()))) { projectInts = null; } else {
final int[] projectInts; if (projects == null || projects.equals(TableScan.identity(rel.getTable()))) { projectInts = null; } else {