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: Code-Review+1

(16 comments)

I read Steve's replies and left some minor comments.

The patch looks good to me once my previous comments on patch set 2 are 
addressed in patch set 3, and the patch could also pass the pre-commit tests.

By the way, are we supposed to read https://gerrit.cloudera.org/c/25187/ 
instead of this one?

http://gerrit.cloudera.org:8080/#/c/25144/2//COMMIT_MSG
Commit Message:

http://gerrit.cloudera.org:8080/#/c/25144/2//COMMIT_MSG@21
PS2, Line 21: "row__id"
> The ParserException is thrown within the Parser.jj file
I am still a bit confused. The following query does not result in a 
SqlParseException at 
https://github.com/apache/impala/blob/c580d36/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteQueryParser.java#L56,
 but the commit message points out that a ParseException will be thrown in this 
case. Did we change how we process the keyword "row__id" in Parser.jj in patch 
set 2? I guess I missed something important.

 SELECT row__id.*, * FROM functional_orc_def.alltypestiny


http://gerrit.cloudera.org:8080/#/c/25144/2/fe/src/main/java/org/apache/impala/analysis/AnalysisContext.java
File fe/src/main/java/org/apache/impala/analysis/AnalysisContext.java:

http://gerrit.cloudera.org:8080/#/c/25144/2/fe/src/main/java/org/apache/impala/analysis/AnalysisContext.java@529
PS2, Line 529: analysisResult_.shouldFallbackBecauseOfException()
> Changed it to your first suggestion.
Thanks for the explanation Steve!


http://gerrit.cloudera.org:8080/#/c/25144/2/fe/src/main/java/org/apache/impala/service/Frontend.java
File fe/src/main/java/org/apache/impala/service/Frontend.java:

http://gerrit.cloudera.org:8080/#/c/25144/2/fe/src/main/java/org/apache/impala/service/Frontend.java@2521
PS2, Line 2521: // If there is any kind of exception from the first planner, we 
hit this code.
> I added more info to the comment, but I don't want to get too specific beca
Done


http://gerrit.cloudera.org:8080/#/c/25144/2/fe/src/main/java/org/apache/impala/service/Frontend.java@2540
PS2, Line 2540:     if (error instanceof InconsistentMetadataFetchException) {
              :       throw (InconsistentMetadataFetchException) error;
              :     }
> Not sure why I had this here.  Just retested and it seems to pass, so I rem
Done


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@151
PS2, Line 151:         
ComplexTableDetector.checkForComplexTables(parsedStmt_.getParsedSqlNode(),
             :             queryCtx_, ctx_);
Thanks for the detailed explanation Steve! Now I have a better understanding of 
the rationale of the current implementation in patch set 2. :-)

> I can change this to what you suggest, but I'm not gonna feel too comfortable 
> about it.

There is no need to add the following check as suggested by me earlier. I am 
fine with the current implementation without the following check being added to 
the beginning of the first catch block.

 if (e instanceof UnsupportedFeatureException) {
   return new CalciteAnalysisResult(this, e);
 }

But I do have a related question. Do you know of the test cases that would make 
the following throw an UnsupportedFeatureException? If you do, could we add a 
code comment before each method call? One difficulty I encountered when 
reviewing this patch was that there is no newly added test that could verify 
whether a newly added code path is really  exercised. But I am fine even if we 
don't add additional code comments here, since they will soon be removed once 
we we support the related features in the near future, and that it's in general 
safe to call these 2 methods.
- ComplexTableDetector.checkForComplexTables() at 
https://gerrit.cloudera.org/c/25144/2/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteAnalysisDriver.java#151.
- UnsupportedChecker.throwUnsupportedIfKnownException() at 
https://gerrit.cloudera.org/c/25144/2/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteAnalysisDriver.java#153.


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,
> Removed
Done


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)
> Good catch!
Done


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

http://gerrit.cloudera.org:8080/#/c/25144/2/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteQueryParser.java@46
PS2, Line 46: ParseException
> Done
Done


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

http://gerrit.cloudera.org:8080/#/c/25144/2/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteSingleNodePlanner.java@78
PS2, Line 78:           new CalciteOptimizer(analysisResult_, 
ctx_.getTimeline(), ctx_.getQueryOptions());
> Done
Done


http://gerrit.cloudera.org:8080/#/c/25144/2/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteSingleNodePlanner.java@94
PS2, Line 94: e instanceof InconsistentMetadataFetchException
> I'm gonna leave this one alone...I think the exception itself self-describe
Not a problem Steve! We don't have to add the code comment here as you 
suggested.


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
> Removed
Done


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
> Removed
Done


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.")
> Thanks for the explanation Steve! There is no need to change this part of t
Done


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

http://gerrit.cloudera.org:8080/#/c/25144/2/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/ImpalaSqlValidatorImpl.java@103
PS2, Line 103: if (spec.getTypeName().names.get(0).toLowerCase().equals("uuid"))
> Done
Done


http://gerrit.cloudera.org:8080/#/c/25144/2/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/ImpalaSqlValidatorImpl.java@181
PS2, Line 181: SqlNodeList columnList = withItem.columnList;
             :     if (columnList != null) {
             :       final RelDataType rowType = 
getValidatedNodeType(withItem.query);
             :       final int fieldCount = rowType.getFieldCount();
             :       if (columnList.size() != fieldCount) {
             :         throw new CalciteContextException("", new 
UnsupportedFeatureException(
             :             "Number of columns in with clause must match number 
of query columns"));
             :       }
             :     }
> Added comment
Done


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

http://gerrit.cloudera.org:8080/#/c/25144/2/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/UnsupportedChecker.java@119
PS2, Line 119: if (stmt.contains("`" + m.group(1) + "`")) {
             :         throw new UnsupportedFeatureException(
             :             "Backticks around column " + m.group(1) + " is not 
supported.");
             :       }
> So it works some of the time...
Thanks for providing a concrete example!

I don't feel strongly against this. It's safe to fall back to the original 
planner. I guess we don't have to change anything here. It's just that after 
this patch, we will always fall back to the original planner when a thrown 
exception is a SqlValidatorException due to a non-existent column in the query. 
Maybe it's worth mentioning this in the commit message?



--
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-Reviewer: Steve Carlin <[email protected]>
Gerrit-Comment-Date: Mon, 26 Oct 2026 22:48:49 +0000
Gerrit-HasComments: Yes

Reply via email to