[ 
https://issues.apache.org/jira/browse/CALCITE-4848?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ruben Q L resolved CALCITE-4848.
--------------------------------
    Resolution: Fixed

Fixed via 
https://github.com/apache/calcite/commit/23e1b1fcae6614fb9b6600951251ba622b379b30
Thanks [~thomas.rebele] for the PR!

> Adding a HAVING condition to a query with a dynamic parameter makes the 
> result always empty
> -------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-4848
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4848
>             Project: Calcite
>          Issue Type: Bug
>    Affects Versions: 1.27.0
>            Reporter: Thomas Rebele
>            Assignee: Thomas Rebele
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.28.0
>
>         Attachments: CALCITE-4848.patch
>
>          Time Spent: 1h 40m
>  Remaining Estimate: 0h
>
> The query
> {code:java}
> SELECT sal, COUNT(1) AS count_val
> FROM emp t WHERE sal = ?
> GROUP BY sal HAVING sal < 1000 {code}
> gets translated to the following logical plan:
> {code:java}
> LogicalFilter(condition=[<($0, 1000)])
>   LogicalAggregate(group=[{0}], COUNT_VAL=[COUNT()])
>     LogicalProject(SAL=[$5], $f1=[1])
>       LogicalFilter(condition=[=($5, ?0)])
>         LogicalTableScan(table=[[CATALOG, SALES, EMP]]) {code}
> However, applying CoreRules.FILTER_REDUCE_EXPRESSIONS to the plan it just 
> becomes
> {code:java}
> LogicalValues(tuples=[[]]) {code}
>  



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

Reply via email to