Skip to content

Commit

Permalink
Add experimental support for first/last for double/float/long #10702 (#…
Browse files Browse the repository at this point in the history
…14462)

Add experimental support for doubleLast, doubleFirst, FloatLast, FloatFirst, longLast and longFirst.
  • Loading branch information
ankit0811 committed Dec 12, 2023
1 parent 85af2c8 commit 8735d02
Show file tree
Hide file tree
Showing 111 changed files with 6,718 additions and 1,308 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,36 @@
"type":"stringLast",
"name":"latest_user",
"fieldName":"last_user"
},
{
"type": "doubleFirst",
"name": "double_first_delta",
"fieldName": "double_first_delta"
},
{
"type": "doubleLast",
"name": "double_last_delta",
"fieldName": "double_last_delta"
},
{
"type": "longFirst",
"name": "long_first_delta",
"fieldName": "long_first_delta"
},
{
"type": "longFirst",
"name": "long_last_delta",
"fieldName": "long_last_delta"
},
{
"type": "floatFirst",
"name": "float_first_delta",
"fieldName": "float_first_delta"
},
{
"type": "floatLast",
"name": "float_last_delta",
"fieldName": "float_last_delta"
}
]
},
Expand All @@ -35,7 +65,13 @@
"event" : {
"continent":"Asia",
"earliest_user":"masterYi",
"latest_user":"stringer"
"latest_user":"stringer",
"double_first_delta": 111.0,
"double_last_delta": -9.0,
"long_first_delta": 111,
"long_last_delta": -9,
"float_first_delta": 111.0,
"float_last_delta": -9.0
}
} ]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,36 @@
"type": "stringLast",
"name": "last_user",
"fieldName": "user"
},
{
"type": "doubleFirst",
"name": "double_first_delta",
"fieldName": "delta"
},
{
"type": "doubleLast",
"name": "double_last_delta",
"fieldName": "delta"
},
{
"type": "longFirst",
"name": "long_first_delta",
"fieldName": "delta"
},
{
"type": "longLast",
"name": "long_last_delta",
"fieldName": "delta"
},
{
"type": "floatFirst",
"name": "float_first_delta",
"fieldName": "delta"
},
{
"type": "floatLast",
"name": "float_last_delta",
"fieldName": "delta"
}
],
"granularitySpec": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,36 @@
"type": "stringLast",
"name": "last_user",
"fieldName": "last_user"
},
{
"type": "doubleFirst",
"name": "double_first_delta",
"fieldName": "double_first_delta"
},
{
"type": "doubleLast",
"name": "double_last_delta",
"fieldName": "double_last_delta"
},
{
"type": "longFirst",
"name": "long_first_delta",
"fieldName": "long_first_delta"
},
{
"type": "longLast",
"name": "long_last_delta",
"fieldName": "long_last_delta"
},
{
"type": "floatFirst",
"name": "float_first_delta",
"fieldName": "float_first_delta"
},
{
"type": "floatLast",
"name": "float_last_delta",
"fieldName": "float_last_delta"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,36 @@
"type": "stringLast",
"name": "last_user",
"fieldName": "last_user"
},
{
"type": "doubleFirst",
"name": "double_first_delta",
"fieldName": "double_first_delta"
},
{
"type": "doubleLast",
"name": "double_last_delta",
"fieldName": "double_last_delta"
},
{
"type": "longFirst",
"name": "long_first_delta",
"fieldName": "long_first_delta"
},
{
"type": "longLast",
"name": "long_last_delta",
"fieldName": "long_last_delta"
},
{
"type": "floatFirst",
"name": "float_first_delta",
"fieldName": "float_first_delta"
},
{
"type": "floatLast",
"name": "float_last_delta",
"fieldName": "float_last_delta"
}
],
"granularitySpec": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,36 @@
"type":"stringLast",
"name":"latest_user",
"fieldName":"last_user"
},
{
"type": "doubleFirst",
"name": "double_first_delta",
"fieldName": "double_first_delta"
},
{
"type": "doubleLast",
"name": "double_last_delta",
"fieldName": "double_last_delta"
},
{
"type": "longFirst",
"name": "long_first_delta",
"fieldName": "long_first_delta"
},
{
"type": "longFirst",
"name": "long_last_delta",
"fieldName": "long_last_delta"
},
{
"type": "floatFirst",
"name": "float_first_delta",
"fieldName": "float_first_delta"
},
{
"type": "floatLast",
"name": "float_last_delta",
"fieldName": "float_last_delta"
}
]
},
Expand All @@ -35,7 +65,13 @@
"event" : {
"continent":"Asia",
"earliest_user":"masterYi",
"latest_user":"stringer"
"latest_user":"stringer",
"double_first_delta": 111.0,
"double_last_delta": -9.0,
"long_first_delta": 111,
"long_last_delta": -9,
"float_first_delta": 111.0,
"float_last_delta": -9.0
}
} ]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,36 @@
"type": "stringLast",
"name": "last_user",
"fieldName": "user"
},
{
"type": "doubleFirst",
"name": "double_first_delta",
"fieldName": "delta"
},
{
"type": "doubleLast",
"name": "double_last_delta",
"fieldName": "delta"
},
{
"type": "longFirst",
"name": "long_first_delta",
"fieldName": "delta"
},
{
"type": "longLast",
"name": "long_last_delta",
"fieldName": "delta"
},
{
"type": "floatFirst",
"name": "float_first_delta",
"fieldName": "delta"
},
{
"type": "floatLast",
"name": "float_last_delta",
"fieldName": "delta"
}
],
"granularitySpec": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,36 @@
"type": "stringLast",
"name": "last_user",
"fieldName": "last_user"
},
{
"type": "doubleFirst",
"name": "double_first_delta",
"fieldName": "double_first_delta"
},
{
"type": "doubleLast",
"name": "double_last_delta",
"fieldName": "double_last_delta"
},
{
"type": "longFirst",
"name": "long_first_delta",
"fieldName": "long_first_delta"
},
{
"type": "longLast",
"name": "long_last_delta",
"fieldName": "long_last_delta"
},
{
"type": "floatFirst",
"name": "float_first_delta",
"fieldName": "float_first_delta"
},
{
"type": "floatLast",
"name": "float_last_delta",
"fieldName": "float_last_delta"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,36 @@
"type": "stringLast",
"name": "last_user",
"fieldName": "last_user"
},
{
"type": "doubleFirst",
"name": "double_first_delta",
"fieldName": "double_first_delta"
},
{
"type": "doubleLast",
"name": "double_last_delta",
"fieldName": "double_last_delta"
},
{
"type": "longFirst",
"name": "long_first_delta",
"fieldName": "long_first_delta"
},
{
"type": "longLast",
"name": "long_last_delta",
"fieldName": "long_last_delta"
},
{
"type": "floatFirst",
"name": "float_first_delta",
"fieldName": "float_first_delta"
},
{
"type": "floatLast",
"name": "float_last_delta",
"fieldName": "float_last_delta"
}
],
"granularitySpec": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
import org.apache.druid.query.aggregation.LongMinAggregatorFactory;
import org.apache.druid.query.aggregation.LongSumAggregatorFactory;
import org.apache.druid.query.aggregation.PostAggregator;
import org.apache.druid.query.aggregation.SerializablePairLongDoubleComplexMetricSerde;
import org.apache.druid.query.aggregation.SerializablePairLongFloatComplexMetricSerde;
import org.apache.druid.query.aggregation.SerializablePairLongLongComplexMetricSerde;
import org.apache.druid.query.aggregation.SerializablePairLongStringComplexMetricSerde;
import org.apache.druid.query.aggregation.any.DoubleAnyAggregatorFactory;
import org.apache.druid.query.aggregation.any.FloatAnyAggregatorFactory;
Expand Down Expand Up @@ -83,6 +86,10 @@ public AggregatorsModule()
ComplexMetrics.registerSerde(PreComputedHyperUniquesSerde.TYPE_NAME, new PreComputedHyperUniquesSerde());
ComplexMetrics.registerSerde(SerializablePairLongStringComplexMetricSerde.TYPE_NAME, new SerializablePairLongStringComplexMetricSerde());

ComplexMetrics.registerSerde(SerializablePairLongFloatComplexMetricSerde.TYPE_NAME, new SerializablePairLongFloatComplexMetricSerde());
ComplexMetrics.registerSerde(SerializablePairLongDoubleComplexMetricSerde.TYPE_NAME, new SerializablePairLongDoubleComplexMetricSerde());
ComplexMetrics.registerSerde(SerializablePairLongLongComplexMetricSerde.TYPE_NAME, new SerializablePairLongLongComplexMetricSerde());

setMixInAnnotation(AggregatorFactory.class, AggregatorFactoryMixin.class);
setMixInAnnotation(PostAggregator.class, PostAggregatorMixin.class);

Expand Down

0 comments on commit 8735d02

Please sign in to comment.