[
https://issues.apache.org/jira/browse/IMPALA-13767?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18019008#comment-18019008
]
ASF subversion and git services commented on IMPALA-13767:
----------------------------------------------------------
Commit 1ff4e1b68298563bbcc2729066b11e0028254eb0 in impala's branch
refs/heads/master from Fang-Yu Rao
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=1ff4e1b68 ]
IMPALA-13767: Do not treat CTEs as names of actual tables
This patch implements an additional check when collecting table names
that are used in the given query. Specifically, for a table name that
is not fully qualified, we make sure the derived fully qualified table
name is not a common table expression (CTE) of a SqlWithItem in a
WITH clause since such CTE's are not actual tables.
Testing:
- Added a test in test_ranger.py to verify the issue is fixed.
Change-Id: I3f51af42d64cdcff3c26ad5a96c7f53ebef431b3
Reviewed-on: http://gerrit.cloudera.org:8080/23209
Tested-by: Impala Public Jenkins <[email protected]>
Reviewed-by: Fang-Yu Rao <[email protected]>
> Common table expression (CTE) in a WITH clause should not be treated as a
> table by TableVisitor for the Calcite planner
> -----------------------------------------------------------------------------------------------------------------------
>
> Key: IMPALA-13767
> URL: https://issues.apache.org/jira/browse/IMPALA-13767
> Project: IMPALA
> Issue Type: Sub-task
> Components: Frontend
> Reporter: Fang-Yu Rao
> Assignee: Fang-Yu Rao
> Priority: Major
>
> Currently for the Calcite planner in Impala, a temporary table associated
> with a WITH clause is treated as a table by {{TableVisitor}} in
> [CalciteMetadataHandler.java|https://github.com/apache/impala/blob/master/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteMetadataHandler.java].
>
> For instance, after the execution of
> "{{{}parsedNode.accept(tableVisitor){}}}" in CalciteMetadataHandler.java,
> '{{{}tableVisitor.tableNames_{}}}' evaluates to a {{HashSet}} consisting of
> the table names "{{{}default.t{}}}" and "{{{}functional.alltypestiny{}}}" for
> the following query. It would be better if "{{{}default.t{}}}" is not
> considered as the name of a table involved in the query when we are visiting
> the {{SqlNode}}.
> {code:java}
> with t as (select * from functional.alltypestiny) select * from t;
> {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]