Daniel Becker has uploaded a new patch set (#4). ( 
http://gerrit.cloudera.org:8080/21643 )

Change subject: IMPALA-13272: Analyitic function of collections can lead to 
crash
......................................................................

IMPALA-13272: Analyitic function of collections can lead to crash

The following query leads to DCHECK in debug builds and may cause more
subtle issues in RELEASE builds:

  select
    row_no
  from (
    select
      arr.small,
      row_number() over (order by arr.inner_struct1.str) as row_no
    from functional_parquet.collection_struct_mix t,
        t.arr_contains_nested_struct arr
  ) res;

The problem is in AnalyticPlanner.createSortInfo(). Because it is an
array unnesting operation, there are two tuples from which we try to add
slot descriptors to the sorting tuple: the array item tuple (which we'll
need) and the main tuple (which we don't actually need). The main tuple
contains the slot desc for the array. It is marked as materialised, so
we add it to the sorting tuple, but its child 'small' is not
materialised, which leads to the error.

This change solves the problem by only adding slot descs to the sorting
tuple if they are fully materialised, i.e. they and all their children
recursively are also materialised.

Testing:
 - added a test queries in sort-complex.test.

Change-Id: I71d1fa28ad4ff2e1a8fc5b91d3fc271c33765190
---
M fe/src/main/java/org/apache/impala/analysis/Analyzer.java
M fe/src/main/java/org/apache/impala/analysis/SlotDescriptor.java
M fe/src/main/java/org/apache/impala/analysis/SortInfo.java
M fe/src/main/java/org/apache/impala/analysis/TupleDescriptor.java
M fe/src/main/java/org/apache/impala/planner/AnalyticPlanner.java
M testdata/workloads/functional-query/queries/QueryTest/sort-complex.test
6 files changed, 104 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/43/21643/4
--
To view, visit http://gerrit.cloudera.org:8080/21643
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I71d1fa28ad4ff2e1a8fc5b91d3fc271c33765190
Gerrit-Change-Number: 21643
Gerrit-PatchSet: 4
Gerrit-Owner: Daniel Becker <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Michael Smith <[email protected]>
Gerrit-Reviewer: Quanlong Huang <[email protected]>
Gerrit-Reviewer: Zoltan Borok-Nagy <[email protected]>

Reply via email to