morrySnow commented on code in PR #27717: URL: https://github.com/apache/doris/pull/27717#discussion_r1408655340
########## fe/fe-core/src/main/java/org/apache/doris/analysis/ArrayLiteral.java: ########## @@ -134,6 +134,33 @@ protected void toThrift(TExprNode msg) { msg.setChildType(((ArrayType) type).getItemType().getPrimitiveType().toThrift()); } + @Override + public int hashCode() { + int code = 31 * super.hashCode(); + for (Expr c : children) { + code = code + c.hashCode(); + } + return code; Review Comment: i think u could use `Objects.hash` directly ########## fe/fe-core/src/main/java/org/apache/doris/analysis/ArrayLiteral.java: ########## @@ -134,6 +134,33 @@ protected void toThrift(TExprNode msg) { msg.setChildType(((ArrayType) type).getItemType().getPrimitiveType().toThrift()); } + @Override + public int hashCode() { + int code = 31 * super.hashCode(); + for (Expr c : children) { + code = code + c.hashCode(); + } + return code; + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof ArrayLiteral)) { + return false; + } + if (this == o) { + return true; + } + + ArrayLiteral that = (ArrayLiteral) o; + for (int i = 0; i < children.size(); i++) { Review Comment: why not use `Objects.equals(children, that.children)` ? ########## fe/fe-core/src/main/java/org/apache/doris/analysis/MapLiteral.java: ########## @@ -218,4 +218,31 @@ public void write(DataOutput out) throws IOException { Expr.writeTo(e, out); } } + + @Override + public int hashCode() { + int code = 31 * super.hashCode(); + for (Expr c : children) { + code = code + c.hashCode(); + } + return code; + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof MapLiteral)) { Review Comment: iunstanceof include null check -- 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: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org