private static RexTableInputRef extractTableInputRef(RexNode node) {
    RexTableInputRef ref = null;
    if (node instanceof RexTableInputRef) {
      ref = (RexTableInputRef) node;
    } else if (RexUtil.isLosslessCast(node) &&
        ((RexCall) node).getOperands().get(0) instanceof RexTableInputRef) {
      ref = (RexTableInputRef) ((RexCall) node).getOperands().get(0);
    }
    return ref;
  }
Returns a triple where first value represents whether we could extract a FK-PK join
or not, the second value is a pair with the column from left and right input that
are used for the FK-PK join, and the third value are the predicates that are not
part of the FK-PK condition. Currently we can only extract one FK-PK join.
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/HiveRelOptUtil.java