okumin commented on code in PR #5323:
URL: https://github.com/apache/hive/pull/5323#discussion_r1684126279


##########
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFMkCollectionEvaluator.java:
##########
@@ -62,22 +62,16 @@ public ObjectInspector init(Mode m, ObjectInspector[] 
parameters)
     super.init(m, parameters);
     // init output object inspectors
     // The output of a partial aggregation is a list
-    if (m == Mode.PARTIAL1) {
+    if (mode == Mode.PARTIAL1 || mode == Mode.COMPLETE) {
       inputOI = parameters[0];
       return ObjectInspectorFactory.getStandardListObjectInspector(
           ObjectInspectorUtils.getStandardObjectInspector(inputOI));
     } else {
-      if (!(parameters[0] instanceof ListObjectInspector)) {
-        //no map aggregation.
-        inputOI = 
ObjectInspectorUtils.getStandardObjectInspector(parameters[0]);
-        return ObjectInspectorFactory.getStandardListObjectInspector(inputOI);
-      } else {
-        internalMergeOI = (ListObjectInspector) parameters[0];
-        inputOI = internalMergeOI.getListElementObjectInspector();
-        loi = (StandardListObjectInspector)
-            ObjectInspectorUtils.getStandardObjectInspector(internalMergeOI);
-        return loi;
-      }
+      internalMergeOI = (ListObjectInspector) parameters[0];

Review Comment:
   I also guess so. `COLLECT_LIST|SET` processes objects of a type T like that.
   - `Mode.PARTIAL1` or `Mode.COMPLETE`: T => List[T]
   - `Mode.PARTIAL2` or `Mode.FINAL`: List[T] => List[T]
   
   The original one tried to check the type of inputs, T or List[T], to 
conclude the current mode. But it can lead to a wrong conclusion when T is 
List[X] because both `List[X]` and `List[List[X]]` hit the condition.



-- 
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


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

Reply via email to