[
https://issues.apache.org/jira/browse/CALCITE-4680?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18040349#comment-18040349
]
Thomas Rebele commented on CALCITE-4680:
----------------------------------------
I should have pushed to include the test case in my PR, because it is broken
with the latest main. Cause seems to be commit
da6a2042f01c4bfa64253a040149a263d4923b43, CALCITE-1466:
{code:java}
IllegalStateException: Unable to implement EnumerableCalc(expr#0..5=[{inputs}],
expr#6=[0], expr#7=[=($t2, $t6)], expr#8=[IS NOT NULL($t5)], expr#9=[<($t3,
$t2)], expr#10=[OR($t8, $t9)], expr#11=[IS NOT TRUE($t10)], expr#12=[OR($t7,
$t11)], FIELD1=[$t0], $condition=[$t12]): rowcount = 1.0, cumulative cost =
{33.75 rows, 91.0 cpu, 0.0 io}, id = 87192
> EnumerableCorrelate(correlation=[$cor0], joinType=[left],
requiredColumns=[{0, 1}]): rowcount = 2.0, cumulative cost = {32.75 rows, 61.0
cpu, 0.0 io}, id = 87172
> EnumerableCorrelate(correlation=[$cor0], joinType=[left],
requiredColumns=[{1}]): rowcount = 2.0, cumulative cost = {18.5 rows, 33.0 cpu,
0.0 io}, id = 87161
> EnumerableUnion(all=[true]): rowcount = 2.0, cumulative cost = {6.0
rows, 21.0 cpu, 0.0 io}, id = 87152
> EnumerableCalc(expr#0=[{inputs}], expr#1=[1], expr#2=[0],
expr#3=[ROW($t2)], expr#4=[null:INTEGER], expr#5=[ROW($t4)], expr#6=[ARRAY($t3,
$t5)], EXPR$0=[$t1], EXPR$1=[$t6]): rowcount = 1.0, cumulative cost = {2.0
rows, 10.0 cpu, 0.0 io}, id = 87184
> EnumerableValues(tuples=[[{ 0 }]]): rowcount = 1.0, cumulative
(stack truncated) {code}
> AssertionError: contains $cor1, while converting SQL query containing UNNEST
> to logical plan using subquery expansion
> ---------------------------------------------------------------------------------------------------------------------
>
> Key: CALCITE-4680
> URL: https://issues.apache.org/jira/browse/CALCITE-4680
> Project: Calcite
> Issue Type: Bug
> Affects Versions: 1.27.0
> Reporter: Thomas Rebele
> Priority: Minor
> Labels: pull-request-available
> Attachments: Calcite4680.java
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> The exception happens with the following SQL query
> {code:java}
> SELECT field1 FROM tab t1
> WHERE t1.field1 NOT IN (
> SELECT l.subfield
> FROM tab t2, UNNEST(t2.field2) AS l
> WHERE t1.field1 = t2.field1)
> {code}
> and the schema
> {code:java}
> RecordType(VARCHAR NOT NULL field1, RecordType(VARCHAR subfield) ARRAY field2)
> {code}
> (where field2.subfield is nullable). Previous versions of Calcite threw a
> ClassCastException: LogicalCorrelate cannot be cast to Join.
> However, it passes after removing the WHERE clause of the subquery.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)