wangshuo128 commented on a change in pull request #8513:
URL: https://github.com/apache/incubator-doris/pull/8513#discussion_r832987800
##########
File path: fe/fe-core/src/main/java/org/apache/doris/analysis/StmtRewriter.java
##########
@@ -310,10 +310,16 @@ private static SelectList
addMissingAggregationColumns(SelectList selectList,
private static void rewriteUnionStatement(SetOperationStmt stmt, Analyzer
analyzer)
throws AnalysisException {
for (SetOperationStmt.SetOperand operand: stmt.getOperands()) {
- Preconditions.checkState(operand.getQueryStmt() instanceof
SelectStmt);
- QueryStmt rewrittenQueryStmt = StmtRewriter.rewriteSelectStatement(
- (SelectStmt)operand.getQueryStmt(), operand.getAnalyzer());
- operand.setQueryStmt(rewrittenQueryStmt);
+ QueryStmt queryStmt = operand.getQueryStmt();
+ if (queryStmt instanceof SelectStmt) {
+ QueryStmt rewrittenQueryStmt =
rewriteSelectStatement((SelectStmt)queryStmt, operand.getAnalyzer());
+ operand.setQueryStmt(rewrittenQueryStmt);
+ } else if (queryStmt instanceof SetOperationStmt) {
+ rewriteUnionStatement((SetOperationStmt)queryStmt,
operand.getAnalyzer());
+ } else {
+ LOG.warn("Rewrite union statement failed. Because QueryStmt is
neither SelectStmt nor SetOperationStmt");
Review comment:
I meat to add a message in the exception description, thus users can ask
questions with the specific error message. WDYT?
```suggestion
LOG.warn("Rewrite union statement failed. Because QueryStmt
is neither SelectStmt nor SetOperationStmt");
throw new IllegalStateException("Rewrite union statement
failed. Because QueryStmt is neither SelectStmt nor SetOperationStmt");
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]