public RexNode visitFieldAccess(RexFieldAccess fieldAccess) { final RexNode expr = fieldAccess.getReferenceExpr(); expr.accept(this); final RexNode normalizedExpr = lookup(expr); if (normalizedExpr != expr) { fieldAccess = new RexFieldAccess(normalizedExpr, fieldAccess.getField()); } return register(fieldAccess); }
public JavaRel findRel(JavaRel rel, RexNode expression) { if (expression instanceof RexInputRef) { RexInputRef variable = (RexInputRef) expression; // REVIEW jvs 30-May-2005: What's up with this? The "&& false" // should have at least a comment! if ((rel instanceof JoinRelBase) && false) { return (JavaRel) findInputRel(rel, variable.getIndex()); } else { return (JavaRel) rel.getInput(variable.getIndex()); } } else if (expression instanceof RexFieldAccess) { RexFieldAccess fieldAccess = (RexFieldAccess) expression; String fieldName = fieldAccess.getName(); RexNode refExp = fieldAccess.getReferenceExpr(); JavaRel rel2 = findRel(rel, refExp); // recursive if (rel2 == null) { return null; } return implementFieldAccess(rel2, fieldName); } else { return null; } }