public static boolean isConsistentWithinQuery(GenericUDF genericUDF) {
    return (isDeterministic(genericUDF) || isRuntimeConstant(genericUDF)) && !isStateful(genericUDF);
  }
Returns whether the expression, for a single query, returns the same result given
the same arguments/children. This includes deterministic functions as well as runtime
constants (which may not be deterministic across queries).
ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java