clintropolis commented on code in PR #14924:
URL: https://github.com/apache/druid/pull/14924#discussion_r1309698237
##########
processing/src/main/java/org/apache/druid/query/aggregation/last/LongLastAggregatorFactory.java:
##########
@@ -128,7 +128,8 @@ public BufferAggregator
factorizeBuffered(ColumnSelectorFactory metricFactory)
@Override
public boolean canVectorize(ColumnInspector columnInspector)
{
- return true;
+ final ColumnCapabilities capabilities =
columnInspector.getColumnCapabilities(fieldName);
+ return capabilities != null && capabilities.isNumeric();
Review Comment:
same comment about returning true
##########
processing/src/main/java/org/apache/druid/query/aggregation/last/FloatLastAggregatorFactory.java:
##########
@@ -128,7 +128,8 @@ public BufferAggregator
factorizeBuffered(ColumnSelectorFactory metricFactory)
@Override
public boolean canVectorize(ColumnInspector columnInspector)
{
- return true;
+ final ColumnCapabilities capabilities =
columnInspector.getColumnCapabilities(fieldName);
+ return capabilities != null && capabilities.isNumeric();
Review Comment:
same comment about returning true
##########
processing/src/main/java/org/apache/druid/query/aggregation/last/DoubleLastAggregatorFactory.java:
##########
@@ -116,7 +116,8 @@ public Aggregator factorize(ColumnSelectorFactory
metricFactory)
@Override
public boolean canVectorize(ColumnInspector columnInspector)
{
- return true;
+ final ColumnCapabilities capabilities =
columnInspector.getColumnCapabilities(fieldName);
+ return capabilities != null && capabilities.isNumeric();
Review Comment:
i know i advised differently offline earlier, but i now think this can still
return true, since the value selector creation is moved inside of the check in
factorizeVector. looking closer at factorize and factorizeBuffer those will
sort of end up using a 'nil' selector because the non-vectorize column value
selector on these numeric aggs will call `getDouble` or `getLong` on the value
selectors which will be null/zero for string inputs.
##########
processing/src/main/java/org/apache/druid/query/aggregation/last/StringLastAggregatorFactory.java:
##########
@@ -149,7 +150,8 @@ public BufferAggregator
factorizeBuffered(ColumnSelectorFactory metricFactory)
@Override
public boolean canVectorize(ColumnInspector columnInspector)
{
- return true;
+ final ColumnCapabilities capabilities =
columnInspector.getColumnCapabilities(fieldName);
+ return capabilities != null &&
capabilities.getType().equals(ValueType.STRING);
Review Comment:
this one probably is necessary to keep though, the string vector aggregator
calls `DimensionHandlerUtils.convertObjectToString` which can handle any type
of value, however it is using a `VectorObjectSelector` which isn't guaranteed
to be implemented for numbers, which typically need to use
`VectorValueSelector`.
--
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]