Thomas Rebele created CALCITE-4848:
--------------------------------------

             Summary: Adding a HAVING condition to a query with a dynamic 
parameter makes the result 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
         Attachments: CALCITE-4848.patch

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