okumin commented on code in PR #6308:
URL: https://github.com/apache/hive/pull/6308#discussion_r2922409528
##########
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFWhen.java:
##########
@@ -89,11 +96,23 @@ public ObjectInspector initialize(ObjectInspector[]
arguments) throws UDFArgumen
+ "\" is expected but \"" + arguments[i + 1].getTypeName()
+ "\" is found");
}
+ collectNonNullConstant(arguments[i + 1], distinctConstants);
}
+ numberOfDistinctConstants = distinctConstants.size();
+
return returnOIResolver.get();
}
+ private static void collectNonNullConstant(ObjectInspector oi, Set<Object>
distinctConstants) {
+ if (oi instanceof ConstantObjectInspector) {
+ Object value = ((ConstantObjectInspector) oi).getWritableConstantValue();
Review Comment:
Minor:
https://sonarcloud.io/project/issues?sinceLeakPeriod=true&issueStatuses=OPEN%2CCONFIRMED&pullRequest=6308&id=apache_hive&open=AZzgJN8Un1Kc99ploZ32
```suggestion
if (oi instanceof ConstantObjectInspector coi) {
Object value = coi.getWritableConstantValue();
```
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]