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

huajianlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new fcdb543e17 [refactor] (Nereids) add equals for OrderKey (#11192)
fcdb543e17 is described below

commit fcdb543e17c8376956094eda1b6e83ea8b7d9a75
Author: minghong <minghong.z...@163.com>
AuthorDate: Tue Jul 26 18:55:27 2022 +0800

    [refactor] (Nereids) add equals for OrderKey (#11192)
    
    LogicalSort.equals() method depends on OrderKey.equals(), which is not 
defined correctly.
    This pr defines OrderKey.equals() to enable correctly comparing LogicalSort.
---
 .../org/apache/doris/nereids/properties/OrderKey.java | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/properties/OrderKey.java 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/properties/OrderKey.java
index 7d6ee6eb8d..8059b2ddfa 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/properties/OrderKey.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/properties/OrderKey.java
@@ -19,6 +19,8 @@ package org.apache.doris.nereids.properties;
 
 import org.apache.doris.nereids.trees.expressions.Expression;
 
+import java.util.Objects;
+
 /**
  * Represents the order key of a statement.
  */
@@ -67,4 +69,21 @@ public class OrderKey {
     public String toString() {
         return expr.toSql();
     }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(expr, isAsc, nullFirst);
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+        OrderKey that = (OrderKey) o;
+        return isAsc == that.isAsc() && nullFirst == that.isNullFirst() && 
expr.equals(that.getExpr());
+    }
 }


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

Reply via email to