public static boolean onlyContainsPartnCols(Table table, ExprNodeDesc expr) {
    if (!table.isPartitioned() || (expr == null)) {
      return true;
    }

    if (expr instanceof ExprNodeColumnDesc) {
      String columnName = ((ExprNodeColumnDesc) expr).getColumn();
      return isPartitionKey(table, columnName);
    }

    // It cannot contain a non-deterministic function
    if ((expr instanceof ExprNodeGenericFuncDesc)
        && !FunctionRegistry.isConsistentWithinQuery(((ExprNodeGenericFuncDesc) expr)
        .getGenericUDF())) {
      return false;
    }

    // All columns of the expression must be partitioned columns
    List<ExprNodeDesc> children = expr.getChildren();
    if (children != null) {
      for (int i = 0; i < children.size(); i++) {
        if (!onlyContainsPartnCols(table, children.get(i))) {
          return false;
        }
      }
    }

    return true;
  }
Find out whether the condition only contains partitioned columns. Note that
if the table is not partitioned, the function always returns true.
condition.

@param table
         the table object
@param expr
         the pruner expression for the table
ql/src/java/org/apache/hadoop/hive/ql/optimizer/ppr/PartitionPruner.java