Java Code Examples for org.apache.calcite.util.Optionality

The following examples show how to use org.apache.calcite.util.Optionality. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: Bats   Source File: SqlMinMaxAggFunction.java    License: Apache License 2.0 6 votes vote down vote up
/** Creates a SqlMinMaxAggFunction. */
public SqlMinMaxAggFunction(SqlKind kind) {
  super(kind.name(),
      null,
      kind,
      ReturnTypes.ARG0_NULLABLE_IF_EMPTY,
      null,
      OperandTypes.COMPARABLE_ORDERED,
      SqlFunctionCategory.SYSTEM,
      false,
      false,
      Optionality.FORBIDDEN);
  this.argTypes = ImmutableList.of();
  this.minMaxKind = MINMAX_COMPARABLE;
  Preconditions.checkArgument(kind == SqlKind.MIN
      || kind == SqlKind.MAX);
}
 
Example 2
Source Project: Bats   Source File: SqlAggFunction.java    License: Apache License 2.0 6 votes vote down vote up
/** Creates a built-in or user-defined SqlAggFunction or window function.
 *
 * <p>A user-defined function will have a value for {@code sqlIdentifier}; for
 * a built-in function it will be null. */
protected SqlAggFunction(
    String name,
    SqlIdentifier sqlIdentifier,
    SqlKind kind,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker,
    SqlFunctionCategory funcType,
    boolean requiresOrder,
    boolean requiresOver,
    Optionality requiresGroupOrder) {
  super(name, sqlIdentifier, kind, returnTypeInference, operandTypeInference,
      operandTypeChecker, null, funcType);
  this.requiresOrder = requiresOrder;
  this.requiresOver = requiresOver;
  this.requiresGroupOrder = Objects.requireNonNull(requiresGroupOrder);
}
 
Example 3
Source Project: calcite   Source File: AggregateCall.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Creates an AggregateCall.
 *
 * @param aggFunction Aggregate function
 * @param distinct    Whether distinct
 * @param approximate Whether approximate
 * @param argList     List of ordinals of arguments
 * @param filterArg   Ordinal of filter argument (the
 *                    {@code FILTER (WHERE ...)} clause in SQL), or -1
 * @param collation   How to sort values before aggregation (the
 *                    {@code WITHIN GROUP} clause in SQL)
 * @param type        Result type
 * @param name        Name (may be null)
 */
private AggregateCall(SqlAggFunction aggFunction, boolean distinct,
    boolean approximate, boolean ignoreNulls, List<Integer> argList,
    int filterArg, RelCollation collation, RelDataType type, String name) {
  this.type = Objects.requireNonNull(type);
  this.name = name;
  this.aggFunction = Objects.requireNonNull(aggFunction);
  this.argList = ImmutableList.copyOf(argList);
  this.filterArg = filterArg;
  this.collation = Objects.requireNonNull(collation);
  this.distinct = distinct;
  this.approximate = approximate;
  this.ignoreNulls = ignoreNulls;
  Preconditions.checkArgument(
      aggFunction.getDistinctOptionality() != Optionality.IGNORED || !distinct,
      "DISTINCT has no effect for this aggregate function, so must be false");
  Preconditions.checkArgument(filterArg < 0 || aggFunction.allowsFilter());
}
 
Example 4
Source Project: calcite   Source File: SqlMinMaxAggFunction.java    License: Apache License 2.0 6 votes vote down vote up
/** Creates a SqlMinMaxAggFunction. */
public SqlMinMaxAggFunction(String funcName, SqlKind kind,
    SqlOperandTypeChecker inputTypeChecker) {
  super(funcName,
      null,
      kind,
      ReturnTypes.ARG0_NULLABLE_IF_EMPTY,
      null,
      inputTypeChecker,
      SqlFunctionCategory.SYSTEM,
      false,
      false,
      Optionality.FORBIDDEN);
  this.argTypes = ImmutableList.of();
  this.minMaxKind = MINMAX_COMPARABLE;
  Preconditions.checkArgument(kind == SqlKind.MIN
      || kind == SqlKind.MAX);
}
 
Example 5
Source Project: calcite   Source File: SqlBitOpAggFunction.java    License: Apache License 2.0 6 votes vote down vote up
/** Creates a SqlBitOpAggFunction. */
public SqlBitOpAggFunction(SqlKind kind) {
  super(kind.name(),
      null,
      kind,
      ReturnTypes.ARG0_NULLABLE_IF_EMPTY,
      null,
      OperandTypes.INTEGER,
      SqlFunctionCategory.NUMERIC,
      false,
      false,
      Optionality.FORBIDDEN);
  Preconditions.checkArgument(kind == SqlKind.BIT_AND
      || kind == SqlKind.BIT_OR
      || kind == SqlKind.BIT_XOR);
}
 
Example 6
Source Project: calcite   Source File: SqlAggFunction.java    License: Apache License 2.0 6 votes vote down vote up
/** Creates a built-in or user-defined SqlAggFunction or window function.
 *
 * <p>A user-defined function will have a value for {@code sqlIdentifier}; for
 * a built-in function it will be null. */
protected SqlAggFunction(
    String name,
    SqlIdentifier sqlIdentifier,
    SqlKind kind,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker,
    SqlFunctionCategory funcType,
    boolean requiresOrder,
    boolean requiresOver,
    Optionality requiresGroupOrder) {
  super(name, sqlIdentifier, kind, returnTypeInference, operandTypeInference,
      operandTypeChecker, null, funcType);
  this.requiresOrder = requiresOrder;
  this.requiresOver = requiresOver;
  this.requiresGroupOrder = Objects.requireNonNull(requiresGroupOrder);
}
 
Example 7
Source Project: calcite   Source File: RelBuilder.java    License: Apache License 2.0 6 votes vote down vote up
AggCallImpl(SqlAggFunction aggFunction, boolean distinct,
    boolean approximate, boolean ignoreNulls, RexNode filter,
    String alias, ImmutableList<RexNode> operands,
    ImmutableList<RexNode> orderKeys) {
  this.aggFunction = Objects.requireNonNull(aggFunction);
  // If the aggregate function ignores DISTINCT,
  // make the DISTINCT flag FALSE.
  this.distinct = distinct
      && aggFunction.getDistinctOptionality() != Optionality.IGNORED;
  this.approximate = approximate;
  this.ignoreNulls = ignoreNulls;
  this.alias = alias;
  this.operands = Objects.requireNonNull(operands);
  this.orderKeys = Objects.requireNonNull(orderKeys);
  if (filter != null) {
    if (filter.getType().getSqlTypeName() != SqlTypeName.BOOLEAN) {
      throw RESOURCE.filterMustBeBoolean().ex();
    }
    if (filter.getType().isNullable()) {
      filter = call(SqlStdOperatorTable.IS_TRUE, filter);
    }
  }
  this.filter = filter;
}
 
Example 8
Source Project: Bats   Source File: SqlUserDefinedAggFunction.java    License: Apache License 2.0 5 votes vote down vote up
/** Creates a SqlUserDefinedAggFunction. */
public SqlUserDefinedAggFunction(SqlIdentifier opName,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker, AggregateFunction function,
    boolean requiresOrder, boolean requiresOver,
    Optionality requiresGroupOrder, RelDataTypeFactory typeFactory) {
  super(Util.last(opName.names), opName, SqlKind.OTHER_FUNCTION,
      returnTypeInference, operandTypeInference, operandTypeChecker,
      SqlFunctionCategory.USER_DEFINED_FUNCTION, requiresOrder, requiresOver,
      requiresGroupOrder);
  this.function = function;
  this.typeFactory = typeFactory;
}
 
Example 9
Source Project: Bats   Source File: SqlAvgAggFunction.java    License: Apache License 2.0 5 votes vote down vote up
SqlAvgAggFunction(String name, SqlKind kind) {
  super(name,
      null,
      kind,
      ReturnTypes.AVG_AGG_FUNCTION,
      null,
      OperandTypes.NUMERIC,
      SqlFunctionCategory.NUMERIC,
      false,
      false,
      Optionality.FORBIDDEN);
  Preconditions.checkArgument(SqlKind.AVG_AGG_FUNCTIONS.contains(kind),
      "unsupported sql kind");
}
 
Example 10
Source Project: Bats   Source File: SqlLeadLagAggFunction.java    License: Apache License 2.0 5 votes vote down vote up
public SqlLeadLagAggFunction(SqlKind kind) {
  super(kind.name(),
      null,
      kind,
      RETURN_TYPE,
      null,
      OPERAND_TYPES,
      SqlFunctionCategory.NUMERIC,
      false,
      true,
      Optionality.FORBIDDEN);
  Preconditions.checkArgument(kind == SqlKind.LEAD
      || kind == SqlKind.LAG);
}
 
Example 11
Source Project: Bats   Source File: SqlCovarAggFunction.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Creates a SqlCovarAggFunction.
 */
public SqlCovarAggFunction(SqlKind kind) {
  super(kind.name(),
      null,
      kind,
      kind == SqlKind.REGR_COUNT ? ReturnTypes.BIGINT : ReturnTypes.COVAR_REGR_FUNCTION,
      null,
      OperandTypes.NUMERIC_NUMERIC,
      SqlFunctionCategory.NUMERIC,
      false,
      false,
      Optionality.FORBIDDEN);
  Preconditions.checkArgument(SqlKind.COVAR_AVG_AGG_FUNCTIONS.contains(kind),
      "unsupported sql kind: " + kind);
}
 
Example 12
Source Project: Bats   Source File: SqlFirstLastValueAggFunction.java    License: Apache License 2.0 5 votes vote down vote up
public SqlFirstLastValueAggFunction(SqlKind kind) {
  super(
      kind.name(),
      null,
      kind,
      ReturnTypes.ARG0_NULLABLE_IF_EMPTY,
      null,
      OperandTypes.ANY,
      SqlFunctionCategory.NUMERIC,
      false,
      true,
      Optionality.FORBIDDEN);
  Preconditions.checkArgument(kind == SqlKind.FIRST_VALUE
      || kind == SqlKind.LAST_VALUE);
}
 
Example 13
Source Project: Bats   Source File: SqlJsonArrayAggAggFunction.java    License: Apache License 2.0 5 votes vote down vote up
public SqlJsonArrayAggAggFunction(SqlKind kind,
    SqlJsonConstructorNullClause nullClause) {
  super(kind + "_" + nullClause.name(), null, kind, ReturnTypes.VARCHAR_2000, null,
      OperandTypes.family(SqlTypeFamily.ANY), SqlFunctionCategory.SYSTEM,
      false, false, Optionality.OPTIONAL);
  this.nullClause = Objects.requireNonNull(nullClause);
}
 
Example 14
Source Project: Bats   Source File: SqlJsonObjectAggAggFunction.java    License: Apache License 2.0 5 votes vote down vote up
/** Creates a SqlJsonObjectAggAggFunction. */
public SqlJsonObjectAggAggFunction(SqlKind kind,
    SqlJsonConstructorNullClause nullClause) {
  super(kind + "_" + nullClause.name(), null, kind, ReturnTypes.VARCHAR_2000, null,
      OperandTypes.family(SqlTypeFamily.CHARACTER, SqlTypeFamily.ANY),
      SqlFunctionCategory.SYSTEM, false, false, Optionality.FORBIDDEN);
  this.nullClause = Objects.requireNonNull(nullClause);
}
 
Example 15
Source Project: Bats   Source File: SqlNtileAggFunction.java    License: Apache License 2.0 5 votes vote down vote up
public SqlNtileAggFunction() {
  super(
      "NTILE",
      null,
      SqlKind.NTILE,
      ReturnTypes.RANK,
      null,
      OperandTypes.POSITIVE_INTEGER_LITERAL,
      SqlFunctionCategory.NUMERIC,
      false,
      true,
      Optionality.FORBIDDEN);
}
 
Example 16
Source Project: Bats   Source File: SqlBitOpAggFunction.java    License: Apache License 2.0 5 votes vote down vote up
/** Creates a SqlBitOpAggFunction. */
public SqlBitOpAggFunction(SqlKind kind) {
  super(kind.name(),
      null,
      kind,
      ReturnTypes.ARG0_NULLABLE_IF_EMPTY,
      null,
      OperandTypes.INTEGER,
      SqlFunctionCategory.NUMERIC,
      false,
      false,
      Optionality.FORBIDDEN);
  Preconditions.checkArgument(kind == SqlKind.BIT_AND
      || kind == SqlKind.BIT_OR);
}
 
Example 17
Source Project: Bats   Source File: SqlHistogramAggFunction.java    License: Apache License 2.0 5 votes vote down vote up
public SqlHistogramAggFunction(RelDataType type) {
  super(
      "$HISTOGRAM",
      null,
      SqlKind.OTHER_FUNCTION,
      ReturnTypes.HISTOGRAM,
      null,
      OperandTypes.NUMERIC_OR_STRING,
      SqlFunctionCategory.NUMERIC,
      false,
      false,
      Optionality.FORBIDDEN);
  this.type = type;
}
 
Example 18
Source Project: Bats   Source File: SqlSingleValueAggFunction.java    License: Apache License 2.0 5 votes vote down vote up
public SqlSingleValueAggFunction(
    RelDataType type) {
  super(
      "SINGLE_VALUE",
      null,
      SqlKind.SINGLE_VALUE,
      ReturnTypes.ARG0,
      null,
      OperandTypes.ANY,
      SqlFunctionCategory.SYSTEM,
      false,
      false,
      Optionality.FORBIDDEN);
  this.type = type;
}
 
Example 19
Source Project: Bats   Source File: SqlSumEmptyIsZeroAggFunction.java    License: Apache License 2.0 5 votes vote down vote up
public SqlSumEmptyIsZeroAggFunction() {
  super("$SUM0",
      null,
      SqlKind.SUM0,
      ReturnTypes.AGG_SUM_EMPTY_IS_ZERO,
      null,
      OperandTypes.NUMERIC,
      SqlFunctionCategory.NUMERIC,
      false,
      false,
      Optionality.FORBIDDEN);
}
 
Example 20
Source Project: Bats   Source File: SqlAnyValueAggFunction.java    License: Apache License 2.0 5 votes vote down vote up
/** Creates a SqlAnyValueAggFunction. */
public SqlAnyValueAggFunction(SqlKind kind) {
  super(kind.name(),
      null,
      kind,
      ReturnTypes.ARG0_NULLABLE_IF_EMPTY,
      null,
      OperandTypes.ANY,
      SqlFunctionCategory.SYSTEM,
      false,
      false,
      Optionality.FORBIDDEN);
  Preconditions.checkArgument(kind == SqlKind.ANY_VALUE);
}
 
Example 21
Source Project: Bats   Source File: SqlSumAggFunction.java    License: Apache License 2.0 5 votes vote down vote up
public SqlSumAggFunction(RelDataType type) {
  super(
      "SUM",
      null,
      SqlKind.SUM,
      ReturnTypes.AGG_SUM,
      null,
      OperandTypes.NUMERIC,
      SqlFunctionCategory.NUMERIC,
      false,
      false,
      Optionality.FORBIDDEN);
  this.type = type;
}
 
Example 22
Source Project: Bats   Source File: SqlAggFunction.java    License: Apache License 2.0 5 votes vote down vote up
/** Creates a built-in SqlAggFunction. */
@Deprecated // to be removed before 2.0
protected SqlAggFunction(
    String name,
    SqlKind kind,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker,
    SqlFunctionCategory funcType) {
  // We leave sqlIdentifier as null to indicate that this is a builtin.
  this(name, null, kind, returnTypeInference, operandTypeInference,
      operandTypeChecker, funcType, false, false,
      Optionality.FORBIDDEN);
}
 
Example 23
Source Project: Bats   Source File: SqlAggFunction.java    License: Apache License 2.0 5 votes vote down vote up
/** Creates a user-defined SqlAggFunction. */
@Deprecated // to be removed before 2.0
protected SqlAggFunction(
    String name,
    SqlIdentifier sqlIdentifier,
    SqlKind kind,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker,
    SqlFunctionCategory funcType) {
  this(name, sqlIdentifier, kind, returnTypeInference, operandTypeInference,
      operandTypeChecker, funcType, false, false,
      Optionality.FORBIDDEN);
}
 
Example 24
Source Project: Bats   Source File: SqlAggFunction.java    License: Apache License 2.0 5 votes vote down vote up
@Deprecated // to be removed before 2.0
protected SqlAggFunction(
    String name,
    SqlIdentifier sqlIdentifier,
    SqlKind kind,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker,
    SqlFunctionCategory funcType,
    boolean requiresOrder,
    boolean requiresOver) {
  this(name, sqlIdentifier, kind, returnTypeInference, operandTypeInference,
      operandTypeChecker, funcType, requiresOrder, requiresOver,
      Optionality.FORBIDDEN);
}
 
Example 25
Source Project: Bats   Source File: CalciteCatalogReader.java    License: Apache License 2.0 5 votes vote down vote up
/** Converts a function to a {@link org.apache.calcite.sql.SqlOperator}.
 *
 * <p>The {@code typeFactory} argument is technical debt; see [CALCITE-2082]
 * Remove RelDataTypeFactory argument from SqlUserDefinedAggFunction
 * constructor. */
private static SqlOperator toOp(RelDataTypeFactory typeFactory,
    SqlIdentifier name, final Function function) {
  List<RelDataType> argTypes = new ArrayList<>();
  List<SqlTypeFamily> typeFamilies = new ArrayList<>();
  for (FunctionParameter o : function.getParameters()) {
    final RelDataType type = o.getType(typeFactory);
    argTypes.add(type);
    typeFamilies.add(
        Util.first(type.getSqlTypeName().getFamily(), SqlTypeFamily.ANY));
  }
  final FamilyOperandTypeChecker typeChecker =
      OperandTypes.family(typeFamilies, i ->
          function.getParameters().get(i).isOptional());
  final List<RelDataType> paramTypes = toSql(typeFactory, argTypes);
  if (function instanceof ScalarFunction) {
    return new SqlUserDefinedFunction(name, infer((ScalarFunction) function),
        InferTypes.explicit(argTypes), typeChecker, paramTypes, function);
  } else if (function instanceof AggregateFunction) {
    return new SqlUserDefinedAggFunction(name,
        infer((AggregateFunction) function), InferTypes.explicit(argTypes),
        typeChecker, (AggregateFunction) function, false, false,
        Optionality.FORBIDDEN, typeFactory);
  } else if (function instanceof TableMacro) {
    return new SqlUserDefinedTableMacro(name, ReturnTypes.CURSOR,
        InferTypes.explicit(argTypes), typeChecker, paramTypes,
        (TableMacro) function);
  } else if (function instanceof TableFunction) {
    return new SqlUserDefinedTableFunction(name, ReturnTypes.CURSOR,
        InferTypes.explicit(argTypes), typeChecker, paramTypes,
        (TableFunction) function);
  } else {
    throw new AssertionError("unknown function type " + function);
  }
}
 
Example 26
Source Project: flink   Source File: SqlFirstLastValueAggFunction.java    License: Apache License 2.0 5 votes vote down vote up
public SqlFirstLastValueAggFunction(SqlKind kind) {
	super(
			kind.name(),
			null,
			kind,
			ReturnTypes.ARG0_NULLABLE_IF_EMPTY,
			null,
			OperandTypes.ANY,
			SqlFunctionCategory.NUMERIC,
			false,
			false,
			Optionality.FORBIDDEN);
	Preconditions.checkArgument(kind == SqlKind.FIRST_VALUE
			|| kind == SqlKind.LAST_VALUE);
}
 
Example 27
Source Project: flink   Source File: SqlFirstLastValueAggFunction.java    License: Apache License 2.0 5 votes vote down vote up
public SqlFirstLastValueAggFunction(SqlKind kind) {
	super(
			kind.name(),
			null,
			kind,
			ReturnTypes.ARG0_NULLABLE_IF_EMPTY,
			null,
			OperandTypes.ANY,
			SqlFunctionCategory.NUMERIC,
			false,
			false,
			Optionality.FORBIDDEN);
	Preconditions.checkArgument(kind == SqlKind.FIRST_VALUE
			|| kind == SqlKind.LAST_VALUE);
}
 
Example 28
private static void rewriteAggCalls(
		List<AggregateCall> newAggCalls,
		List<Integer> argList,
		Map<Integer, Integer> sourceOf) {
	// Rewrite the agg calls. Each distinct agg becomes a non-distinct call
	// to the corresponding field from the right; for example,
	// "COUNT(DISTINCT e.sal)" becomes   "COUNT(distinct_e.sal)".
	for (int i = 0; i < newAggCalls.size(); i++) {
		final AggregateCall aggCall = newAggCalls.get(i);

		// Ignore agg calls which are not distinct or have the wrong set
		// arguments. If we're rewriting aggregates whose args are {sal}, we will
		// rewrite COUNT(DISTINCT sal) and SUM(DISTINCT sal) but ignore
		// COUNT(DISTINCT gender) or SUM(sal).
		if (!aggCall.isDistinct()
			&& aggCall.getAggregation().getDistinctOptionality() != Optionality.IGNORED) {
			continue;
		}
		if (!aggCall.getArgList().equals(argList)) {
			continue;
		}

		// Re-map arguments.
		final int argCount = aggCall.getArgList().size();
		final List<Integer> newArgs = new ArrayList<>(argCount);
		for (int j = 0; j < argCount; j++) {
			final Integer arg = aggCall.getArgList().get(j);
			newArgs.add(sourceOf.get(arg));
		}
		final AggregateCall newAggCall =
				AggregateCall.create(aggCall.getAggregation(), false,
					aggCall.isApproximate(), false, newArgs, -1,
					RelCollations.EMPTY, aggCall.getType(), aggCall.getName());
		newAggCalls.set(i, newAggCall);
	}
}
 
Example 29
private static void rewriteAggCalls(
    List<AggregateCall> newAggCalls,
    List<Integer> argList,
    Map<Integer, Integer> sourceOf) {
  // Rewrite the agg calls. Each distinct agg becomes a non-distinct call
  // to the corresponding field from the right; for example,
  // "COUNT(DISTINCT e.sal)" becomes   "COUNT(distinct_e.sal)".
  for (int i = 0; i < newAggCalls.size(); i++) {
    final AggregateCall aggCall = newAggCalls.get(i);

    // Ignore agg calls which are not distinct or have the wrong set
    // arguments. If we're rewriting aggregates whose args are {sal}, we will
    // rewrite COUNT(DISTINCT sal) and SUM(DISTINCT sal) but ignore
    // COUNT(DISTINCT gender) or SUM(sal).
    if (!aggCall.isDistinct()
        && aggCall.getAggregation().getDistinctOptionality() != Optionality.IGNORED) {
      continue;
    }
    if (!aggCall.getArgList().equals(argList)) {
      continue;
    }

    // Re-map arguments.
    final int argCount = aggCall.getArgList().size();
    final List<Integer> newArgs = new ArrayList<>(argCount);
    for (int j = 0; j < argCount; j++) {
      final Integer arg = aggCall.getArgList().get(j);
      newArgs.add(sourceOf.get(arg));
    }
    final AggregateCall newAggCall =
        AggregateCall.create(aggCall.getAggregation(), false,
            aggCall.isApproximate(), aggCall.ignoreNulls(), newArgs, -1, aggCall.collation,
            aggCall.getType(), aggCall.getName());
    newAggCalls.set(i, newAggCall);
  }
}
 
Example 30
Source Project: calcite   Source File: AggregateCall.java    License: Apache License 2.0 5 votes vote down vote up
/** Creates an AggregateCall. */
public static AggregateCall create(SqlAggFunction aggFunction,
    boolean distinct, boolean approximate, boolean ignoreNulls,
    List<Integer> argList, int filterArg, RelCollation collation,
    RelDataType type, String name) {
  final boolean distinct2 = distinct
      && (aggFunction.getDistinctOptionality() != Optionality.IGNORED);
  return new AggregateCall(aggFunction, distinct2, approximate, ignoreNulls,
      argList, filterArg, collation, type, name);
}