You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "Daniel Becker (Jira)" <ji...@apache.org> on 2023/01/12 11:12:00 UTC

[jira] [Created] (IMPALA-11840) Error with joining unnest with views

Daniel Becker created IMPALA-11840:
--------------------------------------

             Summary: Error with joining unnest with views
                 Key: IMPALA-11840
                 URL: https://issues.apache.org/jira/browse/IMPALA-11840
             Project: IMPALA
          Issue Type: Bug
          Components: Frontend
            Reporter: Daniel Becker
            Assignee: Daniel Becker


The following query fails:

 
{code:java}
use functional_parquet;
with sub as (
  select id, arr1.item unnested_arr
  from complextypes_arrays_only_view, complextypes_arrays_only_view.int_array_array arr1)
select id, unnested_arr from sub;
ERROR: IllegalStateException: null
{code}
 

The view complextypes_arrays_only_view is based on complextypestbl and if we query the table directly the query works:

 
{code:java}
use functional_parquet;
with sub as (
  select id, arr1.item unnested_arr
  from complextypestbl, complextypestbl.int_array_array arr1)
select id, unnested_arr from sub;
+----+-----------------+
| id | unnested_arr    |
+----+-----------------+
| 1  | [1,2]           |
| 1  | [3,4]           |
| 2  | [null,1,2,null] |
| 2  | [3,null,4]      |
| 2  | []              |
| 2  | NULL            |
| 3  | NULL            |
| 7  | NULL            |
| 7  | [5,6]           |
| 8  | [-1,-2]         |
| 8  | []              |
+----+-----------------+ 
{code}
 

If instead of the HMS view we use an inline view it also produces an error:

 
{code:java}
use functional_parquet;
with arrayview as (select id, int_array_array from complextypestbl),
sub as (
  select id, arr1.item unnested_arr
  from arrayview, arrayview.int_array_array arr1)
select id, unnested_arr from sub;
ERROR: IllegalStateException: null
 
{code}
The problem seems to occur when an array is taken from a view, unnested in another view and then the result queried in an outer query. If the outer query is omitted from the first example, it works:
{code:java}
use functional_parquet;
select id, arr1.item unnested_arr
  from complextypes_arrays_only_view, complextypes_arrays_only_view.int_array_array arr1;
+----+-----------------+
| id | unnested_arr    |
+----+-----------------+
| 8  | [-1,-2]         |
| 8  | []              |
| 1  | [1,2]           |
| 1  | [3,4]           |
| 2  | [null,1,2,null] |
| 2  | [3,null,4]      |
| 2  | []              |
| 2  | NULL            |
| 3  | NULL            |
| 7  | NULL            |
| 7  | [5,6]           |
+----+-----------------+{code}



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

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org