You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by pa...@apache.org on 2023/06/05 02:22:18 UTC

[doris] branch branch-1.2-lts updated: [Bug](function) fix equals implements not judge order by elements of function call expr (#20417)

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

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


The following commit(s) were added to refs/heads/branch-1.2-lts by this push:
     new 6d4394d28c [Bug](function) fix equals implements not judge order by elements of function call expr (#20417)
6d4394d28c is described below

commit 6d4394d28c6027bdd3dfb1d19b9149c960738af6
Author: Pxl <px...@qq.com>
AuthorDate: Mon Jun 5 10:22:08 2023 +0800

    [Bug](function) fix equals implements not judge order by elements of function call expr (#20417)
    
    cherry pick from #20083
---
 .../src/main/java/org/apache/doris/analysis/FunctionCallExpr.java | 8 ++++++++
 regression-test/data/query_p0/group_concat/test_group_concat.out  | 4 ++++
 .../suites/query_p0/group_concat/test_group_concat.groovy         | 4 ++++
 3 files changed, 16 insertions(+)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java
index e35eec84d2..1dee954964 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java
@@ -486,6 +486,14 @@ public class FunctionCallExpr extends Expr {
             return false;
         }
         FunctionCallExpr o = (FunctionCallExpr) obj;
+        if (orderByElements.size() != o.orderByElements.size()) {
+            return false;
+        }
+        for (int i = 0; i < orderByElements.size(); i++) {
+            if (!orderByElements.get(i).equals(o.orderByElements.get(i))) {
+                return false;
+            }
+        }
         return /*opcode == o.opcode && aggOp == o.aggOp &&*/ fnName.equals(o.fnName)
                 && fnParams.isDistinct() == o.fnParams.isDistinct()
                 && fnParams.isStar() == o.fnParams.isStar();
diff --git a/regression-test/data/query_p0/group_concat/test_group_concat.out b/regression-test/data/query_p0/group_concat/test_group_concat.out
index 0e6aab79a8..0bc76e1146 100644
--- a/regression-test/data/query_p0/group_concat/test_group_concat.out
+++ b/regression-test/data/query_p0/group_concat/test_group_concat.out
@@ -48,3 +48,7 @@ false
 -- !select_group_concat_order_by_desc3 --
 1	3, 21, 2, 11, 1
 2	23, 222, 22, 211, 21
+
+-- !select_group_concat_order_by --
+1,11,2,21,21,211,22,222,23,3	3,23,222,22,211,21,21,2,11,1
+
diff --git a/regression-test/suites/query_p0/group_concat/test_group_concat.groovy b/regression-test/suites/query_p0/group_concat/test_group_concat.groovy
index a5781f39e1..f2d5dd3504 100644
--- a/regression-test/suites/query_p0/group_concat/test_group_concat.groovy
+++ b/regression-test/suites/query_p0/group_concat/test_group_concat.groovy
@@ -62,4 +62,8 @@ suite("test_group_concat") {
     qt_select_group_concat_order_by_desc3 """
                 SELECT b1, group_concat(cast(abs(b3) as varchar) order by abs(b2) desc, b3 desc) FROM table_group_concat  group by b1 order by b1
               """
+    qt_select_group_concat_order_by """
+                select group_concat(b3,',' order by b3 asc),group_concat(b3,',' order by b3 desc) from table_group_concat;
+    """
+
 }


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