Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package org.apache.spark.sql.connector.expressions;

import java.util.Arrays;
import java.util.Objects;

import org.apache.spark.annotation.Evolving;
import org.apache.spark.sql.connector.expressions.filter.Predicate;
Expand Down Expand Up @@ -441,12 +440,17 @@ public GeneralScalarExpression(String name, Expression[] children) {
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);

if (!name.equals(that.name)) return false;
return Arrays.equals(children, that.children);
}

@Override
public int hashCode() {
return Objects.hash(name, children);
int result = name.hashCode();
result = 31 * result + Arrays.hashCode(children);
return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package org.apache.spark.sql.connector.expressions;

import java.util.Arrays;
import java.util.Objects;

import org.apache.spark.annotation.Evolving;
import org.apache.spark.sql.internal.connector.ExpressionWithToString;
Expand Down Expand Up @@ -51,13 +50,19 @@ public UserDefinedScalarFunc(String name, String canonicalName, Expression[] chi
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;

UserDefinedScalarFunc that = (UserDefinedScalarFunc) o;
return Objects.equals(name, that.name) && Objects.equals(canonicalName, that.canonicalName) &&
Arrays.equals(children, that.children);

if (!name.equals(that.name)) return false;
if (!canonicalName.equals(that.canonicalName)) return false;
return Arrays.equals(children, that.children);
}

@Override
public int hashCode() {
return Objects.hash(name, canonicalName, children);
int result = name.hashCode();
result = 31 * result + canonicalName.hashCode();
result = 31 * result + Arrays.hashCode(children);
return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

package org.apache.spark.sql.connector.expressions.aggregate;

import java.util.Arrays;

import org.apache.spark.annotation.Evolving;
import org.apache.spark.sql.connector.expressions.Expression;
import org.apache.spark.sql.internal.connector.ExpressionWithToString;
Expand Down Expand Up @@ -60,4 +62,24 @@ public GeneralAggregateFunc(String name, boolean isDistinct, Expression[] childr

@Override
public Expression[] children() { return children; }

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;

GeneralAggregateFunc that = (GeneralAggregateFunc) o;

if (isDistinct != that.isDistinct) return false;
if (!name.equals(that.name)) return false;
return Arrays.equals(children, that.children);
}

@Override
public int hashCode() {
int result = name.hashCode();
result = 31 * result + (isDistinct ? 1 : 0);
result = 31 * result + Arrays.hashCode(children);
return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

package org.apache.spark.sql.connector.expressions.aggregate;

import java.util.Arrays;

import org.apache.spark.annotation.Evolving;
import org.apache.spark.sql.connector.expressions.Expression;
import org.apache.spark.sql.internal.connector.ExpressionWithToString;
Expand Down Expand Up @@ -50,4 +52,26 @@ public UserDefinedAggregateFunc(

@Override
public Expression[] children() { return children; }

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;

UserDefinedAggregateFunc that = (UserDefinedAggregateFunc) o;

if (isDistinct != that.isDistinct) return false;
if (!name.equals(that.name)) return false;
if (!canonicalName.equals(that.canonicalName)) return false;
return Arrays.equals(children, that.children);
}

@Override
public int hashCode() {
int result = name.hashCode();
result = 31 * result + canonicalName.hashCode();
result = 31 * result + (isDistinct ? 1 : 0);
result = 31 * result + Arrays.hashCode(children);
return result;
}
}