qzsee commented on a change in pull request #8513: URL: https://github.com/apache/incubator-doris/pull/8513#discussion_r833877897
########## 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: you are right . done -- 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: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org