@Override public Void visitCall(RexCall call) { if (res) { res = validRexCall(call); if (res) { return super.visitCall(call); } } return null; }
@Override public Void visitFieldAccess(RexFieldAccess fieldAccess) { final RexNode ref = fieldAccess.getReferenceExpr(); if (ref instanceof RexCorrelVariable) { final RexCorrelVariable var = (RexCorrelVariable) ref; if (mapFieldAccessToCorVar.containsKey(fieldAccess)) { //for cases where different Rel nodes are referring to // same correlation var (e.g. in case of NOT IN) // avoid generating another correlation var // and record the 'rel' is using the same correlation mapRefRelToCorRef.put(rel, mapFieldAccessToCorVar.get(fieldAccess)); } else { final CorRef correlation = new CorRef(var.id, fieldAccess.getField().getIndex(), corrIdGenerator++); mapFieldAccessToCorVar.put(fieldAccess, correlation); mapRefRelToCorRef.put(rel, correlation); } } return super.visitFieldAccess(fieldAccess); }
@Override public Boolean visitCall(RexCall call) { // Constant if operator is deterministic and all operands are // constant. return call.getOperator().isDeterministic() && RexVisitorImpl.visitArrayAnd(this, call.getOperands()); }
@Override public Void visitInputRef(RexInputRef inputRef) { if (!areTypesCompatible(inputRef.getType(), types.get(inputRef.getIndex()).getType())) { throw new Util.FoundOne(inputRef); } return super.visitInputRef(inputRef); }
@Override public Void visitSubQuery(RexSubQuery subQuery) { subQuery.rel.accept(CorelMapBuilder.this); return super.visitSubQuery(subQuery); } };
@Override public Expression visitLocalRef(RexLocalRef localRef) { return super.visitLocalRef(localRef); }
@Override public Void visitTableInputRef(RexTableInputRef ref) { occurrences.add(ref.getTableRef()); return super.visitTableInputRef(ref); } };
@Override public Void visitInputRef(RexInputRef inputRef) { builder.add(inputRef); return super.visitInputRef(inputRef); }
@Override public Void visitSubQuery(RexSubQuery subQuery) { subQuery.rel.accept(CorelMapBuilder.this); return super.visitSubQuery(subQuery); } };
public Void visitLocalRef(RexLocalRef inputRef) { super.visitLocalRef(inputRef); if (inputRef.getIndex() >= limit) { throw new IllegalForwardRefException(); } return null; }
@Override public Void visitTableInputRef(RexTableInputRef ref) { occurrences.add(ref.getTableRef()); return super.visitTableInputRef(ref); } };
@Override public Void visitCall(RexCall call) { if (call.getKind() == SqlKind.AND) { return super.visitCall(call); } else { boolean isValidCall = JDBCRexCallValidator.isValidJdbcOperation(call, dialect); if (isValidCall) { validJdbcNode.add(call); } else { invalidJdbcNode.add(call); } } return null; }
@Override public Void visitFieldAccess(RexFieldAccess fieldAccess) { final RexNode ref = fieldAccess.getReferenceExpr(); if (ref instanceof RexCorrelVariable) { final RexCorrelVariable var = (RexCorrelVariable) ref; if (mapFieldAccessToCorVar.containsKey(fieldAccess)) { //for cases where different Rel nodes are referring to // same correlation var (e.g. in case of NOT IN) // avoid generating another correlation var // and record the 'rel' is using the same correlation mapRefRelToCorRef.put(rel, mapFieldAccessToCorVar.get(fieldAccess)); } else { final CorRef correlation = new CorRef(var.id, fieldAccess.getField().getIndex(), corrIdGenerator++); mapFieldAccessToCorVar.put(fieldAccess, correlation); mapRefRelToCorRef.put(rel, correlation); } } return super.visitFieldAccess(fieldAccess); }
@Override public Void visitInputRef(RexInputRef inputRef) { builder.add(inputRef); return super.visitInputRef(inputRef); }
@Override public Void visitSubQuery(RexSubQuery subQuery) { subQuery.rel.accept(CorelMapBuilder.this); return super.visitSubQuery(subQuery); } };
@Override public Boolean visitCall(RexCall call) { // Constant if operator is deterministic and all operands are // constant. return call.getOperator().isDeterministic() && RexVisitorImpl.visitArrayAnd(this, call.getOperands()); }
public Void visitLocalRef(RexLocalRef inputRef) { super.visitLocalRef(inputRef); if (inputRef.getIndex() >= limit) { throw new IllegalForwardRefException(); } return null; }
@Override public Void visitCall(org.apache.calcite.rex.RexCall call) { if (!call.getOperator().isDeterministic()) { throw new Util.FoundOne(call); } return super.visitCall(call); } };
@Override public ASTNode visitFieldAccess(RexFieldAccess fieldAccess) { return ASTBuilder.construct(HiveParser.DOT, ".").add(super.visitFieldAccess(fieldAccess)) .add(HiveParser.Identifier, fieldAccess.getField().getName()).node(); }
public Void visitInputRef(RexInputRef inputRef) { if (projExprs.size() == 0 ) { return super.visitInputRef(inputRef); } else { final int index = inputRef.getIndex(); RexNode n = projExprs.get(index); if (n instanceof RexCall) { RexCall r = (RexCall) n; if (operators.contains(r.getOperator().getName().toLowerCase())) { throw new Util.FoundOne(r); } } return super.visitInputRef(inputRef); } } };