/** Creates a call to an aggregate function. */ public AggCall aggregateCall(SqlAggFunction aggFunction, boolean distinct, RexNode filter, String alias, Iterable<? extends RexNode> operands) { if (filter != null) { if (filter.getType().getSqlTypeName() != SqlTypeName.BOOLEAN) { throw Static.RESOURCE.filterMustBeBoolean().ex(); } if (filter.getType().isNullable()) { filter = call(SqlStdOperatorTable.IS_TRUE, filter); } } return new AggCallImpl(aggFunction, distinct, filter, alias, ImmutableList.copyOf(operands)); }
/** Creates a call to an aggregate function. */ public AggCall aggregateCall(SqlAggFunction aggFunction, boolean distinct, RexNode filter, String alias, Iterable<? extends RexNode> operands) { if (filter != null) { if (filter.getType().getSqlTypeName() != SqlTypeName.BOOLEAN) { throw Static.RESOURCE.filterMustBeBoolean().ex(); } if (filter.getType().isNullable()) { filter = call(SqlStdOperatorTable.IS_TRUE, filter); } } return new AggCallImpl(aggFunction, distinct, filter, alias, ImmutableList.copyOf(operands)); }
AggCallImpl(SqlAggFunction aggFunction, boolean distinct, boolean approximate, RexNode filter, String alias, ImmutableList<RexNode> operands, ImmutableList<RexNode> orderKeys) { this.aggFunction = Objects.requireNonNull(aggFunction); this.distinct = distinct; this.approximate = approximate; 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; }
/** Creates a call to an aggregate function. */ public AggCall aggregateCall(SqlAggFunction aggFunction, boolean distinct, boolean approximate, RexNode filter, String alias, Iterable<? extends RexNode> operands) { if (filter != null) { if (filter.getType().getSqlTypeName() != SqlTypeName.BOOLEAN) { throw RESOURCE.filterMustBeBoolean().ex(); } if (filter.getType().isNullable()) { filter = call(SqlStdOperatorTable.IS_TRUE, filter); } } return new AggCallImpl(aggFunction, distinct, approximate, filter, alias, ImmutableList.copyOf(operands)); }