public static boolean treesWithIndependentInputs(Operator<?> tree1, Operator<?> tree2) {
    Set<String> tables1 = signaturesOf(OperatorUtils.findOperatorsUpstream(tree1, TableScanOperator.class));
    Set<String> tables2 = signaturesOf(OperatorUtils.findOperatorsUpstream(tree2, TableScanOperator.class));

    tables1.retainAll(tables2);
    return tables1.isEmpty();
  }
Determines if the two trees are using independent inputs.
ql/src/java/org/apache/hadoop/hive/ql/exec/OperatorUtils.java