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

Julian Hyde commented on CALCITE-4754:
--------------------------------------

I encourage you to open a PR with several distinct commits (or refactor the 
current PR).

I know that you just want to solve your problem.

But we maintainers of Calcite want changes that are logically independent and 
make sense. If they are too focused on your problem (and I think you will 
agree, whether IS TRUE works inside a CASE statement on Redshift is very very 
focused) then maintainers will be scratching their heads for years.

All development on Calcite is done by volunteers (or people solving particular 
problems of interest to their employer). Committers rightly refuse to accept 
contributions until they are crafted into something that can be maintained. 
Please read my above comments in that light.

> Invalid Redshift SQL when executing a PIVOT query
> -------------------------------------------------
>
>                 Key: CALCITE-4754
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4754
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.27.0
>            Reporter: Javier Rivas Rodriguez
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.28.0
>
>
> Given a Calcite connection to Redshift
> When running a query like the one below
> {code:java}
> SELECT * 
> FROM 
>   (SELECT field1, field2, field3 
>    FROM my_table) 
> PIVOT SUM(field1) FOR field2 IN (val1, val2){code}
> The SQL produced is something like
> {code:java}
> SELECT 
>   field3, 
>   SUM(field1) FILTER (WHERE field2 = val1), 
>   SUM(field1) FILTER (WHERE field2 = val2)
> FROM my_table
> GROUP BY field3{code}
> This SQL transformation is not accepted by Redshift
> The expected result would be something like
> {code:java}
> SELECT 
>  field3, 
>  SUM(CASE WHEN field2 = val1 THEN field1 ELSE NULL END), 
>  SUM(CASE WHEN field2 = val2 THEN field1 ELSE NULL END)
> FROM my_table
> GROUP BY field3
> {code}



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

Reply via email to