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


##########
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:
   Yes, I think that condition was just to check "no map 
aggregation"(=Mode.COMPLETE) or not, not for safe type casting.
   As comments said above, "The output of a partial aggregation is a list"
   
   
https://github.com/apache/hive/blob/588c2ad9bd343b0ec1e6fa761bc36c0e00682ee6/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFMkCollectionEvaluator.java#L43-L45



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