impala-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christopher Channing (Code Review)" <ger...@cloudera.org>
Subject [Impala-ASF-CR] IMPALA-3938: Disallow implicit references between nested collections.
Date Tue, 23 Aug 2016 19:37:37 GMT
Christopher Channing has uploaded a new patch set (#3).

Change subject: IMPALA-3938: Disallow implicit references between nested collections.
......................................................................

IMPALA-3938: Disallow implicit references between nested collections.

The Bug: Prior to this patch Impala would accept and execute a query of
the form "select pos, key, value from tbl.arr_map_col order by pos asc",
where "arr_map_col" is an array of map<?, ?>. In this example, the map
is not referenced as a collection and therefore the implicit rule of
using "item" should not be applied. The results produced from this
erroneous query are arbitrary. The semantically correct way of
expressing the query would be of the form "select a.pos, m.key, m.value
from tbl t, t.arr_map_col a, a.item m order by a.pos asc".

The Fix: Removed the existing 'expectExplicitMatch' flag to simplify the
code. During query analysis (more specifically: path resolution), if
part of a path cannot be explicitly matched then the planner will fall
back to an implicit field check. As part of this check, the type of the
nested field inside the collection will be inspected to verify that it
does not match that of a collection type. If so, the path resolution will
fail and an AnalysisException will be thrown indicating that the path
cannot be resolved. For example, trying to execute the query "select pos,
key, value from tbl.arr_map_col order by pos asc" would yield the
following error "Could not resolve column/field reference: 'key'".
Regarding test coverage, the existing test suite "AnalyzeStmtsTest" has
been augmented with a set of new tests that will verify that implicit
references between collections cannot be used.

Change-Id: I703c7e9c8c9c95c9fee714767367373eec10cd0c
---
M fe/src/main/java/com/cloudera/impala/analysis/Path.java
M fe/src/test/java/com/cloudera/impala/analysis/AnalyzeStmtsTest.java
2 files changed, 31 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/79/4079/3
-- 
To view, visit http://gerrit.cloudera.org:8080/4079
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I703c7e9c8c9c95c9fee714767367373eec10cd0c
Gerrit-PatchSet: 3
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Christopher Channing <cchanning@cloudera.com>
Gerrit-Reviewer: Alex Behm <alex.behm@cloudera.com>
Gerrit-Reviewer: Christopher Channing <cchanning@cloudera.com>

Mime
View raw message