[
https://issues.apache.org/jira/browse/HIVE-25738?focusedWorklogId=688010&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-688010
]
ASF GitHub Bot logged work on HIVE-25738:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 30/Nov/21 13:36
Start Date: 30/Nov/21 13:36
Worklog Time Spent: 10m
Work Description: zabetak commented on a change in pull request #2816:
URL: https://github.com/apache/hive/pull/2816#discussion_r759283876
##########
File path:
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFNullif.java
##########
@@ -49,6 +50,17 @@ public ObjectInspector initialize(ObjectInspector[]
arguments) throws UDFArgumen
returnOIResolver = new GenericUDFUtils.ReturnObjectInspectorResolver(true);
returnOIResolver.update(arguments[0]);
+ switch (arguments[0].getCategory()) {
+ case LIST:
+ case MAP:
+ case STRUCT:
+ case PRIMITIVE:
+ break;
+ case UNION:
+ default:
+ throw new UDFArgumentTypeException(0, "Unsupported Argument type
category: " + arguments[0].getCategory());
+ }
+
boolean isPrimitive = (arguments[0] instanceof PrimitiveObjectInspector);
if (isPrimitive)
{
Review comment:
From reading the code, it seems that we cannot do `NULLIF(1,'1')` it
will fail with an exception. On the contrary it seems that now, we are able to
do `NULLIF(array(1,2), array('1','2'))`.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 688010)
Time Spent: 2h 10m (was: 2h)
> 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: 2h 10m
> 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)