diff --git ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPEqualNS.java ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPEqualNS.java index cd339c004a..585a22539b 100644 --- ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPEqualNS.java +++ ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPEqualNS.java @@ -21,11 +21,16 @@ import org.apache.hadoop.hive.ql.exec.Description; import org.apache.hadoop.hive.ql.metadata.HiveException; -@Description(name = "<=>", value = "a _FUNC_ b - Returns same result with EQUAL(=) operator " + - "for non-null operands, but returns TRUE if both are NULL, FALSE if one of the them is NULL") +@Description(name = "IS NOT DISTINCT FROM", value = "a _FUNC_ b - Returns same result with EQUALNS (IS NOT DISTINCT " + + "FROM) operator for non-null operands, but returns TRUE if both are NULL, FALSE if one of the them is NULL") @NDV(maxNdv = 2) public class GenericUDFOPEqualNS extends GenericUDFOPEqual { + public GenericUDFOPEqualNS(){ + this.opName = "EQUALNS"; + this.opDisplayName = "IS NOT DISTINCT FROM"; + } + @Override public Object evaluate(DeferredObject[] arguments) throws HiveException { Object o0 = arguments[0].get(); @@ -43,6 +48,6 @@ public Object evaluate(DeferredObject[] arguments) throws HiveException { @Override public GenericUDF negative() { - return new GenericUDFOPNotEqualNS(); + return new GenericUDFOPNotEqualNS(); } } diff --git ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNotEqualNS.java ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNotEqualNS.java index d48bbbbce3..f4b5e8f547 100644 --- ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNotEqualNS.java +++ ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNotEqualNS.java @@ -18,11 +18,19 @@ package org.apache.hadoop.hive.ql.udf.generic; +import org.apache.hadoop.hive.ql.exec.Description; import org.apache.hadoop.hive.ql.metadata.HiveException; // this function is for internal use only public class GenericUDFOPNotEqualNS extends GenericUDFOPNotEqual { + @Description(name = "IS DISTINCT FROM", value = "a _FUNC_ b - Returns same result with NOTEQUALNS (IS DISTINCT " + + "FROM) operator for non-null operands, but returns FALSE if both are NULL, TRUE if one of the them is NULL") + public GenericUDFOPNotEqualNS(){ + this.opName = "NOTEQUALNS"; + this.opDisplayName = "IS DISTINCT FROM"; + } + @Override public Object evaluate(DeferredObject[] arguments) throws HiveException { Object o0 = arguments[0].get(); @@ -40,6 +48,6 @@ public Object evaluate(DeferredObject[] arguments) throws HiveException { @Override public GenericUDF negative() { - return new GenericUDFOPEqualNS(); + return new GenericUDFOPEqualNS(); } } diff --git ql/src/test/results/clientpositive/llap/is_distinct_from.q.out ql/src/test/results/clientpositive/llap/is_distinct_from.q.out index 010c4a15f8..fa581f768e 100644 --- ql/src/test/results/clientpositive/llap/is_distinct_from.q.out +++ ql/src/test/results/clientpositive/llap/is_distinct_from.q.out @@ -206,9 +206,9 @@ STAGE PLANS: Processor Tree: TableScan alias: test_n5 - filterExpr: (y <> null) (type: boolean) + filterExpr: (y IS DISTINCT FROM null) (type: boolean) Filter Operator - predicate: (y <> null) (type: boolean) + predicate: (y IS DISTINCT FROM null) (type: boolean) Select Operator expressions: x (type: string), y (type: string) outputColumnNames: _col0, _col1 @@ -243,9 +243,9 @@ STAGE PLANS: Processor Tree: TableScan alias: test_n5 - filterExpr: (y = null) (type: boolean) + filterExpr: (y IS NOT DISTINCT FROM null) (type: boolean) Filter Operator - predicate: (y = null) (type: boolean) + predicate: (y IS NOT DISTINCT FROM null) (type: boolean) Select Operator expressions: x (type: string), null (type: string) outputColumnNames: _col0, _col1 @@ -287,9 +287,9 @@ STAGE PLANS: Processor Tree: TableScan alias: part - filterExpr: (p_size <> 2) (type: boolean) + filterExpr: (p_size IS DISTINCT FROM 2) (type: boolean) Filter Operator - predicate: (p_size <> 2) (type: boolean) + predicate: (p_size IS DISTINCT FROM 2) (type: boolean) Select Operator expressions: p_partkey (type: int), p_name (type: string), p_mfgr (type: string), p_brand (type: string), p_type (type: string), p_size (type: int), p_container (type: string), p_retailprice (type: double), p_comment (type: string) outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8 @@ -343,9 +343,9 @@ STAGE PLANS: Processor Tree: TableScan alias: part - filterExpr: (p_size = 2) (type: boolean) + filterExpr: (p_size IS NOT DISTINCT FROM 2) (type: boolean) Filter Operator - predicate: (p_size = 2) (type: boolean) + predicate: (p_size IS NOT DISTINCT FROM 2) (type: boolean) Select Operator expressions: p_partkey (type: int), p_name (type: string), p_mfgr (type: string), p_brand (type: string), p_type (type: string), 2 (type: int), p_container (type: string), p_retailprice (type: double), p_comment (type: string) outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8