Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
In RelBuilder, support windowed aggregate functions (OVER). Currently, you have to write code like this (from testAggregatedWindowFunction):
b.scan("EMP") .project(b.field("SAL")) .project( b.alias( b.getRexBuilder().makeOver( b.getTypeFactory().createSqlType(SqlTypeName.INTEGER), SqlStdOperatorTable.RANK, ImmutableList.of(), ImmutableList.of(), ImmutableList.of( new RexFieldCollation(b.field("SAL"), ImmutableSet.of())), RexWindowBounds.UNBOUNDED_PRECEDING, RexWindowBounds.UNBOUNDED_FOLLOWING, true, true, false, false, false), "rank"))
but potentially you could write this:
b.scan("EMP") .project(b.field("SAL")) .project( b.aggregateCall(SqlStdOperatorTable.RANK) .over() .rowsUnbounded() .sort(b.field("SAL)) .as("rank"))
class RelBuilder would need a new inner interface OverCall, and class RelBuilder.AggCall would need a new method OverCall over().
Attachments
Issue Links
- relates to
-
CALCITE-5348 When translating ORDER BY in OVER, use the session's default null collation (e.g. NULLS LAST)
- Closed