weixiangsun commented on a change in pull request #7584:
URL: https://github.com/apache/pinot/pull/7584#discussion_r733913858
##########
File path:
pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/AggregationFunctionFactory.java
##########
@@ -156,6 +158,45 @@ public static AggregationFunction
getAggregationFunction(FunctionContext functio
return new AvgAggregationFunction(firstArgument);
case MODE:
return new ModeAggregationFunction(arguments);
+ case LASTWITHTIME:
+ if (arguments.size() > 1) {
+ ExpressionContext timeCol = arguments.get(1);
+ String dataType = arguments.get(2).getIdentifier();
+ DataSchema.ColumnDataType columnDataType =
DataSchema.ColumnDataType.valueOf(dataType.toUpperCase());
+ switch (columnDataType) {
+ case BOOLEAN:
+ case INT:
+ return new LastIntValueWithTimeAggregationFunction(
+ firstArgument,
+ timeCol,
+ ObjectSerDeUtils.INT_VAL_TIME_PAIR_SER_DE,
+ columnDataType == DataSchema.ColumnDataType.BOOLEAN);
+ case LONG:
+ return new LastLongValueWithTimeAggregationFunction(
+ firstArgument,
+ timeCol,
+ ObjectSerDeUtils.LONG_VAL_TIME_PAIR_SER_DE);
+ case FLOAT:
+ return new LastFloatValueWithTimeAggregationFunction(
+ firstArgument,
+ timeCol,
+ ObjectSerDeUtils.FLOAT_VAL_TIME_PAIR_SER_DE);
+ case DOUBLE:
+ return new LastDoubleValueWithTimeAggregationFunction(
+ firstArgument,
+ timeCol,
+ ObjectSerDeUtils.DOUBLE_VAL_TIME_PAIR_SER_DE);
+ case STRING:
+ return new LastStringValueWithTimeAggregationFunction(
+ firstArgument,
+ timeCol,
+ ObjectSerDeUtils.STRING_VAL_TIME_PAIR_SER_DE);
+ default:
+ throw new IllegalArgumentException("Unsupported Value Type
for LastWithTime Function:" + dataType);
+ }
+ } else {
+ throw new IllegalArgumentException("Two arguments are required
for LastWithTime Function.");
Review comment:
Done
--
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]