[ 
https://issues.apache.org/jira/browse/CALCITE-4497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17353372#comment-17353372
 ] 

Stamatis Zampetakis commented on CALCITE-4497:
----------------------------------------------

Hi [~julianhyde], I see that this issue is in progress and it is marked for 
1.27.0. Do you think you can get it in in the following days or we should 
postpone it for the next release?

BTW, I like the new improved API.

> In RelBuilder, support windowed aggregate functions (OVER)
> ----------------------------------------------------------
>
>                 Key: CALCITE-4497
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4497
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Julian Hyde
>            Assignee: Julian Hyde
>            Priority: Major
>             Fix For: 1.27.0
>
>
> In {{RelBuilder}}, support windowed aggregate functions (OVER). Currently, 
> you have to write code like this (from 
> [testAggregatedWindowFunction|https://github.com/apache/calcite/blob/f1da65504e598928cf77aa6a7244552692ae2529/core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterTest.java#L830]):
> {code}
> 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"))
> {code}
> but potentially you could write this:
> {code}
> b.scan("EMP")
>         .project(b.field("SAL"))
>         .project(
>             b.aggregateCall(SqlStdOperatorTable.RANK)
>                 .over()
>                 .rowsUnbounded()
>                 .sort(b.field("SAL))
>                 .as("rank"))
> {code}
> {{class RelBuilder}} would need a new inner {{interface OverCall}}, and 
> {{class RelBuilder.AggCall}} would need a new method {{OverCall over()}}.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to