[
https://issues.apache.org/jira/browse/CALCITE-1502?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Serhii Harnyk updated CALCITE-1502:
-----------------------------------
Description:
AssertionError when we use case with optional value and literal, using
ReduceExpressionsRule:
{noformat}
SELECT CASE WHEN 1=2 THEN cast((values(1)) as integer) ELSE 2 end from
(values(1))
{noformat}
Stack trace:
{noformat}
java.lang.AssertionError: Internal error: Cannot add expression of different
type to set:
set type is RecordType(INTEGER EXPR$0) NOT NULL
expression type is RecordType(INTEGER NOT NULL EXPR$0) NOT NULL
set is rel#14:LogicalProject(input=HepRelVertex#13,EXPR$0=CASE(=(1, 2),
CAST($1):INTEGER, 2))
expression is LogicalProject#16
{noformat}
was:
AssertionError when we use case with optional value and literal, using
ReduceExpressionsRule:
{noformat}
SELECT CASE WHEN 1=2 THEN cast((values(1)) as integer) ELSE 2 end from
(values(1))
{noformat}
Stack trace:
{noformat}
java.lang.AssertionError: Internal error: Cannot add expression of different
type to set:
set type is RecordType(INTEGER STATE_NM) NOT NULL
expression type is RecordType(INTEGER NOT NULL STATE_NM) NOT NULL
set is rel#14:LogicalProject(input=HepRelVertex#13,STATE_NM=CASE(=(1, 2),
CAST($1):INTEGER, 2))
expression is LogicalProject#16
{noformat}
> AssertionError when case statement is used with optional value and literal,
> using ReduceExpressionsRule
> -------------------------------------------------------------------------------------------------------
>
> Key: CALCITE-1502
> URL: https://issues.apache.org/jira/browse/CALCITE-1502
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.10.0
> Reporter: Serhii Harnyk
> Assignee: Julian Hyde
> Fix For: 1.11.0
>
>
> AssertionError when we use case with optional value and literal, using
> ReduceExpressionsRule:
> {noformat}
> SELECT CASE WHEN 1=2 THEN cast((values(1)) as integer) ELSE 2 end from
> (values(1))
> {noformat}
> Stack trace:
> {noformat}
> java.lang.AssertionError: Internal error: Cannot add expression of different
> type to set:
> set type is RecordType(INTEGER EXPR$0) NOT NULL
> expression type is RecordType(INTEGER NOT NULL EXPR$0) NOT NULL
> set is rel#14:LogicalProject(input=HepRelVertex#13,EXPR$0=CASE(=(1, 2),
> CAST($1):INTEGER, 2))
> expression is LogicalProject#16
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)