/** * 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, RelOptUtil.Logic.UNKNOWN_AS_FALSE); final RexNode convertedWhere = bb.convertExpression(newWhere); // only allocate filter if the condition is not TRUE if (!convertedWhere.isAlwaysTrue()) { bb.setRoot( RelOptUtil.createFilter(bb.root, convertedWhere), false); } }
SqlNode[] sqlOperands = ((SqlBasicCall) sqlCall).operands; for (int i = 0; i < sqlOperands.length; i++) { sqlOperands[i] = pushDownNotForIn(sqlOperands[i]); orOperands[i] = pushDownNotForIn(orOperands[i]); andOperands[i] = pushDownNotForIn(andOperands[i]); SqlNode[] notOperands = childSqlCall.getOperands(); assert notOperands.length == 1; return pushDownNotForIn(notOperands[0]); } else if (childSqlCall.getOperator() instanceof SqlInOperator) { SqlNode[] inOperands = childSqlCall.getOperands();
SqlNode newHaving = pushDownNotForIn(having); replaceSubqueries(bb, newHaving, RelOptUtil.Logic.UNKNOWN_AS_FALSE); havingExpr = bb.convertExpression(newHaving);
/** * 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); } }
SqlNode[] sqlOperands = ((SqlBasicCall) sqlCall).operands; for (int i = 0; i < sqlOperands.length; i++) { sqlOperands[i] = pushDownNotForIn(sqlOperands[i]); orOperands[i] = pushDownNotForIn(orOperands[i]); andOperands[i] = pushDownNotForIn(andOperands[i]); SqlNode[] notOperands = childSqlCall.getOperands(); assert notOperands.length == 1; return pushDownNotForIn(notOperands[0]); } else if (childSqlCall.getOperator() instanceof SqlInOperator) { SqlNode[] inOperands = childSqlCall.getOperands();
SqlNode newHaving = pushDownNotForIn(having); replaceSubqueries(bb, newHaving); havingExpr = bb.convertExpression(newHaving);