asiunov commented on code in PR #35768:
URL: https://github.com/apache/spark/pull/35768#discussion_r1224158066


##########
sql/catalyst/src/main/java/org/apache/spark/sql/connector/expressions/GeneralScalarExpression.java:
##########
@@ -190,6 +113,19 @@ public GeneralScalarExpression(String name, Expression[] 
children) {
   public String name() { return name; }
   public Expression[] children() { return children; }
 
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) return true;
+    if (o == null || getClass() != o.getClass()) return false;
+    GeneralScalarExpression that = (GeneralScalarExpression) o;
+    return Objects.equals(name, that.name) && Arrays.equals(children, 
that.children);
+  }
+
+  @Override
+  public int hashCode() {
+    return Objects.hash(name, children);

Review Comment:
   Sorry, I meant `return Objects.hash(name, Arrays.hashCode(children));`. 
Otherwise hash of array `children` is just reference's hash, i.e. it does not 
consider elements' hashes.



##########
sql/catalyst/src/main/java/org/apache/spark/sql/connector/expressions/GeneralScalarExpression.java:
##########
@@ -190,6 +113,19 @@ public GeneralScalarExpression(String name, Expression[] 
children) {
   public String name() { return name; }
   public Expression[] children() { return children; }
 
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) return true;
+    if (o == null || getClass() != o.getClass()) return false;
+    GeneralScalarExpression that = (GeneralScalarExpression) o;
+    return Objects.equals(name, that.name) && Arrays.equals(children, 
that.children);
+  }
+
+  @Override
+  public int hashCode() {
+    return Objects.hash(name, children);

Review Comment:
   Sorry, I meant `return Objects.hash(name, Arrays.hashCode(children));`. 
Otherwise hash of array `children` is just the array reference's hash, i.e. it 
does not consider elements' hashes.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to