private boolean exprContainsOnlyPartitionColOrVirtualColOrConstants(ExprNodeDesc en) {
      if (en == null) {
        return true;
      }
      if (exprNodeToPartOrVirtualColOrConstExpr.containsKey(en)) {
        return exprNodeToPartOrVirtualColOrConstExpr.get(en);
      }
      if (en instanceof ExprNodeColumnDesc) {
        boolean ret = ((ExprNodeColumnDesc)en).getIsPartitionColOrVirtualCol();
        exprNodeToPartOrVirtualColOrConstExpr.put(en, ret);
        return ret;
      }
      if (en.getChildren() != null) {
        for (ExprNodeDesc cn : en.getChildren()) {
          if (!exprContainsOnlyPartitionColOrVirtualColOrConstants(cn)) {
            exprNodeToPartOrVirtualColOrConstExpr.put(en, false);
            return false;
          }
        }
      }
      exprNodeToPartOrVirtualColOrConstExpr.put(en, true);
      return true;
    }
This function iterates through the entire subtree under a given expression node
and makes sure that the expression contain only constant nodes or
partition/virtual columns as leaf nodes.
@param en Expression Node Descriptor for the root node.
@return true if the subtree rooted under en has only partition/virtual columns or
constant values as the leaf nodes. Else, return false.
ql/src/java/org/apache/hadoop/hive/ql/optimizer/PartitionColumnsSeparator.java