You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (JIRA)" <ji...@apache.org> on 2019/01/04 17:12:00 UTC
[jira] [Reopened] (CALCITE-2767) Invalid operands for Case operator
in RexSqlStandardConvertletTable
[ https://issues.apache.org/jira/browse/CALCITE-2767?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Julian Hyde reopened CALCITE-2767:
----------------------------------
Re-opening, to remind us that this is not "done". Even though we have a fix, we don't know the full scope of the problem.
> 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
> Assignee: Julian Hyde
> 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)