clintropolis commented on code in PR #15559:
URL: https://github.com/apache/druid/pull/15559#discussion_r1449555591


##########
processing/src/main/java/org/apache/druid/segment/DimensionHandlerUtils.java:
##########
@@ -421,90 +422,58 @@ public static Comparable<?> convertObjectToType(
   }
 
   @Nullable
-  public static ComparableList convertToList(Object obj, ValueType elementType)
+  public static Object[] convertToList(Object obj, ValueType elementType)
   {
     switch (elementType) {

Review Comment:
   i suppose this could just call with using convertObjectToType as the element 
coercion function to handle any array type (including nested arrays)?



##########
processing/src/main/java/org/apache/druid/segment/DimensionHandlerUtils.java:
##########
@@ -421,90 +422,58 @@ public static Comparable<?> convertObjectToType(
   }
 
   @Nullable
-  public static ComparableList convertToList(Object obj, ValueType elementType)
+  public static Object[] convertToList(Object obj, ValueType elementType)

Review Comment:
   nit: probably should rename to `convertToArray`



##########
processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/column/ArrayNumericGroupByColumnSelectorStrategy.java:
##########
@@ -28,17 +28,17 @@
 import org.apache.druid.query.ordering.StringComparator;
 import org.apache.druid.query.ordering.StringComparators;
 import org.apache.druid.segment.ColumnValueSelector;
-import org.apache.druid.segment.data.ComparableList;
 
 import javax.annotation.Nullable;
 import java.nio.ByteBuffer;
 import java.util.List;
 
-public abstract class ArrayNumericGroupByColumnSelectorStrategy<T extends 
Comparable>
+public abstract class ArrayNumericGroupByColumnSelectorStrategy<T>
     implements GroupByColumnSelectorStrategy
 {
   protected static final int GROUP_BY_MISSING_VALUE = -1;
 
+  // TODO(laksh): Keep the dictionary types as List<T> instead of Object[] to 
allow for equality comparisons

Review Comment:
   alternatively, i think you could also use a collection that takes a 
comparator and use the comparator of the array type? I think that would let 
this work with any type of array (including nested arrays, if we also switch to 
sourcing the comparator from nullable typestrategy) to make this the 'default' 
dictionary building array strategy (leaving the string thing as an optimization)



##########
processing/src/main/java/org/apache/druid/query/ComparisonUtils.java:
##########
@@ -0,0 +1,129 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.query;
+
+import org.apache.druid.error.DruidException;
+import org.apache.druid.java.util.common.guava.Comparators;
+import org.apache.druid.query.ordering.StringComparator;
+import org.apache.druid.query.ordering.StringComparators;
+import org.apache.druid.segment.column.TypeSignature;
+import org.apache.druid.segment.column.ValueType;
+
+import javax.annotation.Nullable;
+import java.util.Comparator;
+
+public class ComparisonUtils
+{
+
+  public static Comparator<Object> 
getComparatorForType(TypeSignature<ValueType> type)

Review Comment:
   I don't think this is necessary, can just use type.getNullableStrategy()



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

Reply via email to