You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Ruben Q L (Jira)" <ji...@apache.org> on 2020/03/06 09:12:00 UTC

[jira] [Commented] (CALCITE-3828) MergeJoin throws NPE in case of null keys

    [ https://issues.apache.org/jira/browse/CALCITE-3828?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17053188#comment-17053188 ] 

Ruben Q L commented on CALCITE-3828:
------------------------------------

Fixed via https://github.com/apache/calcite/commit/bfde14be1284efc6d4560868fef3724238c35dc3

> MergeJoin throws NPE in case of null keys
> -----------------------------------------
>
>                 Key: CALCITE-3828
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3828
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.21.0
>            Reporter: Ruben Q L
>            Assignee: Ruben Q L
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.23.0
>
>          Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> Problem can be reproduced with the following test (to be added to EnumerablesTest.java):
> {code}
> @Test public void testMergeJoinWithNullKeys() {
>   assertThat(
>   EnumerableDefaults.mergeJoin(
>     Linq4j.asEnumerable(
>       Arrays.asList(
>         new Emp(30, "Fred"),
>         new Emp(20, "Sebastian"),
>         new Emp(30, "Theodore"),
>         new Emp(20, "Theodore"),
>         new Emp(40, null),
>         new Emp(30, null))),
>     Linq4j.asEnumerable(
>       Arrays.asList(
>         new Dept(15, "Marketing"),
>         new Dept(20, "Sales"),
>         new Dept(30, "Theodore"),
>         new Dept(40, null))),
>     e -> e.name,
>     d -> d.name,
>     (v0, v1) -> v0 + ", " + v1, false, false).toList().toString(),
>   equalTo("[Emp(30, Theodore), Dept(30, Theodore),"
>     + " Emp(20, Theodore), Dept(30, Theodore)]"));
> }
> {code}
> which throws a NPE inside EnumerableDefaults#MergeJoinEnumerator when trying to compare null keys:
> {code}
> java.lang.NullPointerException
> 	at java.lang.String.compareTo(String.java:1155)
> 	at java.lang.String.compareTo(String.java:111)
> 	at org.apache.calcite.linq4j.EnumerableDefaults$MergeJoinEnumerator.advance(EnumerableDefaults.java:3861)
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)