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


##########
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:
   could we update the comment with what @okumin wrote:
   ````
   Mode.PARTIAL1 or Mode.COMPLETE: T => List[T]
   Mode.PARTIAL2 or Mode.FINAL: List[T] => List[T]
   ````
   `The output of a partial aggregation is a list` is kinda confusing, PARTIAL2 
is also partial
   
   see comments at the top
   // For PARTIAL1 and COMPLETE: ObjectInspectors for original data
   // For PARTIAL2 and FINAL: ObjectInspectors for partial aggregations (list 
of objs)
   



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