Steve Carlin has uploaded this change for review. (
http://gerrit.cloudera.org:8080/25187
Change subject: IMPALA-14944: Throw UnsupportedFeatureException for some
Calcite planner queries
......................................................................
IMPALA-14944: Throw UnsupportedFeatureException for some Calcite planner queries
This commit adds code to throw an UnsupportedFeatureException for queries
that cannot be handled by the Calcite planner. The benefit for throwing this
specific exception rather than any other exception is that this will be
used to track queries not supported by Calcite and allow them to pass by
running them through the original planner. In this way, when all queries
are either supported or have this exception thrown, the Jenkins job will
be able to pass when there is no fallback planner specified.
This commit includes:
- Some syntax supported by Impala has been added to the Parser.jj file.
A ParseException is thrown and the message is caught an the Unsupported
exception
is then rethrown. This includes keywords like "tablesample", "unnest" and
"row__id",
- Backticks around column names are caught and rethrown.
- If an InconsistentMetadataFetchException is thrown, this is because there
was some metadata that changed after a fetch. This exception is now passed
through to the top level and the query will be retried in Calcite again. While
this doesn't directly pertain to the spirit of this commit, it has been added
because it is another case of retrying a query that has failed.
- The CreateExprVisitor has been changed to rethrow a found error. Previous to
this commit, it could not handle throwing an ImpalaException and would just
throw a RuntimeException.
- The query option to disable hdfs_num_rows_estimate has been turned off
because it throws an exception (IMPALA-15569)
- The CalciteMetadataHandler has been changed to allow Unsupported exceptions
to be thrown. The TableVisitor has been wrapped in a static getTableNames
method, and this static method handles the rethrow of the exception.
- There is a specific type of "with" query that is supported by Impala but
not supported by Calcite:
with t(c1) as (select int_col, bigint_col from alltypestiny)
select * from t order by c1 limit 1
This query has one column defined in "with t(c1)", but 2 columns "(int_col,
bigint_col)" defined in the inner select. Calcite flags this as a validation
error, but some code has been added to catch when this situation happens
and throw the Unsupported error so that the original planner can run it.
- Some extra code in the authorization area was needed to deal with some
of these Unsupported issues. If a table is not found, it needs to be checked
to see if it authorized. This way, a proper unauthorized error message can
be thrown whether the table is there or not. The problem that Calcite has is
that it does not have the ability at this point to differentiate between
<db>.<table_name> and <table_name>.<complex_column>. Rather than try to
authorize within the Calcite planner, the authorization will be skipped and
the Unsupported error will be thrown. This allows the original planner to
do the proper checking and then send an ambiguous authorization failure
whether the table exists or not.
Testing: All these situations exist with the test framework and have been
tested when the fallback planner is turned off and the original planner
is Calcite.
Change-Id: I20f38408fafbbd6b66ef0e6e4a8c6cfbc9f79b8e
---
M fe/src/main/java/org/apache/impala/analysis/AnalysisContext.java
M fe/src/main/java/org/apache/impala/service/Frontend.java
M java/calcite-planner/src/main/codegen/templates/Parser.jj
M
java/calcite-planner/src/main/java/org/apache/impala/calcite/schema/CalciteTable.java
M
java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteAnalysisDriver.java
M
java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteAnalysisResult.java
M
java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteCompilerFactory.java
M
java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteMetadataHandler.java
M
java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteParsedStatement.java
M
java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteQueryParser.java
M
java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteSingleNodePlanner.java
A
java/calcite-planner/src/main/java/org/apache/impala/calcite/service/ComplexTableDetector.java
M
java/calcite-planner/src/main/java/org/apache/impala/calcite/service/ImpalaSqlValidatorImpl.java
M
java/calcite-planner/src/main/java/org/apache/impala/calcite/service/UnsupportedChecker.java
M
testdata/workloads/functional-query/queries/QueryTest/iceberg-rest-catalog-blacklist-tables.test
15 files changed, 344 insertions(+), 67 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/87/25187/1
--
To view, visit http://gerrit.cloudera.org:8080/25187
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I20f38408fafbbd6b66ef0e6e4a8c6cfbc9f79b8e
Gerrit-Change-Number: 25187
Gerrit-PatchSet: 1
Gerrit-Owner: Steve Carlin <[email protected]>