[
https://issues.apache.org/jira/browse/CALCITE-6593?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17884266#comment-17884266
]
Ruben Q L commented on CALCITE-6593:
------------------------------------
Thanks for reporting this [~rrueda].
I have incremented the priority to "blocker", because IMO 1.38 should not be
released with this bug in one of its new features.
I think I managed to reproduced the issue by modifying the sql query on
{{LargeGeneratedJoinTest}} to use the following LEFT join that generates nulls
on the right:
{code:java}
String sql = "SELECT * \n"
+ "FROM ROOT.T0 a \n"
+ "LEFT JOIN ROOT.T1 b \n"
+ "ON a.F_0 = UPPER(b.F_0)";
{code}
> NPE when joining tables with many fields and one table is empty
> ---------------------------------------------------------------
>
> Key: CALCITE-6593
> URL: https://issues.apache.org/jira/browse/CALCITE-6593
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.38.0
> Reporter: Rodrigo Rueda
> Priority: Blocker
> Labels: pull-request-available
> Fix For: 1.38.0
>
>
> The fix for CALCITE-3094 started generating the following code for a join
> when the resulting field count is >= 100.
> {code:java}
> public Object[] apply(Object[] left, Object[] right) {
> Object[] outputArray = new Object[102];
> System.arraycopy(left, 0, outputArray, 0, 94);
> System.arraycopy(right, 0, outputArray, 94, 8);
> return outputArray;
> } {code}
> But left or right might be null if one of the sides of the join is empty,
> which leads to a NPE:
> {code:java}
> java.lang.NullPointerException
> at java.base/java.lang.System.arraycopy(Native Method)
> at Baz$3.apply(Unknown Source)
> at Baz$3.apply(Unknown Source)
> at Baz$3.apply(Unknown Source)
> at
> org.apache.calcite.linq4j.EnumerableDefaults$12$1.current(EnumerableDefaults.java:2078)
> at Baz$4$1.current(Unknown Source) {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)