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

Yu Xu commented on CALCITE-7595:
--------------------------------

The key issue should be:

1. The SQL FILTER condition is converted to `filterExpr(RexNode)` 

2. This is passed to `HistogramShuttle` 

3. `HistogramShuttle` calls `aggregateCall().filter(filterExpr)` 

4.  But `filter` is not converted to `filterArg` (column index).

This issue has initially addressed the syntax support, but completely resolving 
the aforementioned problems is still quite complex. I will follow up on it, and 
please feel free to offer any suggestions.

> Support FILTER clause with window functions
> -------------------------------------------
>
>                 Key: CALCITE-7595
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7595
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 1.42.0
>            Reporter: Yu Xu
>            Assignee: Yu Xu
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.43.0
>
>
> Currently Calcite not support FILTER OVER syntax,but PostgreSQL support 
> it:[https://www.postgresql.org/docs/current/sql-expressions.html]
> SQL
> {code:java}
> SELECT COUNT(*) FILTER (WHERE x > 5) OVER (PARTITION BY deptno) FROM t; {code}
> error
> {code:java}
> -- ERROR: SqlValidatorException: OVER must be applied to aggregate function 
> {code}
> Maybe we can improve the filter over support.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to