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

Julian Hyde updated CALCITE-4321:
---------------------------------
    Description: 
I tried out the PIVOT feature added in CALCITE-3752 and found what I think is a 
bug where the JDBC adapter will not generate `FILTER (WHERE ...)` expressions 
from relational expressions.

Initially, I noticed that the SQL that was generated when trying out the pivot 
featue was missing the filter-where, but even when included directly in the 
Calcite SQL it's not in the SQL issued by the JDBC adapter.

For example if I try to execute the following with Calcite:
{code}
select sum(amount) filter (where some_date_column = '2020-10-01') from 
my_table{code}
The SQL issued by the adapter will be:
{code}
select sum(amount) from my_table
{code}
I have a small change here with a test case and a fix: 
https://github.com/apache/calcite/pull/2204

  was:
Hi there. I tried out the pivot feature added in 
https://issues.apache.org/jira/browse/CALCITE-3752 and found what I think is a 
bug where the JDBC adapter will not generate `FILTER (WHERE ...)` expressions 
from relational expressions.

Initially, I noticed that the SQL that was generated when trying out the pivot 
featue was missing the filter-where, but even when included directly in the 
Calcite SQL it's not in the SQL issued by the JDBC adapter.

For example if I try to execute the following with Calcite:
{code:java}
select sum(amount) filter (where some_date_column = '2020-10-01') from 
my_table{code}
The SQL issued by the adapter will be:
{code:java}
select sum(amount) from my_table
{code}
I have a small change here with a test case and a fix: 
https://github.com/apache/calcite/pull/2204


> Filter Where Expressions Missing From JDBC SQL
> ----------------------------------------------
>
>                 Key: CALCITE-4321
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4321
>             Project: Calcite
>          Issue Type: Bug
>         Environment: MacOS 10.15, Java 11, PostgreSQL 12
>            Reporter: Jeremiah Rhoads Hall
>            Assignee: Julian Hyde
>            Priority: Major
>
> I tried out the PIVOT feature added in CALCITE-3752 and found what I think is 
> a bug where the JDBC adapter will not generate `FILTER (WHERE ...)` 
> expressions from relational expressions.
> Initially, I noticed that the SQL that was generated when trying out the 
> pivot featue was missing the filter-where, but even when included directly in 
> the Calcite SQL it's not in the SQL issued by the JDBC adapter.
> For example if I try to execute the following with Calcite:
> {code}
> select sum(amount) filter (where some_date_column = '2020-10-01') from 
> my_table{code}
> The SQL issued by the adapter will be:
> {code}
> select sum(amount) from my_table
> {code}
> I have a small change here with a test case and a fix: 
> https://github.com/apache/calcite/pull/2204



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

Reply via email to