@Override public EvalNode visitBinaryEval(LogicalPlanner.PlanContext context, Stack<EvalNode> stack, BinaryEval binaryEval) { stack.push(binaryEval); for (int i = 0; i < 2; i++) { if (binaryEval.getChild(i).getType() == EvalType.FIELD) { FieldEval fieldEval = (FieldEval) binaryEval.getChild(i); if (context.getQueryBlock().isConstReference(fieldEval.getName())) { binaryEval.setChild(i, context.getQueryBlock().getConstByReference(fieldEval.getName())); continue; } } visit(context, binaryEval.getChild(i), stack); } stack.pop(); return binaryEval; }
@Override public EvalNode visitBinaryEval(LogicalPlanner.PlanContext context, Stack<EvalNode> stack, BinaryEval binaryEval) { stack.push(binaryEval); for (int i = 0; i < 2; i++) { if (binaryEval.getChild(i).getType() == EvalType.FIELD) { FieldEval fieldEval = (FieldEval) binaryEval.getChild(i); if (context.getQueryBlock().isConstReference(fieldEval.getName())) { binaryEval.setChild(i, context.getQueryBlock().getConstByReference(fieldEval.getName())); continue; } } visit(context, binaryEval.getChild(i), stack); } stack.pop(); return binaryEval; }
@Override public void visit(EvalNode node) { if (EvalTreeUtil.isJoinQual(null, schemas[0], schemas[1], node, includeThetaJoin)) { BinaryEval binaryEval = (BinaryEval) node; Column[] pair = new Column[2]; for (int i = 0; i <= 1; i++) { // access left, right sub expression Column column = EvalTreeUtil.findAllColumnRefs(binaryEval.getChild(i)).get(0); for (int j = 0; j < schemas.length; j++) { // check whether the column is for either outer or inner // 0 is outer, and 1 is inner if (schemas[j].contains(column.getQualifiedName())) { pair[j] = column; } } } if (pair[0] == null || pair[1] == null) { throw new IllegalStateException("Wrong join key: " + node); } pairs.add(pair); } }
@Override public void visit(EvalNode node) { if (EvalTreeUtil.isJoinQual(null, schemas[0], schemas[1], node, includeThetaJoin)) { BinaryEval binaryEval = (BinaryEval) node; Column[] pair = new Column[2]; for (int i = 0; i <= 1; i++) { // access left, right sub expression Column column = EvalTreeUtil.findAllColumnRefs(binaryEval.getChild(i)).get(0); for (int j = 0; j < schemas.length; j++) { // check whether the column is for either outer or inner // 0 is outer, and 1 is inner if (schemas[j].contains(column.getQualifiedName())) { pair[j] = column; } } } if (pair[0] == null || pair[1] == null) { throw new IllegalStateException("Wrong join key: " + node); } pairs.add(pair); } }
EvalNode term = binaryQual.getChild(i); pushDownIfComplexTermInJoinCondition(newContext, eachQual, term);
EvalNode term = binaryQual.getChild(i); pushDownIfComplexTermInJoinCondition(newContext, eachQual, term);