FrankChen021 commented on a change in pull request #10949:
URL: https://github.com/apache/druid/pull/10949#discussion_r614516071
##########
File path:
processing/src/main/java/org/apache/druid/query/aggregation/first/NumericFirstAggregator.java
##########
@@ -49,16 +55,44 @@ public NumericFirstAggregator(BaseLongColumnValueSelector
timeSelector, TSelecto
/**
* Store the current primitive typed 'first' value
*/
- abstract void setCurrentValue();
+ abstract void setCurrentValue(ColumnValueSelector valueSelector);
+
+ abstract void setCurrentValue(Number number);
@Override
public void aggregate()
{
+ if (needsFoldCheck) {
+
+ // Need to read this first (before time), just in case it's a
SerializablePairLongString (we don't know; it's
+ // detected at query time).
+ final Object object = valueSelector.getObject();
+
+ if (object instanceof SerializablePair) {
+
+ // cast to Pair<Long, Number> to support reindex from type such as
doubleFirst into longFirst
+ final SerializablePair<Long, Number> pair = (SerializablePair<Long,
Number>) object;
+ if (pair.lhs < firstTime) {
+ firstTime = pair.lhs;
+
+ // rhs might be NULL under SQL-compatibility mode
Review comment:
Good question, I will check it later.
--
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]