[
https://issues.apache.org/jira/browse/IMPALA-11840?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17678346#comment-17678346
]
ASF subversion and git services commented on IMPALA-11840:
----------------------------------------------------------
Commit ed59690b4480ff332edef1ccb2456385ac52220b in impala's branch
refs/heads/master from Daniel Becker
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=ed59690b4 ]
IMPALA-11840: Error with joining unnest with views
Queries fail in the following situation involving collections and views:
1. A view returns an array
2. A second view unnests the array returned from the first view
3. The unnested view is queried in an outer query
For example:
use functional_parquet;
with sub as (
select id, arr1.item unnested_arr
from complextypes_arrays_only_view,
complextypes_arrays_only_view.int_array arr1)
select id, unnested_arr from sub;
ERROR: IllegalStateException: null
The problem is that in CollectionTableRef.analyze(), if
- there is a source view and
- the collection ref is within a WITH clause and
- it is not in the select list
then 'desc_' is not set, but it has to be set in order for
TableRef.analyzeJoin() to succeed.
This commit solves the problem by assigning a value to 'desc_' also in
the above case.
Testing:
- Added regression tests in nested-types-runtime.test.
Change-Id: Ic52655631944913553a7e7d9e9169b93da46dde3
Reviewed-on: http://gerrit.cloudera.org:8080/19426
Reviewed-by: Impala Public Jenkins <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>
> 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
> Priority: Major
>
> 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: [email protected]
For additional commands, e-mail: [email protected]