/** * If the filter list passed in is non-empty, creates a FilterRel on top of * the existing RelNode; otherwise, just returns the RelNode * * @param rexBuilder rex builder * @param rel the RelNode that the filter will be put on top of * @param filters list of filters * * @return new RelNode or existing one if no filters */ private RelNode createFilterOnRel( RexBuilder rexBuilder, RelNode rel, List<RexNode> filters) { RelNode newRel; if (filters.size() == 0) { newRel = rel; } else { RexNode andFilters = RexUtil.andRexNodeList(rexBuilder, filters); newRel = CalcRel.createFilter(rel, andFilters); } return newRel; } }
public void rewriteRel(FilterRel rel) { RelNode newRel = CalcRel.createFilter( getNewForOldRel(rel.getChild()), flattenFieldAccesses(rel.getCondition())); setNewForOldRel(rel, newRel); }
newProject.getRowType().getFieldList(), adjustments); projChild = CalcRel.createFilter(newProject, newFilter); } else { projChild = newProject;
public void rewriteRel(FilterRel rel) { RelNode newRel = CalcRel.createFilter( getNewForOldRel(rel.getChild()), flattenFieldAccesses(rel.getCondition())); setNewForOldRel(rel, newRel); }
newProject.getRowType().getFieldList(), adjustments); projChild = CalcRel.createFilter(newProject, newFilter); } else { projChild = newProject;
CalcRel.createFilter(bb.root, convertedWhere), false); Set<String> correlatedVariables =
/** * Converts a WHERE clause. * * @param bb Blackboard * @param where WHERE clause, may be null */ private void convertWhere( final Blackboard bb, final SqlNode where) { if (where == null) { return; } SqlNode newWhere = pushDownNotForIn(where); replaceSubqueries(bb, newWhere); final RexNode convertedWhere = bb.convertExpression(newWhere); // only allocate filter if the condition is not TRUE if (!convertedWhere.isAlwaysTrue()) { bb.setRoot( CalcRel.createFilter(bb.root, convertedWhere), false); } }
conditions); ret = CalcRel.createFilter(ret, conditionExp);
cluster.getRexBuilder(), conditions, true); ret = CalcRel.createFilter(ret, conditionExp);
} else if (reduced) { call.transformTo( CalcRel.createFilter( filter.getChild(), expList.get(0)));
return CalcRel.createFilter(rel, condition);
return CalcRel.createFilter(rel, condition);
CalcRel.createFilter( right, condition);
public void onMatch(RelOptRuleCall call) { FilterRel oldFilterRel = call.rel(0); RexNode oldFilterCond = oldFilterRel.getCondition(); if (RexUtil.findOperatorCall( SqlStdOperatorTable.isNotDistinctFromOperator, oldFilterCond) == null) { // no longer contains isNotDistinctFromOperator return; } // Now replace all the "a isNotDistinctFrom b" // with the RexNode given by RelOptUtil.isDistinctFrom() method RemoveIsNotDistinctFromRexShuttle rewriteShuttle = new RemoveIsNotDistinctFromRexShuttle( oldFilterRel.getCluster().getRexBuilder()); RelNode newFilterRel = CalcRel.createFilter( oldFilterRel.getChild(), oldFilterCond.accept(rewriteShuttle)); call.transformTo(newFilterRel); }
CalcRel.createFilter( cartesianJoinRel, joinRel.getCondition());
public void onMatch(RelOptRuleCall call) { FilterRel oldFilterRel = call.rel(0); RexNode oldFilterCond = oldFilterRel.getCondition(); if (RexUtil.findOperatorCall( SqlStdOperatorTable.IS_NOT_DISTINCT_FROM, oldFilterCond) == null) { // no longer contains isNotDistinctFromOperator return; } // Now replace all the "a isNotDistinctFrom b" // with the RexNode given by RelOptUtil.isDistinctFrom() method RemoveIsNotDistinctFromRexShuttle rewriteShuttle = new RemoveIsNotDistinctFromRexShuttle( oldFilterRel.getCluster().getRexBuilder()); RelNode newFilterRel = CalcRel.createFilter( oldFilterRel.getChild(), oldFilterCond.accept(rewriteShuttle)); call.transformTo(newFilterRel); }
public void onMatch(RelOptRuleCall call) { SemiJoinRel semiJoin = call.rel(0); FilterRel filter = call.rel(1); RelNode newSemiJoin = new SemiJoinRel( semiJoin.getCluster(), filter.getChild(), semiJoin.getRight(), semiJoin.getCondition(), semiJoin.getLeftKeys(), semiJoin.getRightKeys()); RelNode newFilter = CalcRel.createFilter( newSemiJoin, filter.getCondition()); call.transformTo(newFilter); } }
CalcRel.createFilter( cartesianJoinRel, join.getCondition());
public void onMatch(RelOptRuleCall call) { SemiJoinRel semiJoin = call.rel(0); FilterRel filter = call.rel(1); RelNode newSemiJoin = new SemiJoinRel( semiJoin.getCluster(), semiJoin.getCluster().traitSetOf(Convention.NONE), filter.getChild(), semiJoin.getRight(), semiJoin.getCondition(), semiJoin.getLeftKeys(), semiJoin.getRightKeys()); RelNode newFilter = CalcRel.createFilter( newSemiJoin, filter.getCondition()); call.transformTo(newFilter); } }
CalcRel.createFilter( right, condition);