Akshat-Jain commented on code in PR #16682:
URL: https://github.com/apache/druid/pull/16682#discussion_r1677509084


##########
sql/src/main/java/org/apache/druid/sql/calcite/aggregation/builtin/BuiltinApproxCountDistinctSqlAggregator.java:
##########
@@ -118,12 +120,14 @@ public Aggregation toDruidAggregation(
       }
 
       if (inputType.is(ValueType.COMPLEX)) {
-        aggregatorFactory = new HyperUniquesAggregatorFactory(
-            aggregatorName,
-            dimensionSpec.getOutputName(),
-            false,
-            true
-        );
+        if (validateInputType(inputType)) {

Review Comment:
   @kgyrtkirk That would work, but would lead to unnecessary duplication of 
logic, since we also have `validateInputType()` method in this part of code:
   ```java
   if (arg.isDirectColumnAccess()
           && inputAccessor.getInputRowSignature()
               .getColumnType(arg.getDirectColumn())
               .map(type -> type.is(ValueType.COMPLEX) && 
validateInputType(type))
               .orElse(false)) {
         aggregatorFactory = new HyperUniquesAggregatorFactory(aggregatorName, 
arg.getDirectColumn(), false, true);
       }
   ```
   
   Thoughts?



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