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: Prevent illegal implicit collection references being used.
Date Mon, 22 Aug 2016 17:38:15 GMT
Christopher Channing has uploaded a new change for review.

  http://gerrit.cloudera.org:8080/4079

Change subject: IMPALA-3938: Prevent illegal implicit collection references being used.
......................................................................

IMPALA-3938: Prevent illegal implicit collection references being used.

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: 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 MapType. 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 the illegal implicit
collection reference from Array->Map 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, 25 insertions(+), 2 deletions(-)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I703c7e9c8c9c95c9fee714767367373eec10cd0c
Gerrit-PatchSet: 1
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Christopher Channing <cchanning@cloudera.com>

Mime
View raw message