Fang-Yu Rao has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/25144 )

Change subject: IMPALA-14944: Throw UnsupportedFeatureException for some 
Calcite planner queries
......................................................................


Patch Set 2:

(5 comments)

Thanks for taking care of this Steve! I left some comments mostly for my own 
understanding. I am still reading the patch. Will provide more feedback once I 
have a better understanding of the patch.

http://gerrit.cloudera.org:8080/#/c/25144/2/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteAnalysisDriver.java
File 
java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteAnalysisDriver.java:

http://gerrit.cloudera.org:8080/#/c/25144/2/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteAnalysisDriver.java@212
PS2, Line 212: ParseException,
nit: Does this method throw a ParseException somewhere in this method? It seems 
I could not find it.


http://gerrit.cloudera.org:8080/#/c/25144/2/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteMetadataHandler.java
File 
java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteMetadataHandler.java:

http://gerrit.cloudera.org:8080/#/c/25144/2/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteMetadataHandler.java@311
PS2, Line 311: if (table.getColumn(onlyColumnPart) != null)
The comment is not directly related to this patch. But I found that this check 
is a bit coarse-grained. It's possible that a non-existing column in a query 
could still result in falling back to the original planner to produce the query 
plan, even though none of the tables involves a complex-typed column. Maybe we 
could use "table.getColumn(onlyColumnPart) != null && 
!(table.getColumn(onlyColumnPart).getType() instanceof ScalarType)" instead?

Below I provide 2 queries as examples after we set both query options of 
'planner' and 'fallback_planner' to calcite.

 [localhost:21050] default> set planner=calcite;
 PLANNER set to calcite
 [localhost:21050] default> set fallback_planner=calcite;
 FALLBACK_PLANNER set to calcite

 # The query involves 2 tables, and since 'functional.jointbl' happens to
 # contain a column 'test_id', anyTableContainsColumn() returns true,
 # which results in an UnsupportedFeatureException("Complex column ... ")
 # being thrown.
 [localhost:21050] default> select functional.alltypes.test_id from 
functional.alltypes, functional.jointbl;
 Query: select functional.alltypes.test_id from functional.alltypes, 
functional.jointbl
 Query submitted at: 2026-10-19 17:38:14 (Coordinator: http://fangyu:25000)
 2026-10-19 17:38:14 [Exception]  ERROR: Query 
b54484b05994711e:5710159a00000000 failed:
 AnalysisException: Could not resolve column/field reference: 
'functional.alltypes.test_id'

 # This query involves only 1 table, and the original SqlValidatorException
 # from the Calcite planner is not hidden from the user.
 [localhost:21050] default> select functional.alltypes.test_id from 
functional.alltypes;
 Query: select functional.alltypes.test_id from functional.alltypes
 Query submitted at: 2026-10-19 17:38:31 (Coordinator: http://fangyu:25000)
 2026-10-19 17:38:31 [Exception]  ERROR: Query 
8b491d0e5077db16:7a79207d00000000 failed:
 AnalysisException: From line 1, column 28 to line 1, column 34: Column 
'TEST_ID' not found in table 'FUNCTIONAL.alltypes'
 CAUSED BY: SqlValidatorException: Column 'TEST_ID' not found in table 
'FUNCTIONAL.alltypes'


http://gerrit.cloudera.org:8080/#/c/25144/2/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/ComplexTableDetector.java
File 
java/calcite-planner/src/main/java/org/apache/impala/calcite/service/ComplexTableDetector.java:

http://gerrit.cloudera.org:8080/#/c/25144/2/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/ComplexTableDetector.java@88
PS2, Line 88: potentialTable
nit: Is this used anywhere?


http://gerrit.cloudera.org:8080/#/c/25144/2/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/ComplexTableDetector.java@89
PS2, Line 89: tableNameIdentifier
nit: Is this used anywhere?


http://gerrit.cloudera.org:8080/#/c/25144/2/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/ComplexTableDetector.java@121
PS2, Line 121: throw new UnsupportedFeatureException("Complex table " + 
detector.complexTable_ +
             :           " not supported.")
Is my understanding correct that authorization based on the AnalysisResult 
produced by the Calcite planner will be skipped because we throw an 
UnsupportedFeatureException when checkFromNode() detected a complex table? I am 
asking because of the following in the commit message. It's not entirely clear 
if there is a causal relationship between "authorization based on privilege 
requests registered by the Calcite planner being skipped" and "an unsupported 
error being thrown."

 Rather than try to authorize within the Calcite planner, the authorization 
will be skipped and the Unsupported error will be thrown.



--
To view, visit http://gerrit.cloudera.org:8080/25144
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I037d636064c4c99131598b7424dd99e4ad56d30f
Gerrit-Change-Number: 25144
Gerrit-PatchSet: 2
Gerrit-Owner: Steve Carlin <[email protected]>
Gerrit-Reviewer: Aleksandr Efimov <[email protected]>
Gerrit-Reviewer: Aman Sinha <[email protected]>
Gerrit-Reviewer: Fang-Yu Rao <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Joe McDonnell <[email protected]>
Gerrit-Reviewer: Michael Smith <[email protected]>
Gerrit-Comment-Date: Thu, 22 Oct 2026 01:11:54 +0000
Gerrit-HasComments: Yes

Reply via email to