You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Muhammad Gelbana (JIRA)" <ji...@apache.org> on 2019/06/14 16:55:00 UTC

[jira] [Commented] (CALCITE-3128) Joining two tables producing only NULLs will return 0 rows

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

Muhammad Gelbana commented on CALCITE-3128:
-------------------------------------------

My analysis so far is that {{leftKeys}} and {{rightKeys}} for EnumerableHashJoin (Recently named EnumerableJoin) are blank, which illudes {{PhysTypeImpl.generateAccessor(List<Integer>)}} to return an expression of an empty list.

{{leftKeys}} and {{rightKeys}} are blank because while constructing a Join node, {{JoinInfo.of(RelNode, RelNode, RexNode)}} uses {{RelOptUtil.splitJoinCondition(RelNode, RelNode, RexNode, List<Integer>, List<Integer>, List<Boolean>)}} to fill up {{leftKeys}} and {{rightKeys}} but it doesn't because the condition is always true (i.e cartesian product).

I'm still not sure where or how to fix this.

> Joining two tables producing only NULLs will return 0 rows
> ----------------------------------------------------------
>
>                 Key: CALCITE-3128
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3128
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.20.0
>            Reporter: Muhammad Gelbana
>            Priority: Major
>
> The following queries will return 0 rows while they're expected to ruturn rows with NULLs in them.
> {code:sql}
> SELECT *
> FROM (SELECT NULLIF(5, 5)) a, (SELECT NULLIF(5, 5)) b
> {code}
> {code:sql}
> SELECT *
> FROM (VALUES (NULLIF(5, 5)), (NULLIF(5, 5))) a, (VALUES (NULLIF(5, 5)), (NULLIF(5, 5))) b
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)