jihoonson commented on a change in pull request #9638:
URL: https://github.com/apache/druid/pull/9638#discussion_r475018525



##########
File path: 
extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchToEstimatePostAggregator.java
##########
@@ -62,6 +63,12 @@ public String getName()
     return name;
   }
 
+  @Override
+  public ValueType getType()
+  {
+    return ValueType.DOUBLE;

Review comment:
       Should it be `round ? ValueType.LONG : ValueType.DOUBLE`?

##########
File path: 
extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchToHistogramPostAggregator.java
##########
@@ -102,6 +103,15 @@ public String getName()
     return name;
   }
 
+  /**
+   * actual type is {@link DoublesSketch}
+   */
+  @Override
+  public ValueType getType()
+  {
+    return ValueType.COMPLEX;

Review comment:
       Should this be `DOUBLE_ARRAY`?

##########
File path: 
processing/src/main/java/org/apache/druid/query/aggregation/post/FieldAccessPostAggregator.java
##########
@@ -40,16 +41,24 @@
   @Nullable
   private final String name;
   private final String fieldName;
+  @Nullable

Review comment:
       Doesn't seem nullable.

##########
File path: 
processing/src/main/java/org/apache/druid/query/aggregation/post/FinalizingFieldAccessPostAggregator.java
##########
@@ -26,16 +26,20 @@
 import org.apache.druid.query.aggregation.AggregatorFactory;
 import org.apache.druid.query.aggregation.PostAggregator;
 import org.apache.druid.query.cache.CacheKeyBuilder;
+import org.apache.druid.segment.column.ValueType;
+import org.apache.druid.segment.column.ValueTypes;
 
 import java.util.Comparator;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Set;
 import java.util.function.Function;
 
 public class FinalizingFieldAccessPostAggregator implements PostAggregator
 {
   private final String name;
   private final String fieldName;
+  private final ValueType finalizedType;

Review comment:
       This is nullable. Also missing in `getCacheKey()`, `equals()`, and 
`hashCode()`.

##########
File path: 
processing/src/main/java/org/apache/druid/query/aggregation/post/ExpressionPostAggregator.java
##########
@@ -287,10 +295,6 @@ public boolean equals(Object o)
   @Override
   public int hashCode()
   {
-    int result = name != null ? name.hashCode() : 0;
-    result = 31 * result + expression.hashCode();
-    result = 31 * result + comparator.hashCode();
-    result = 31 * result + (ordering != null ? ordering.hashCode() : 0);
-    return result;
+    return Objects.hash(name, expression, comparator, ordering);

Review comment:
       Should `outputType` be in here, `equals()` and `getCacheKey()`?

##########
File path: 
extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/theta/SketchEstimatePostAggregator.java
##########
@@ -100,6 +101,12 @@ public String getName()
     return name;
   }
 
+  @Override
+  public ValueType getType()
+  {
+    return ValueType.DOUBLE;

Review comment:
       `errorBoundsStdDev != null ? ValueType.COMPLEX : ValueType.DOUBLE`?

##########
File path: 
processing/src/main/java/org/apache/druid/query/aggregation/AggregatorFactory.java
##########
@@ -211,22 +213,38 @@ public AggregatorFactory 
getMergingFactory(AggregatorFactory other) throws Aggre
   public abstract List<String> requiredFields();
 
   /**
-   * Get the type name of the intermediate type for this aggregator. This is 
the same as the type returned by
+   * Get the "intermediate" {@link ValueType} for this aggregator. This is the 
same as the type returned by
    * {@link #deserialize} and the type accepted by {@link #combine}. However, 
it is *not* necessarily the same type
    * returned by {@link #finalizeComputation}.
    *
-   * If the type is complex (i.e. not a simple, numeric {@link 
org.apache.druid.segment.column.ValueType}) then there
+   * Refer to the {@link ValueType} javadocs for details on the implications 
of choosing a type.
+   */
+  public abstract ValueType getType();

Review comment:
       `getType()` seems too broad even though it is actually an intermediate 
type. Maybe `getIntermediateType()` is a better name?

##########
File path: 
processing/src/test/java/org/apache/druid/query/aggregation/AggregatorFactoryTest.java
##########
@@ -77,4 +103,168 @@ public void testMergeAggregators()
     Assert.assertNull(AggregatorFactory.mergeAggregators(ImmutableList.of(af1, 
af2))
     );
   }
+
+  @Test
+  public void testResultArraySignature()

Review comment:
       :sweat_smile: 

##########
File path: 
processing/src/main/java/org/apache/druid/query/aggregation/post/FieldAccessPostAggregator.java
##########
@@ -40,16 +41,24 @@
   @Nullable
   private final String name;
   private final String fieldName;
+  @Nullable
+  private final ValueType type;

Review comment:
       `type` is missing in `getCacheKey()`, `equals()`, and `hashCode()`.




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

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