You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2021/11/29 09:29:56 UTC

[GitHub] [hive] zabetak commented on a change in pull request #2816: HIVE-25738: NullIf doesn't support complex types

zabetak commented on a change in pull request #2816:
URL: https://github.com/apache/hive/pull/2816#discussion_r758174023



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFNullif.java
##########
@@ -86,17 +87,13 @@ public ObjectInspector initialize(ObjectInspector[] arguments) throws UDFArgumen
   public Object evaluate(DeferredObject[] arguments) throws HiveException {
     Object arg0 = arguments[0].get();
     Object arg1 = arguments[1].get();
-    Object value0 = null;
-    if (arg0 != null) {
-      value0 = returnOIResolver.convertIfNecessary(arg0, argumentOIs[0], false);
-    }
+    Object value0 = returnOIResolver.convertIfNecessary(arg0, argumentOIs[0], false);
     if (arg0 == null || arg1 == null) {
       return value0;
     }
-    PrimitiveObjectInspector compareOI = (PrimitiveObjectInspector) returnOIResolver.get();
-    if (PrimitiveObjectInspectorUtils.comparePrimitiveObjects(
-        value0, compareOI,
-        returnOIResolver.convertIfNecessary(arg1, argumentOIs[1], false), compareOI)) {
+    Object value1 = returnOIResolver.convertIfNecessary(arg1, argumentOIs[1], false);
+    ObjectInspector compareOI = returnOIResolver.get();
+    if (ObjectInspectorUtils.compare(value0, compareOI, value1, compareOI) == 0) {

Review comment:
       Since now we are expanding the support to non-primitives can/should we support all other categories: MAP, STRUCT, UNION? 
   I think we should have positive tests for all supported types and negative tests (exception) for non-supported ones (if any).




-- 
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-unsubscribe@hive.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org