[ 
https://issues.apache.org/jira/browse/HIVE-25738?focusedWorklogId=687996&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-687996
 ]

ASF GitHub Bot logged work on HIVE-25738:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 30/Nov/21 13:10
            Start Date: 30/Nov/21 13:10
    Worklog Time Spent: 10m 
      Work Description: kgyrtkirk commented on a change in pull request #2816:
URL: https://github.com/apache/hive/pull/2816#discussion_r759262257



##########
File path: ql/src/test/queries/clientpositive/udf_nullif.q
##########
@@ -27,3 +27,12 @@ select       nullif(a,b),
        nullif(b,c),
        nullif(c,d),
        nullif(d,a) from t0;
+
+SELECT assert_true(NULLIF(array(1,2,3),array(1,2,3)) is null);
+SELECT assert_true(NULLIF(array(1,2,3),array(3,2,1)) is not null);
+
+SELECT assert_true(NULLIF(named_struct("c", 1),named_struct("c", 1)) is null);
+SELECT assert_true(NULLIF(named_struct("c", 1),named_struct("c", 2)) is not 
null);
+
+SELECT assert_true(NULLIF(map('a',1,'b',2),map('a',1,'b',2)) is null);
+SELECT assert_true(NULLIF(map('a',1,'b',2),map('a',1,'b',3)) is not null);

Review comment:
       the additional benefit is that you can't just overwrite the q.out for 
wrong results; it will fail the sql statement




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 687996)
    Time Spent: 1h 50m  (was: 1h 40m)

> NullIf doesn't support complex types
> ------------------------------------
>
>                 Key: HIVE-25738
>                 URL: https://issues.apache.org/jira/browse/HIVE-25738
>             Project: Hive
>          Issue Type: Improvement
>            Reporter: Zoltan Haindrich
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> {code}
> SELECT NULLIF(array(1,2,3),array(1,2,3))
> {code}
> results in:
> {code}
>  java.lang.ClassCastException: 
> org.apache.hadoop.hive.serde2.objectinspector.StandardListObjectInspector 
> cannot be cast to 
> org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector
>       at 
> org.apache.hadoop.hive.ql.udf.generic.GenericUDFNullif.evaluate(GenericUDFNullif.java:96)
>       at 
> org.apache.hadoop.hive.ql.udf.generic.GenericUDF.initializeAndFoldConstants(GenericUDF.java:177)
>       at 
> org.apache.hadoop.hive.ql.parse.type.HiveFunctionHelper.getReturnType(HiveFunctionHelper.java:135)
>       at 
> org.apache.hadoop.hive.ql.parse.type.RexNodeExprFactory.createFuncCallExpr(RexNodeExprFactory.java:647)
> [...]
> {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to