Source:
public DistinctCountThetaSketchAggregationFunction(List<ExpressionContext> arguments) throws SqlParseException { int numArguments = arguments.size(); Preconditions.checkArgument(numArguments > 3, "DistinctCountThetaSketch expects at least four arguments (theta-sketch column, parameter(s), post-aggregation expression), got: ", numArguments); _thetaSketchColumn = arguments.get(0); Preconditions.checkArgument(_thetaSketchColumn.getType() == ExpressionContext.Type.IDENTIFIER, "First argument of DistinctCountThetaSketch must be identifier (theta-sketch column)"); ExpressionContext paramsExpression = arguments.get(1); Preconditions.checkArgument(paramsExpression.getType() == ExpressionContext.Type.LITERAL, "Second argument of DistinctCountThetaSketch must be literal (parameters)"); _thetaSketchParams = ThetaSketchParams.fromString(paramsExpression.getLiteral()); _setOperationBuilder = getSetOperationBuilder(); _predicateInfoList = new ArrayList<>(); _inputExpressions = new ArrayList<>(); _inputExpressions.add(_thetaSketchColumn); ExpressionContext postAggregationExpression = arguments.get(numArguments - 1); Preconditions.checkArgument(paramsExpression.getType() == ExpressionContext.Type.LITERAL, "Last argument of DistinctCountThetaSketch must be literal (post-aggregation expression)"); _postAggregationExpression = QueryContextConverterUtils .getExpression(CalciteSqlParser.compileToExpression(postAggregationExpression.getLiteral())); _predicateInfoMap = new HashMap<>(); for (int i = 2; i < numArguments - 1; i++) { ExpressionContext predicateExpression = arguments.get(i); Preconditions.checkArgument(predicateExpression.getType() == ExpressionContext.Type.LITERAL, "Third to second last argument of DistinctCountThetaSketch must be literal (predicate expression)"); Predicate predicate = getPredicate(predicateExpression.getLiteral()); _inputExpressions.add(predicate.getLhs()); _predicateInfoList.add(predicate); _predicateInfoMap.put(predicate, new PredicateInfo(predicate)); } validatePostAggregationExpression(_postAggregationExpression, _predicateInfoList.size()); }

Target:
public DistinctCountThetaSketchAggregationFunction(List<ExpressionContext> arguments) throws SqlParseException { int numArguments = arguments.size(); Preconditions.checkArgument(numArguments > 3, "DistinctCountThetaSketch expects at least four arguments (theta-sketch column, parameter(s), post-aggregation expression), got: ", numArguments); _thetaSketchColumn = arguments.get(0); Preconditions.checkArgument(_thetaSketchColumn.getType() == ExpressionContext.Type.IDENTIFIER, "First argument of DistinctCountThetaSketch must be identifier (theta-sketch column)"); ExpressionContext paramsExpression = arguments.get(1); Preconditions.checkArgument(paramsExpression.getType() == ExpressionContext.Type.LITERAL, "Second argument of DistinctCountThetaSketch must be literal (parameters)"); _thetaSketchParams = ThetaSketchParams.fromString(paramsExpression.getLiteral()); _setOperationBuilder = getSetOperationBuilder(); _predicates = new ArrayList<>(); _inputExpressions = new ArrayList<>(); _inputExpressions.add(_thetaSketchColumn); ExpressionContext postAggregationExpression = arguments.get(numArguments - 1); Preconditions.checkArgument(paramsExpression.getType() == ExpressionContext.Type.LITERAL, "Last argument of DistinctCountThetaSketch must be literal (post-aggregation expression)"); _postAggregationExpression = QueryContextConverterUtils .getExpression(CalciteSqlParser.compileToExpression(postAggregationExpression.getLiteral())); _predicateInfoMap = new HashMap<>(); for (int i = 2; i < numArguments - 1; i++) { ExpressionContext predicateExpression = arguments.get(i); Preconditions.checkArgument(predicateExpression.getType() == ExpressionContext.Type.LITERAL, "Third to second last argument of DistinctCountThetaSketch must be literal (predicate expression)"); Predicate predicate = getPredicate(predicateExpression.getLiteral()); _inputExpressions.add(predicate.getLhs()); _predicates.add(predicate); _predicateInfoMap.put(predicate, new PredicateInfo(predicate)); } validatePostAggregationExpression(_postAggregationExpression, _predicates.size()); }