diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java index 0f05160..cdac21b 100644 --- ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java +++ ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java @@ -333,6 +333,7 @@ system.registerGenericUDF("*", GenericUDFOPMultiply.class); system.registerGenericUDF("/", GenericUDFOPDivide.class); system.registerGenericUDF("%", GenericUDFOPMod.class); + system.registerGenericUDF("mod", GenericUDFOPMod.class); system.registerUDF("div", UDFOPLongDivide.class, true); system.registerUDF("&", UDFOPBitAnd.class, true); diff --git ql/src/test/queries/clientpositive/udf_modulo.q ql/src/test/queries/clientpositive/udf_modulo.q index 70f511f..28a9b10 100644 --- ql/src/test/queries/clientpositive/udf_modulo.q +++ ql/src/test/queries/clientpositive/udf_modulo.q @@ -1,2 +1,9 @@ +set hive.fetch.task.conversion=more; + +DESCRIBE FUNCTION mod; +DESCRIBE FUNCTION EXTENDED mod; + +SELECT mod(3, 2) FROM SRC tablesample (1 rows); + DESCRIBE FUNCTION %; DESCRIBE FUNCTION EXTENDED %; diff --git ql/src/test/results/clientpositive/show_functions.q.out ql/src/test/results/clientpositive/show_functions.q.out index 3c9bb4a..1361b93 100644 --- ql/src/test/results/clientpositive/show_functions.q.out +++ ql/src/test/results/clientpositive/show_functions.q.out @@ -154,6 +154,7 @@ max md5 min minute +mod month months_between named_struct @@ -382,6 +383,7 @@ max md5 min minute +mod month months_between xpath diff --git ql/src/test/results/clientpositive/udf_modulo.q.out ql/src/test/results/clientpositive/udf_modulo.q.out index 084dc45..b093625 100644 --- ql/src/test/results/clientpositive/udf_modulo.q.out +++ ql/src/test/results/clientpositive/udf_modulo.q.out @@ -1,3 +1,25 @@ +PREHOOK: query: DESCRIBE FUNCTION mod +PREHOOK: type: DESCFUNCTION +POSTHOOK: query: DESCRIBE FUNCTION mod +POSTHOOK: type: DESCFUNCTION +a mod b - Returns the remainder when dividing a by b +PREHOOK: query: DESCRIBE FUNCTION EXTENDED mod +PREHOOK: type: DESCFUNCTION +POSTHOOK: query: DESCRIBE FUNCTION EXTENDED mod +POSTHOOK: type: DESCFUNCTION +a mod b - Returns the remainder when dividing a by b +Synonyms: % +Function class:org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPMod +Function type:BUILTIN +PREHOOK: query: SELECT mod(3, 2) FROM SRC tablesample (1 rows) +PREHOOK: type: QUERY +PREHOOK: Input: default@src +#### A masked pattern was here #### +POSTHOOK: query: SELECT mod(3, 2) FROM SRC tablesample (1 rows) +POSTHOOK: type: QUERY +POSTHOOK: Input: default@src +#### A masked pattern was here #### +1 PREHOOK: query: DESCRIBE FUNCTION % PREHOOK: type: DESCFUNCTION POSTHOOK: query: DESCRIBE FUNCTION % @@ -8,5 +30,6 @@ PREHOOK: type: DESCFUNCTION POSTHOOK: query: DESCRIBE FUNCTION EXTENDED % POSTHOOK: type: DESCFUNCTION a % b - Returns the remainder when dividing a by b +Synonyms: mod Function class:org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPMod Function type:BUILTIN