[
https://issues.apache.org/jira/browse/CALCITE-3128?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16871116#comment-16871116
]
Feng Zhu edited comment on CALCITE-3128 at 6/24/19 12:20 PM:
-------------------------------------------------------------
[~danny0405] I ever executed the query in PG. It will produce a (NULL, NULL)
result.
{code:java}
SELECT *FROM (SELECT NULLIF(5, 5)) a, (SELECT NULLIF(5, 5)) b
{code}
I am not sure whether it is the problem with Linq4q[1]. When the current value
is _null_ in left side (i.e., outers), Linq4q directly sets
(innerEnumerable=null), resulting an emptyEnumerator.
{code:java}
Q1: result expected (1, NULL, NULL)
SELECT *FROM (SELECT 1, NULLIF(5, 5)) a, (SELECT NULLIF(5, 5)) b
Q2: 0 rows
SELECT *FROM (SELECT NULLIF(5, 5)) a, (SELECT 1, NULLIF(5, 5)) b
{code}
[1][https://github.com/apache/calcite/blob/4e89fddab415a1e04b82c7d69960e399f608949f/linq4j/src/main/java/org/apache/calcite/linq4j/EnumerableDefaults.java#L1115]
was (Author: donnyzone):
[~danny0405] I ever executed the query in PG. It will produce a (NULL, NULL)
result.
{code:java}
SELECT *FROM (SELECT NULLIF(5, 5)) a, (SELECT NULLIF(5, 5)) b
{code}
I am not sure whether it is the problem with Linq4q[1]. When the current value
is _null_ in left side (i.e., outers), Linq4q directly sets
(innerEnumerable=null), resulting an emptyEnumerator.
{code:java}
Q1: result expected (1, NULL, NULL)
SELECT *FROM (SELECT 1, NULLIF(5, 5)) a, (SELECT NULLIF(5, 5)) b
Q2: 0 rows
SELECT *FROM (SELECT NULLIF(5, 5)) a, (SELECT 1, NULLIF(5, 5))
{code}
[1][https://github.com/apache/calcite/blob/4e89fddab415a1e04b82c7d69960e399f608949f/linq4j/src/main/java/org/apache/calcite/linq4j/EnumerableDefaults.java#L1115]
> 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)