Package org.apache.calcite.rel.core
Class AggregateCall
- java.lang.Object
-
- org.apache.calcite.rel.core.AggregateCall
-
public class AggregateCall extends java.lang.Object
Call to an aggregate function within anAggregate
.
-
-
Field Summary
Fields Modifier and Type Field Description private SqlAggFunction
aggFunction
private boolean
approximate
private com.google.common.collect.ImmutableList<java.lang.Integer>
argList
RelCollation
collation
private boolean
distinct
int
filterArg
java.lang.String
name
RelDataType
type
-
Constructor Summary
Constructors Modifier Constructor Description private
AggregateCall(SqlAggFunction aggFunction, boolean distinct, boolean approximate, java.util.List<java.lang.Integer> argList, int filterArg, RelCollation collation, RelDataType type, java.lang.String name)
Creates an AggregateCall.AggregateCall(SqlAggFunction aggFunction, boolean distinct, java.util.List<java.lang.Integer> argList, RelDataType type, java.lang.String name)
Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description AggregateCall
adaptTo(RelNode input, java.util.List<java.lang.Integer> argList, int filterArg, int oldGroupKeyCount, int newGroupKeyCount)
Creates equivalent AggregateCall that is adapted to a new input types and/or number of columns in GROUP BY.AggregateCall
copy(java.util.List<java.lang.Integer> args)
Deprecated.AggregateCall
copy(java.util.List<java.lang.Integer> args, int filterArg)
Deprecated.AggregateCall
copy(java.util.List<java.lang.Integer> args, int filterArg, RelCollation collation)
Creates an equivalent AggregateCall with new argument ordinals.static AggregateCall
create(SqlAggFunction aggFunction, boolean distinct, boolean approximate, java.util.List<java.lang.Integer> argList, int filterArg, int groupCount, RelNode input, RelDataType type, java.lang.String name)
Deprecated.static AggregateCall
create(SqlAggFunction aggFunction, boolean distinct, boolean approximate, java.util.List<java.lang.Integer> argList, int filterArg, RelCollation collation, int groupCount, RelNode input, RelDataType type, java.lang.String name)
Creates an AggregateCall, inferring its type iftype
is null.static AggregateCall
create(SqlAggFunction aggFunction, boolean distinct, boolean approximate, java.util.List<java.lang.Integer> argList, int filterArg, RelCollation collation, RelDataType type, java.lang.String name)
Creates an AggregateCall.static AggregateCall
create(SqlAggFunction aggFunction, boolean distinct, boolean approximate, java.util.List<java.lang.Integer> argList, int filterArg, RelDataType type, java.lang.String name)
Deprecated.static AggregateCall
create(SqlAggFunction aggFunction, boolean distinct, java.util.List<java.lang.Integer> argList, int filterArg, int groupCount, RelNode input, RelDataType type, java.lang.String name)
Deprecated.static AggregateCall
create(SqlAggFunction aggFunction, boolean distinct, java.util.List<java.lang.Integer> argList, int groupCount, RelNode input, RelDataType type, java.lang.String name)
Deprecated.static AggregateCall
create(SqlAggFunction aggFunction, boolean distinct, java.util.List<java.lang.Integer> argList, int filterArg, RelDataType type, java.lang.String name)
Deprecated.Aggregate.AggCallBinding
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
equals(java.lang.Object o)
SqlAggFunction
getAggregation()
Returns the aggregate function.java.util.List<java.lang.Integer>
getArgList()
Returns the ordinals of the arguments to this call.RelCollation
getCollation()
Returns the aggregate ordering definition (theWITHIN GROUP
clause in SQL), or the empty list if not specified.java.lang.String
getName()
Returns the name.RelDataType
getType()
Returns the result type.boolean
hasFilter()
Returns true if and only if this AggregateCall has a filter argumentint
hashCode()
boolean
isApproximate()
Returns whether this AggregateCall is approximate, as inAPPROX_COUNT_DISTINCT(empno)
.boolean
isDistinct()
Returns whether this AggregateCall is distinct, as inCOUNT(DISTINCT empno)
.AggregateCall
rename(java.lang.String name)
Creates an equivalent AggregateCall that has a new name.java.lang.String
toString()
AggregateCall
transform(Mappings.TargetMapping mapping)
Creates a copy of this aggregate call, applying a mapping to its arguments.
-
-
-
Field Detail
-
aggFunction
private final SqlAggFunction aggFunction
-
distinct
private final boolean distinct
-
approximate
private final boolean approximate
-
type
public final RelDataType type
-
name
public final java.lang.String name
-
argList
private final com.google.common.collect.ImmutableList<java.lang.Integer> argList
-
filterArg
public final int filterArg
-
collation
public final RelCollation collation
-
-
Constructor Detail
-
AggregateCall
@Deprecated public AggregateCall(SqlAggFunction aggFunction, boolean distinct, java.util.List<java.lang.Integer> argList, RelDataType type, java.lang.String name)
Deprecated.Creates an AggregateCall.- Parameters:
aggFunction
- Aggregate functiondistinct
- Whether distinctargList
- List of ordinals of argumentstype
- Result typename
- Name (may be null)
-
AggregateCall
private AggregateCall(SqlAggFunction aggFunction, boolean distinct, boolean approximate, java.util.List<java.lang.Integer> argList, int filterArg, RelCollation collation, RelDataType type, java.lang.String name)
Creates an AggregateCall.- Parameters:
aggFunction
- Aggregate functiondistinct
- Whether distinctapproximate
- Whether approximateargList
- List of ordinals of argumentsfilterArg
- Ordinal of filter argument (theFILTER (WHERE ...)
clause in SQL), or -1collation
- How to sort values before aggregation (theWITHIN GROUP
clause in SQL)type
- Result typename
- Name (may be null)
-
-
Method Detail
-
create
@Deprecated public static AggregateCall create(SqlAggFunction aggFunction, boolean distinct, java.util.List<java.lang.Integer> argList, int groupCount, RelNode input, RelDataType type, java.lang.String name)
Deprecated.
-
create
@Deprecated public static AggregateCall create(SqlAggFunction aggFunction, boolean distinct, java.util.List<java.lang.Integer> argList, int filterArg, int groupCount, RelNode input, RelDataType type, java.lang.String name)
Deprecated.
-
create
@Deprecated public static AggregateCall create(SqlAggFunction aggFunction, boolean distinct, boolean approximate, java.util.List<java.lang.Integer> argList, int filterArg, int groupCount, RelNode input, RelDataType type, java.lang.String name)
Deprecated.
-
create
public static AggregateCall create(SqlAggFunction aggFunction, boolean distinct, boolean approximate, java.util.List<java.lang.Integer> argList, int filterArg, RelCollation collation, int groupCount, RelNode input, RelDataType type, java.lang.String name)
Creates an AggregateCall, inferring its type iftype
is null.
-
create
@Deprecated public static AggregateCall create(SqlAggFunction aggFunction, boolean distinct, java.util.List<java.lang.Integer> argList, int filterArg, RelDataType type, java.lang.String name)
Deprecated.
-
create
@Deprecated public static AggregateCall create(SqlAggFunction aggFunction, boolean distinct, boolean approximate, java.util.List<java.lang.Integer> argList, int filterArg, RelDataType type, java.lang.String name)
Deprecated.
-
create
public static AggregateCall create(SqlAggFunction aggFunction, boolean distinct, boolean approximate, java.util.List<java.lang.Integer> argList, int filterArg, RelCollation collation, RelDataType type, java.lang.String name)
Creates an AggregateCall.
-
isDistinct
public final boolean isDistinct()
Returns whether this AggregateCall is distinct, as inCOUNT(DISTINCT empno)
.- Returns:
- whether distinct
-
isApproximate
public final boolean isApproximate()
Returns whether this AggregateCall is approximate, as inAPPROX_COUNT_DISTINCT(empno)
.- Returns:
- whether approximate
-
getAggregation
public final SqlAggFunction getAggregation()
Returns the aggregate function.- Returns:
- aggregate function
-
getCollation
public RelCollation getCollation()
Returns the aggregate ordering definition (theWITHIN GROUP
clause in SQL), or the empty list if not specified.- Returns:
- ordering definition
-
getArgList
public final java.util.List<java.lang.Integer> getArgList()
Returns the ordinals of the arguments to this call.The list is immutable.
- Returns:
- list of argument ordinals
-
getType
public final RelDataType getType()
Returns the result type.- Returns:
- result type
-
getName
public java.lang.String getName()
Returns the name.- Returns:
- name
-
rename
public AggregateCall rename(java.lang.String name)
Creates an equivalent AggregateCall that has a new name.- Parameters:
name
- New name (may be null)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
hasFilter
public boolean hasFilter()
Returns true if and only if this AggregateCall has a filter argument
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
createBinding
public Aggregate.AggCallBinding createBinding(Aggregate aggregateRelBase)
Creates a binding of this call in the context of anLogicalAggregate
, which can then be used to infer the return type.
-
copy
public AggregateCall copy(java.util.List<java.lang.Integer> args, int filterArg, RelCollation collation)
Creates an equivalent AggregateCall with new argument ordinals.- Parameters:
args
- Arguments- Returns:
- AggregateCall that suits new inputs and GROUP BY columns
- See Also:
transform(Mappings.TargetMapping)
-
copy
@Deprecated public AggregateCall copy(java.util.List<java.lang.Integer> args, int filterArg)
Deprecated.
-
copy
@Deprecated public AggregateCall copy(java.util.List<java.lang.Integer> args)
Deprecated.
-
adaptTo
public AggregateCall adaptTo(RelNode input, java.util.List<java.lang.Integer> argList, int filterArg, int oldGroupKeyCount, int newGroupKeyCount)
Creates equivalent AggregateCall that is adapted to a new input types and/or number of columns in GROUP BY.- Parameters:
input
- relation that will be used as a child 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
public AggregateCall transform(Mappings.TargetMapping mapping)
Creates a copy of this aggregate call, applying a mapping to its arguments.
-
-