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 1a412a3a86..db14182baf 100644 --- ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java +++ ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java @@ -193,6 +193,7 @@ static { system.registerGenericUDF("concat", GenericUDFConcat.class); + system.registerUDF("mid", UDFSubstr.class, false); system.registerUDF("substr", UDFSubstr.class, false); system.registerUDF("substring", UDFSubstr.class, false); system.registerGenericUDF("substring_index", GenericUDFSubstringIndex.class); @@ -498,6 +499,7 @@ system.registerGenericUDF("in_file", GenericUDFInFile.class); system.registerGenericUDF("instr", GenericUDFInstr.class); system.registerGenericUDF("locate", GenericUDFLocate.class); + system.registerGenericUDF("position", GenericUDFLocate.class); system.registerGenericUDF("elt", GenericUDFElt.class); system.registerGenericUDF("concat_ws", GenericUDFConcatWS.class); system.registerGenericUDF("sort_array", GenericUDFSortArray.class); diff --git ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSubstr.java ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSubstr.java index 4136cc7a79..5b1964c50a 100755 --- ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSubstr.java +++ ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSubstr.java @@ -33,7 +33,7 @@ * UDFSubstr. * */ -@Description(name = "substr,substring", +@Description(name = "substr,substring,mid", value = "_FUNC_(str, pos[, len]) - returns the substring of str that" + " starts at pos and is of length len or" + "_FUNC_(bin, pos[, len]) - returns the slice of byte array that" diff --git ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFLocate.java ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFLocate.java index cebc7524e8..a0772228fc 100644 --- ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFLocate.java +++ ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFLocate.java @@ -42,7 +42,7 @@ * *
*/ -@Description(name = "locate", +@Description(name = "locate,position", value = "_FUNC_(substr, str[, pos]) - Returns the position of the first " + "occurance of substr in str after position pos", extended = "Example:\n" diff --git ql/src/test/results/clientpositive/show_functions.q.out ql/src/test/results/clientpositive/show_functions.q.out index 4942fddbe0..613734ab00 100644 --- ql/src/test/results/clientpositive/show_functions.q.out +++ ql/src/test/results/clientpositive/show_functions.q.out @@ -167,6 +167,7 @@ mask_show_last_n matchpath max md5 +mid min minute mod @@ -370,6 +371,7 @@ ntile parse_url_tuple percentile posexplode +position positive quote regexp_replace @@ -436,6 +438,7 @@ mask_show_last_n matchpath max md5 +mid min minute mod