xiangfu0 commented on code in PR #13231: URL: https://github.com/apache/pinot/pull/13231#discussion_r1623897488
########## pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/funnel/window/FunnelBaseAggregationFunction.java: ########## @@ -32,33 +32,34 @@ import org.apache.pinot.core.query.aggregation.AggregationResultHolder; import org.apache.pinot.core.query.aggregation.ObjectAggregationResultHolder; import org.apache.pinot.core.query.aggregation.function.AggregationFunction; +import org.apache.pinot.core.query.aggregation.function.funnel.FunnelStepEvent; import org.apache.pinot.core.query.aggregation.groupby.GroupByResultHolder; import org.apache.pinot.core.query.aggregation.groupby.ObjectGroupByResultHolder; -import org.apache.pinot.segment.spi.AggregationFunctionType; -public class FunnelMaxStepAggregationFunction implements AggregationFunction<PriorityQueue<FunnelStepEvent>, Long> { - private final ExpressionContext _timestampExpression; - private final long _windowSize; - private final List<ExpressionContext> _stepExpressions; - private final FunnelModes _modes = new FunnelModes(); - private final int _numSteps; +public abstract class FunnelBaseAggregationFunction<F extends Comparable> + implements AggregationFunction<PriorityQueue<FunnelStepEvent>, F> { + protected final ExpressionContext _timestampExpression; + protected final long _windowSize; + protected final List<ExpressionContext> _stepExpressions; + protected final FunnelModes _modes = new FunnelModes(); + protected final int _numSteps; - public FunnelMaxStepAggregationFunction(List<ExpressionContext> arguments) { + public FunnelBaseAggregationFunction(List<ExpressionContext> arguments) { int numArguments = arguments.size(); Preconditions.checkArgument(numArguments > 2, - "FUNNELMAXSTEP expects >= 3 arguments, got: %s. The function can be used as " + "FUNNEL_BASE_FUNC expects >= 3 arguments, got: %s. The function can be used as " + "funnelMaxStep(timestampExpression, windowSize, ARRAY[stepExpression, ..], [mode, [mode, ... ]])", numArguments); _timestampExpression = arguments.get(0); _windowSize = arguments.get(1).getLiteral().getLongValue(); Preconditions.checkArgument(_windowSize > 0, "Window size must be > 0"); ExpressionContext stepExpressionContext = arguments.get(2); if (stepExpressionContext.getFunction() != null) { - // LEAF stage init this function like funnelmaxstep($1,'1000',arrayValueConstructor($2,$3,$4,...)) + // LEAF stage init this function like funnelBaseFunc($1,'1000',arrayValueConstructor($2,$3,$4,...)) _stepExpressions = stepExpressionContext.getFunction().getArguments(); } else { - // Intermediate Stage init this function like funnelmaxstep($1,'1000',__PLACEHOLDER__) + // Intermediate Stage init this function like funnelBaseFunc($1,'1000',__PLACEHOLDER__) Review Comment: added test for this -- 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: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org