[
https://issues.apache.org/jira/browse/CALCITE-6521?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17872473#comment-17872473
]
Julian Hyde commented on CALCITE-6521:
--------------------------------------
I'm frustrated that you don't provide the most important details. It is
possible to write a really good summary.
* You are calling UNNEST with two arguments. That is unusual. That is the key
factor in this case.
* "Does not meet expectations". So, state your expectations!
This is the behavior I observe:
* In Postgres, UNNEST(list of 2, list of 3) returns 3 elements (because MAX(2,
3) = 3).
* In Calcite, UNNEST(list of 2, list of 3) currently returns 6 elements
(because 2 * 3 = 6).
This seems to have nothing to do with CROSSJOIN. The problems exist whenever
UNNEST has multiple arguments.
Did you search for related bugs?
I acknowledge that Calcite has the wrong behavior. But I am really frustrated
that I had to do all the work to make this into a decent bug report.
> CROSS JOIN UNNEST The results do not match expectations.
> --------------------------------------------------------
>
> Key: CALCITE-6521
> URL: https://issues.apache.org/jira/browse/CALCITE-6521
> Project: Calcite
> Issue Type: Bug
> Reporter: EveyWu
> Priority: Minor
> Attachments: image-2024-08-08-22-03-13-643.png
>
>
> {code:java}
> SELECT n, a
> FROM (
> VALUES
> (ARRAY[2, 5], ARRAY['dog', 'cat', 'bird']),
> (ARRAY[7, 8, 9], ARRAY['cow', 'pig'])
> ) AS x (numbers, animals)
> CROSS JOIN UNNEST(numbers, animals) AS t (n, a);
> {code}
> Postgres result:
> |2|dog |
> |5|cat |
> |null|bird|
> |7|cow |
> |8|pig |
> |9|null |
>
> Calcite result:
> |2|dog |
> |2|cat |
> |2|bird|
> |5|dog |
> |5|cat |
> |5|bird|
> |7|cow |
> |7|pig |
> |8|cow |
> |8|pig |
> |9|cow |
> |9|pig |
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)