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()); + } }