Package org.apache.calcite.rel.core
Class AggregateCall
java.lang.Object
org.apache.calcite.rel.core.AggregateCall
Call to an aggregate function within an
Aggregate
.-
Field Summary
Modifier and TypeFieldDescriptionfinal RelCollation
final @Nullable ImmutableBitSet
final int
final @Nullable String
final RelDataType
-
Constructor Summary
ConstructorDescriptionAggregateCall
(SqlAggFunction aggFunction, boolean distinct, List<Integer> argList, RelDataType type, String name) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionadaptTo
(RelNode input, List<Integer> argList, int filterArg, int oldGroupKeyCount, int newGroupKeyCount) Creates an equivalent AggregateCall that is adapted to a new input types and/or number of columns in GROUP BY.Deprecated.Deprecated.copy
(List<Integer> argList, int filterArg, RelCollation collation) Deprecated.copy
(List<Integer> argList, int filterArg, @Nullable ImmutableBitSet distinctKeys, RelCollation collation) Deprecated.static AggregateCall
create
(SqlParserPos pos, SqlAggFunction aggFunction, boolean distinct, boolean approximate, boolean ignoreNulls, List<RexNode> rexList, List<Integer> argList, int filterArg, @Nullable ImmutableBitSet distinctKeys, RelCollation collation, int groupCount, RelNode input, @Nullable RelDataType type, @Nullable String name) static AggregateCall
create
(SqlParserPos pos, SqlAggFunction aggFunction, boolean distinct, boolean approximate, boolean ignoreNulls, List<RexNode> rexList, List<Integer> argList, int filterArg, @Nullable ImmutableBitSet distinctKeys, RelCollation collation, RelDataType type, @Nullable String name) static AggregateCall
create
(SqlAggFunction aggFunction, boolean distinct, boolean approximate, boolean ignoreNulls, List<Integer> argList, int filterArg, RelCollation collation, RelDataType type, @Nullable String name) Deprecated.static AggregateCall
create
(SqlAggFunction aggFunction, boolean distinct, boolean approximate, boolean ignoreNulls, List<Integer> argList, int filterArg, @Nullable ImmutableBitSet distinctKeys, RelCollation collation, int groupCount, RelNode input, @Nullable RelDataType type, @Nullable String name) Deprecated.static AggregateCall
create
(SqlAggFunction aggFunction, boolean distinct, boolean approximate, boolean ignoreNulls, List<RexNode> rexList, List<Integer> argList, int filterArg, @Nullable ImmutableBitSet distinctKeys, RelCollation collation, int groupCount, RelNode input, @Nullable RelDataType type, @Nullable String name) Creates an AggregateCall, inferring its type iftype
is null.static AggregateCall
create
(SqlAggFunction aggFunction, boolean distinct, boolean approximate, boolean ignoreNulls, List<RexNode> rexList, List<Integer> argList, int filterArg, @Nullable ImmutableBitSet distinctKeys, RelCollation collation, RelDataType type, @Nullable String name) Creates an AggregateCall.static AggregateCall
create
(SqlAggFunction aggFunction, boolean distinct, boolean approximate, List<Integer> argList, int filterArg, int groupCount, RelNode input, @Nullable RelDataType type, @Nullable String name) Deprecated.static AggregateCall
create
(SqlAggFunction aggFunction, boolean distinct, boolean approximate, List<Integer> argList, int filterArg, RelCollation collation, int groupCount, RelNode input, @Nullable RelDataType type, @Nullable String name) Deprecated.static AggregateCall
create
(SqlAggFunction aggFunction, boolean distinct, boolean approximate, List<Integer> argList, int filterArg, RelCollation collation, RelDataType type, @Nullable String name) Deprecated.static AggregateCall
create
(SqlAggFunction aggFunction, boolean distinct, boolean approximate, List<Integer> argList, int filterArg, RelDataType type, @Nullable String name) Deprecated.static AggregateCall
create
(SqlAggFunction aggFunction, boolean distinct, List<Integer> argList, int filterArg, int groupCount, RelNode input, @Nullable RelDataType type, @Nullable String name) Deprecated.static AggregateCall
create
(SqlAggFunction aggFunction, boolean distinct, List<Integer> argList, int groupCount, RelNode input, @Nullable RelDataType type, @Nullable String name) Deprecated.static AggregateCall
create
(SqlAggFunction aggFunction, boolean distinct, List<Integer> argList, int filterArg, RelDataType type, @Nullable String name) Deprecated.createBinding
(Aggregate aggregateRelBase) Creates a binding of this call in the context of anLogicalAggregate
, which can then be used to infer the return type.boolean
final SqlAggFunction
Returns the aggregate function.Returns the ordinals of the arguments to this call.Returns the aggregate ordering definition (theWITHIN GROUP
clause in SQL), or the empty list if not specified.@Nullable String
getName()
Returns the name.final RelDataType
getType()
Returns the result type.boolean
Returns true if this AggregateCall has a non-empty collation.boolean
Returns whether this AggregateCall has a filter argument.int
hashCode()
final boolean
Returns whether this AggregateCall ignores nulls.final boolean
Returns whether this AggregateCall is approximate, as inAPPROX_COUNT_DISTINCT(empno)
.final boolean
Returns whether this AggregateCall is distinct, as inCOUNT(DISTINCT empno)
.Deprecated.toString()
transform
(Mappings.TargetMapping mapping) Creates a copy of this aggregate call, applying a mapping to its arguments.withApproximate
(boolean approximate) WithsisApproximate()
.withArgList
(List<Integer> argList) WithsgetArgList()
.withCollation
(RelCollation collation) WithsgetCollation()
.withDistinct
(boolean distinct) WithsisDistinct()
.withDistinctKeys
(@Nullable ImmutableBitSet distinctKeys) WithsdistinctKeys
.withFilter
(int filterArg) WithsfilterArg
.withIgnoreNulls
(boolean ignoreNulls) WithsignoreNulls()
.Withsname
.
-
Field Details
-
type
-
name
-
rexList
-
filterArg
public final int filterArg -
distinctKeys
-
collation
-
-
Constructor Details
-
AggregateCall
@Deprecated public AggregateCall(SqlAggFunction aggFunction, boolean distinct, List<Integer> argList, RelDataType type, String name) Deprecated.Creates an AggregateCall.- Parameters:
aggFunction
- Aggregate functiondistinct
- Whether distinctargList
- List of ordinals of argumentstype
- Result typename
- Name (may be null)
-
-
Method Details
-
create
@Deprecated public static AggregateCall create(SqlAggFunction aggFunction, boolean distinct, List<Integer> argList, int groupCount, RelNode input, @Nullable RelDataType type, @Nullable String name) Deprecated. -
create
@Deprecated public static AggregateCall create(SqlAggFunction aggFunction, boolean distinct, List<Integer> argList, int filterArg, int groupCount, RelNode input, @Nullable RelDataType type, @Nullable String name) Deprecated. -
create
@Deprecated public static AggregateCall create(SqlAggFunction aggFunction, boolean distinct, boolean approximate, List<Integer> argList, int filterArg, int groupCount, RelNode input, @Nullable RelDataType type, @Nullable String name) Deprecated. -
create
@Deprecated public static AggregateCall create(SqlAggFunction aggFunction, boolean distinct, boolean approximate, List<Integer> argList, int filterArg, RelCollation collation, int groupCount, RelNode input, @Nullable RelDataType type, @Nullable String name) Deprecated. -
create
@Deprecated public static AggregateCall create(SqlAggFunction aggFunction, boolean distinct, boolean approximate, boolean ignoreNulls, List<Integer> argList, int filterArg, @Nullable ImmutableBitSet distinctKeys, RelCollation collation, int groupCount, RelNode input, @Nullable RelDataType type, @Nullable String name) Deprecated. -
create
public static AggregateCall create(SqlAggFunction aggFunction, boolean distinct, boolean approximate, boolean ignoreNulls, List<RexNode> rexList, List<Integer> argList, int filterArg, @Nullable ImmutableBitSet distinctKeys, RelCollation collation, int groupCount, RelNode input, @Nullable RelDataType type, @Nullable String name) Creates an AggregateCall, inferring its type iftype
is null. -
create
public static AggregateCall create(SqlParserPos pos, SqlAggFunction aggFunction, boolean distinct, boolean approximate, boolean ignoreNulls, List<RexNode> rexList, List<Integer> argList, int filterArg, @Nullable ImmutableBitSet distinctKeys, RelCollation collation, int groupCount, RelNode input, @Nullable RelDataType type, @Nullable String name) -
create
@Deprecated public static AggregateCall create(SqlAggFunction aggFunction, boolean distinct, List<Integer> argList, int filterArg, RelDataType type, @Nullable String name) Deprecated. -
create
@Deprecated public static AggregateCall create(SqlAggFunction aggFunction, boolean distinct, boolean approximate, List<Integer> argList, int filterArg, RelDataType type, @Nullable String name) Deprecated. -
create
@Deprecated public static AggregateCall create(SqlAggFunction aggFunction, boolean distinct, boolean approximate, List<Integer> argList, int filterArg, RelCollation collation, RelDataType type, @Nullable String name) Deprecated. -
create
@Deprecated public static AggregateCall create(SqlAggFunction aggFunction, boolean distinct, boolean approximate, boolean ignoreNulls, List<Integer> argList, int filterArg, RelCollation collation, RelDataType type, @Nullable String name) Deprecated. -
create
public static AggregateCall create(SqlAggFunction aggFunction, boolean distinct, boolean approximate, boolean ignoreNulls, List<RexNode> rexList, List<Integer> argList, int filterArg, @Nullable ImmutableBitSet distinctKeys, RelCollation collation, RelDataType type, @Nullable String name) Creates an AggregateCall. -
create
public static AggregateCall create(SqlParserPos pos, SqlAggFunction aggFunction, boolean distinct, boolean approximate, boolean ignoreNulls, List<RexNode> rexList, List<Integer> argList, int filterArg, @Nullable ImmutableBitSet distinctKeys, RelCollation collation, RelDataType type, @Nullable String name) -
isDistinct
public final boolean isDistinct()Returns whether this AggregateCall is distinct, as inCOUNT(DISTINCT empno)
.- Returns:
- whether distinct
-
withDistinct
WithsisDistinct()
. -
isApproximate
public final boolean isApproximate()Returns whether this AggregateCall is approximate, as inAPPROX_COUNT_DISTINCT(empno)
.- Returns:
- whether approximate
-
withApproximate
WithsisApproximate()
. -
ignoreNulls
public final boolean ignoreNulls()Returns whether this AggregateCall ignores nulls.- Returns:
- whether ignore nulls
-
withIgnoreNulls
WithsignoreNulls()
. -
getAggregation
Returns the aggregate function.- Returns:
- aggregate function
-
getCollation
Returns the aggregate ordering definition (theWITHIN GROUP
clause in SQL), or the empty list if not specified.- Returns:
- ordering definition
-
withCollation
WithsgetCollation()
. -
getArgList
Returns the ordinals of the arguments to this call.The list is immutable.
- Returns:
- list of argument ordinals
-
withArgList
WithsgetArgList()
. -
withDistinctKeys
WithsdistinctKeys
. -
getType
Returns the result type.- Returns:
- result type
-
getName
Returns the name.- Returns:
- name
-
withName
Withsname
. -
rename
Deprecated. -
toString
-
hasFilter
public boolean hasFilter()Returns whether this AggregateCall has a filter argument. -
hasCollation
public boolean hasCollation()Returns true if this AggregateCall has a non-empty collation. Returns false otherwise. -
withFilter
WithsfilterArg
. -
getParserPosition
-
equals
-
hashCode
public int hashCode() -
createBinding
Creates a binding of this call in the context of anLogicalAggregate
, which can then be used to infer the return type. -
copy
@Deprecated public AggregateCall copy(List<Integer> argList, int filterArg, @Nullable ImmutableBitSet distinctKeys, RelCollation collation) Deprecated.Creates an equivalent AggregateCall with new argument ordinals.- Parameters:
argList
- Arguments- Returns:
- AggregateCall that suits new inputs and GROUP BY columns
- See Also:
-
copy
Deprecated. -
copy
Deprecated. -
copy
Deprecated. -
adaptTo
public AggregateCall adaptTo(RelNode input, List<Integer> argList, int filterArg, int oldGroupKeyCount, int newGroupKeyCount) Creates an equivalent AggregateCall that is adapted to a new input types and/or number of columns in GROUP BY.- Parameters:
input
- Relation that will be input of AggregateargList
- Argument indices of the new call in the inputfilterArg
- Index of the filter, or -1oldGroupKeyCount
- number of columns in GROUP BY of old aggregatenewGroupKeyCount
- number of columns in GROUP BY of new aggregate- Returns:
- AggregateCall that suits new inputs and GROUP BY columns
-
transform
Creates a copy of this aggregate call, applying a mapping to its arguments.
-