LakshSingla commented on code in PR #14462:
URL: https://github.com/apache/druid/pull/14462#discussion_r1411617207


##########
processing/src/main/java/org/apache/druid/query/aggregation/first/DoubleFirstAggregatorFactory.java:
##########
@@ -142,12 +160,24 @@ public VectorAggregator factorizeVector(
       VectorColumnSelectorFactory columnSelectorFactory
   )
   {
+    VectorValueSelector timeSelector = 
columnSelectorFactory.makeValueSelector(timeColumn);
     ColumnCapabilities capabilities = 
columnSelectorFactory.getColumnCapabilities(fieldName);
+
     if (Types.isNumeric(capabilities)) {
       VectorValueSelector valueSelector = 
columnSelectorFactory.makeValueSelector(fieldName);
-      VectorValueSelector timeSelector = 
columnSelectorFactory.makeValueSelector(
-          timeColumn);
-      return new DoubleFirstVectorAggregator(timeSelector, valueSelector);
+      VectorObjectSelector objectSelector = 
ExpressionVectorSelectors.castValueSelectorToObject(
+          columnSelectorFactory.getReadableVectorInspector(),
+          fieldName,
+          valueSelector,
+          capabilities.toColumnType(),
+          ColumnType.DOUBLE
+      );
+      return new DoubleFirstVectorAggregator(timeSelector, objectSelector);
+    }

Review Comment:
   With the string factory, we'd need to check if it is of a numeric type and 
cast if so. But if it is a numeric, then it shouldn't be the case, at least for 
DOUBLE objects. Also, if it is a String aggregator, now we return a 
DoubleFirstVectorAggregator (if capabilities correspond to String 
capabilities). 



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