siddharthteotia commented on code in PR #11556:
URL: https://github.com/apache/pinot/pull/11556#discussion_r1323359088
##########
pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/BooleanOrAggregationFunction.java:
##########
@@ -19,18 +19,21 @@
package org.apache.pinot.core.query.aggregation.function;
+import com.google.common.base.Preconditions;
+import java.util.List;
import org.apache.pinot.common.request.context.ExpressionContext;
import org.apache.pinot.segment.spi.AggregationFunctionType;
public class BooleanOrAggregationFunction extends
BaseBooleanAggregationFunction {
- public BooleanOrAggregationFunction(ExpressionContext expression) {
- this(expression, false);
+ public BooleanOrAggregationFunction(List<ExpressionContext> arguments,
boolean nullHandlingEnabled) {
+ super(verifyArguments(arguments), nullHandlingEnabled, BooleanMerge.OR);
}
- protected BooleanOrAggregationFunction(ExpressionContext expression, boolean
nullHandlingEnabled) {
- super(expression, nullHandlingEnabled, BooleanMerge.OR);
+ private static ExpressionContext verifyArguments(List<ExpressionContext>
arguments) {
+ Preconditions.checkArgument(arguments.size() == 1, "BOOL_OR expects 1
argument, got: %s", arguments.size());
+ return arguments.get(0);
Review Comment:
(nit) this piece of code can potentially be abstracted out where each
concrete function just passes it's name for the error message and the number of
arguments it expects.
May be put in `BaseSingleInputAggregationFunction` ?
--
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]