Jackie-Jiang commented on code in PR #13354:
URL: https://github.com/apache/pinot/pull/13354#discussion_r1633994691


##########
pinot-common/src/main/java/org/apache/pinot/common/utils/DataSchema.java:
##########
@@ -523,7 +523,7 @@ private static int[] toIntArray(Object value) {
         return (int[]) value;
       } else if (value instanceof IntArrayList) {
         // For ArrayAggregationFunction
-        return ((IntArrayList) value).elements();
+        return ((IntArrayList) value).toIntArray();

Review Comment:
   Add a length check?



##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/utils/TypeUtils.java:
##########
@@ -80,18 +88,23 @@ public static Object convert(Object value, ColumnDataType 
storedType) {
       case DOUBLE_ARRAY:
         if (value instanceof DoubleArrayList) {
           // For HistogramAggregationFunction and ArrayAggregationFunction
-          return ((DoubleArrayList) value).elements();
+          DoubleArrayList doubleArrayList = (DoubleArrayList) value;
+          double[] doubleArrayListElements = doubleArrayList.elements();
+          return doubleArrayListElements.length == doubleArrayList.size() ? 
doubleArrayListElements
+              : doubleArrayList.toDoubleArray();
         } else {
           return value;
         }
       case STRING_ARRAY:
         if (value instanceof ObjectArrayList) {
           // For ArrayAggregationFunction
-          return ((ObjectArrayList<String>) value).toArray(new String[0]);
+          ObjectArrayList<String> stringArrayList = (ObjectArrayList<String>) 
value;
+          String[] elements = stringArrayList.elements();
+          return elements.length == stringArrayList.size() ? elements : 
stringArrayList.toArray(new String[0]);
         } else {
           return value;
         }
-      // TODO: Add more conversions
+        // TODO: Add more conversions

Review Comment:
   (nit) Revert



-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to