Fix for schema mismatch to go down using the non vectorize path till we update the vectorized aggs properly#14924
Conversation
…we update the vectorized aggs properly
| final ColumnCapabilities capabilities = columnInspector.getColumnCapabilities(fieldName); | ||
| return capabilities != null && capabilities.isNumeric(); |
There was a problem hiding this 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.
There was a problem hiding this comment.
I did the same initially, but the get of NumericNilVectorAggregator would only return a null and not a 0 as the non-vectorized parts do. One solution would be to update the NumercNilVectorAggregator to return a serializablePair with the rhs as 0 on case of a null, but I am unsure if that will break anything else. I'll try to go down that path too
| final ColumnCapabilities capabilities = columnInspector.getColumnCapabilities(fieldName); | ||
| return capabilities != null && capabilities.isNumeric(); |
There was a problem hiding this comment.
same comment about returning true
| final ColumnCapabilities capabilities = columnInspector.getColumnCapabilities(fieldName); | ||
| return capabilities != null && capabilities.isNumeric(); |
There was a problem hiding this comment.
same comment about returning true
| final ColumnCapabilities capabilities = columnInspector.getColumnCapabilities(fieldName); | ||
| return capabilities != null && capabilities.getType().equals(ValueType.STRING); |
There was a problem hiding this 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.
|
Added the casting from valueSelector to ObjectSelector for non-string columns when used with stringLast/First in vectorized mode. Currently this fails on coverage only, adding tests soon |
…ast on non string columns
| @Nullable | ||
| private final Object returnValue; | ||
|
|
||
| public static NumericNilVectorAggregator of(Object returnValue) |
There was a problem hiding this comment.
side note: I wonder if we should rename NumericNilVectorAggregator if we are going to be using it for non-numbers, maybe just NilVectorAggregator. I guess this doesn't need to be done in this PR, but it does seem kind of funny exposing it for other purposes
| return new DoubleFirstVectorAggregator(timeSelector, valueSelector); | ||
| } | ||
| return NumericNilVectorAggregator.doubleNilVectorAggregator(); | ||
| return NumericNilVectorAggregator.of(new SerializablePair<>(0L, NullHandling.defaultDoubleValue())); |
There was a problem hiding this comment.
this could be saved as a static variable instead of making a new one each time since its not going to change over the lifetime of the service, same for all the other impls
…ing static variables now
|
Addressed the review comments |
…we update the vectorized aggs properly
If in
vectorized:forcemode on a column which has segment which is a String column likeWe run queries with numeric aggregation on that string column such as
the queries fail with an error
This is because vectorized aggs need these cast supports. Till that is done, this PR fixes the issue by going down the non-vectorized route