wangshuo128 commented on a change in pull request #8513:
URL: https://github.com/apache/incubator-doris/pull/8513#discussion_r830065191
##########
File path: fe/fe-core/src/main/java/org/apache/doris/analysis/StmtRewriter.java
##########
@@ -310,10 +310,15 @@ 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 {
+ throw new IllegalStateException();
Review comment:
It's better to have an exception message here.
--
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]