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

Kevin Risden commented on CALCITE-2767:
---------------------------------------

Created CALCITE-2910 and will mark this JIRA as resolved for 1.19.0 to close 
down the 1.19.0 release.

> Invalid operands for Case operator in RexSqlStandardConvertletTable
> -------------------------------------------------------------------
>
>                 Key: CALCITE-2767
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2767
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.18.0
>            Reporter: Benoit Hanotte
>            Priority: Minor
>             Fix For: 1.19.0
>
>
> `SqlCaseOperator.createCall()` requires 4 operands [1]:
>  # first value (i.e. CASE value WHEN...)
>  # when condifitions (as SqlNodeList)
>  # then values (as SqlNodeLists)
>  # else value
> `RexSqlStandardConvertletTable` always only pass 3 arguments [2] as it uses 
> the generic form such as
> {code:java}
>  CASE WHEN condition1 THEN val2 ... ELSE val3 END{code}
> and never the form
> {code:java}
> CASE val WHEN condition1 THEN val2 ELSE val3{code}
> When calling `SqlCaseOperator.createCall()`, it needs to pass a null sql node 
> for the first value in order to correctly provide the 4 expected arguments 
> and not only the last 3.
> [1] 
> [https://github.com/apache/calcite/blob/59b76701d9c805f51b0929577ca604fdbfe00b0b/core/src/main/java/org/apache/calcite/sql/fun/SqlCaseOperator.java#L288]
> [2] 
> [https://github.com/apache/calcite/blob/59b76701d9c805f51b0929577ca604fdbfe00b0b/core/src/main/java/org/apache/calcite/rex/RexSqlStandardConvertletTable.java#L239]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to