[ 
https://issues.apache.org/jira/browse/IMPALA-11828?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniel Becker updated IMPALA-11828:
-----------------------------------
    Description: 
If an array-typed column comes from a view or an inline view and is 
unnest-joined with itself, the (non-unnested) array column in the result will 
contain NULLs instead of the arrays.

The following queries both produce incorrect results. Note that 
{{complextypes_arrays_only_view}} is a view on {{complextypestbl}} so these 
queries are functionally equivalent:
{code:java}
use functional_parquet;
with sub as (select int_array from complextypestbl) select int_array, a.item 
from sub, sub.int_array a;{code}
{code:java}
use functional_parquet;
select int_array, a.item from complextypes_arrays_only_view, 
complextypes_arrays_only_view.int_array a;{code}
{code:java}
+-----------+------+
| int_array | item |
+-----------+------+
| NULL      | -1   |
| NULL      | 1    |
| NULL      | 2    |
| NULL      | 3    |
| NULL      | NULL |
| NULL      | 1    |
| NULL      | 2    |
| NULL      | NULL |
| NULL      | 3    |
| NULL      | NULL |
+-----------+------+{code}
 

If no views are involved and the table is queried directly, the result is 
correct:
{code:java}
use functional_parquet;
select int_array, a.item from complextypestbl, complextypestbl.int_array 
a;{code}
{code:java}
+------------------------+------+
| int_array              | item |
+------------------------+------+
| [-1]                   | -1   |
| [1,2,3]                | 1    |
| [1,2,3]                | 2    |
| [1,2,3]                | 3    |
| [null,1,2,null,3,null] | NULL |
| [null,1,2,null,3,null] | 1    |
| [null,1,2,null,3,null] | 2    |
| [null,1,2,null,3,null] | NULL |
| [null,1,2,null,3,null] | 3    |
| [null,1,2,null,3,null] | NULL |
+------------------------+------+{code}

  was:
If an array-typed column comes from a view or an inline view and is 
unnest-joined with itself, the (non-unnested) array column in the result will 
contain NULLs instead of the arrays.

The following queries both produce incorrect results. Note that 
{{complextypes_arrays_only_view}} is a view on {{complextypestbl}} so these 
queries are functionally equivalent:

 
{code:java}
use functional_parquet;
with sub as (select int_array from complextypestbl) select int_array, a.item 
from sub, sub.int_array a;{code}
 
{code:java}
use functional_parquet;
select int_array, a.item from complextypes_arrays_only_view, 
complextypes_arrays_only_view.int_array a;{code}
 

 
{code:java}
+-----------+------+
| int_array | item |
+-----------+------+
| NULL      | -1   |
| NULL      | 1    |
| NULL      | 2    |
| NULL      | 3    |
| NULL      | NULL |
| NULL      | 1    |
| NULL      | 2    |
| NULL      | NULL |
| NULL      | 3    |
| NULL      | NULL |
+-----------+------+{code}
 

If no views are involved and the table is queried directly, the result is 
correct:
{code:java}
use functional_parquet;
select int_array, a.item from complextypestbl, complextypestbl.int_array 
a;{code}
{code:java}
+------------------------+------+
| int_array              | item |
+------------------------+------+
| [-1]                   | -1   |
| [1,2,3]                | 1    |
| [1,2,3]                | 2    |
| [1,2,3]                | 3    |
| [null,1,2,null,3,null] | NULL |
| [null,1,2,null,3,null] | 1    |
| [null,1,2,null,3,null] | 2    |
| [null,1,2,null,3,null] | NULL |
| [null,1,2,null,3,null] | 3    |
| [null,1,2,null,3,null] | NULL |
+------------------------+------+{code}


> Incorrect result of joining unnest with view
> --------------------------------------------
>
>                 Key: IMPALA-11828
>                 URL: https://issues.apache.org/jira/browse/IMPALA-11828
>             Project: IMPALA
>          Issue Type: Bug
>            Reporter: Daniel Becker
>            Assignee: Daniel Becker
>            Priority: Major
>
> If an array-typed column comes from a view or an inline view and is 
> unnest-joined with itself, the (non-unnested) array column in the result will 
> contain NULLs instead of the arrays.
> The following queries both produce incorrect results. Note that 
> {{complextypes_arrays_only_view}} is a view on {{complextypestbl}} so these 
> queries are functionally equivalent:
> {code:java}
> use functional_parquet;
> with sub as (select int_array from complextypestbl) select int_array, a.item 
> from sub, sub.int_array a;{code}
> {code:java}
> use functional_parquet;
> select int_array, a.item from complextypes_arrays_only_view, 
> complextypes_arrays_only_view.int_array a;{code}
> {code:java}
> +-----------+------+
> | int_array | item |
> +-----------+------+
> | NULL      | -1   |
> | NULL      | 1    |
> | NULL      | 2    |
> | NULL      | 3    |
> | NULL      | NULL |
> | NULL      | 1    |
> | NULL      | 2    |
> | NULL      | NULL |
> | NULL      | 3    |
> | NULL      | NULL |
> +-----------+------+{code}
>  
> If no views are involved and the table is queried directly, the result is 
> correct:
> {code:java}
> use functional_parquet;
> select int_array, a.item from complextypestbl, complextypestbl.int_array 
> a;{code}
> {code:java}
> +------------------------+------+
> | int_array              | item |
> +------------------------+------+
> | [-1]                   | -1   |
> | [1,2,3]                | 1    |
> | [1,2,3]                | 2    |
> | [1,2,3]                | 3    |
> | [null,1,2,null,3,null] | NULL |
> | [null,1,2,null,3,null] | 1    |
> | [null,1,2,null,3,null] | 2    |
> | [null,1,2,null,3,null] | NULL |
> | [null,1,2,null,3,null] | 3    |
> | [null,1,2,null,3,null] | NULL |
> +------------------------+------+{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to