This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-1.1-lts
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-1.1-lts by this push:
     new 7e4b4dd79f [fix](sort)order by constant expr bug (#13614)
7e4b4dd79f is described below

commit 7e4b4dd79f1bb4deeda80c10152473606becf9e6
Author: starocean999 <40539150+starocean...@users.noreply.github.com>
AuthorDate: Tue Oct 25 16:44:42 2022 +0800

    [fix](sort)order by constant expr bug (#13614)
---
 .../src/main/java/org/apache/doris/analysis/SelectStmt.java       | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java
index 4e98276954..2fe58db9ec 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java
@@ -1409,7 +1409,15 @@ public class SelectStmt extends QueryStmt {
         }
         if (orderByElements != null) {
             for (OrderByElement orderByElem : orderByElements) {
+                // we must make sure the expr is analyzed before rewrite
+                try {
+                    orderByElem.getExpr().analyze(analyzer);
+                } catch (AnalysisException ex) {
+                    //ignore any exception
+                }
                 orderByElem.setExpr(rewriter.rewrite(orderByElem.getExpr(), 
analyzer));
+                // after rewrite, need reset the analyze status for later 
re-analyze
+                orderByElem.getExpr().reset();
             }
         }
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to