Daniel Becker has uploaded this change for review. ( http://gerrit.cloudera.org:8080/19434
Change subject: WIP - IMPALA-11828: Incorrect result of joining unnest with view ...................................................................... WIP - IMPALA-11828: Incorrect result of joining unnest with view 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. For example the following query produces incorrect results: use functional_parquet; with sub as (select int_array from complextypestbl) select int_array, a.item from sub, sub.int_array a; If no views are involved and the table is queried directly, the result is correct. The cause of the problem is the following. Collection slot descriptors are set to NULL after unnesting. Therefore, normally, we create separate slot descriptors for collections in the FROM clause - even if the same collection also appears elsewhere in the query (e.g. in the select list), the slot descriptor will not be shared between them. However, if the collection comes from a view, it is in the select list in the view, not in the FROM clause. If the same collection is referenced in the outer query (as in the example), the same slot descriptor will be used for each occurrence of the collection. The shared slot descriptor will be set to NULL because of unnesting and therefore the non-unnested collection will also be considered NULL. This change ensures that a collection slot descriptor coming from a view is duplicated if it is in the FROM clause of an outer query. Testing: - Added tests in nested-array-in-select-list.test that check that the query works as expected with different kinds of views. Change-Id: I00ea31da5e3c56b50148285da067aa77ff5a571d --- M fe/src/main/java/org/apache/impala/analysis/CollectionTableRef.java M testdata/workloads/functional-query/queries/QueryTest/nested-array-in-select-list.test 2 files changed, 111 insertions(+), 11 deletions(-) git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/34/19434/1 -- To view, visit http://gerrit.cloudera.org:8080/19434 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I00ea31da5e3c56b50148285da067aa77ff5a571d Gerrit-Change-Number: 19434 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Becker <daniel.bec...@cloudera.com> Gerrit-Reviewer: Daniel Becker <daniel.bec...@cloudera.com>