Skip to content

Commit

Permalink
Implement equals and hashCode for CometShuffleExchangeExec
Browse files Browse the repository at this point in the history
  • Loading branch information
viirya committed Apr 25, 2024
1 parent 96b9826 commit d67071e
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ import org.apache.spark.util.MutablePair
import org.apache.spark.util.collection.unsafe.sort.{PrefixComparators, RecordComparator}
import org.apache.spark.util.random.XORShiftRandom

import com.google.common.base.Objects

import org.apache.comet.serde.{OperatorOuterClass, PartitioningOuterClass, QueryPlanSerde}
import org.apache.comet.serde.OperatorOuterClass.Operator
import org.apache.comet.serde.QueryPlanSerde.serializeDataType
Expand Down Expand Up @@ -193,6 +195,21 @@ case class CometShuffleExchangeExec(

override protected def withNewChildInternal(newChild: SparkPlan): CometShuffleExchangeExec =
copy(child = newChild)

override def equals(obj: Any): Boolean = {
obj match {
case other: CometShuffleExchangeExec =>
this.outputPartitioning == other.outputPartitioning &&
this.shuffleOrigin == other.shuffleOrigin && this.child == other.child &&
this.shuffleType == other.shuffleType &&
this.advisoryPartitionSize == other.advisoryPartitionSize
case _ =>
false
}
}

override def hashCode(): Int =
Objects.hashCode(outputPartitioning, shuffleOrigin, shuffleType, advisoryPartitionSize, child)
}

object CometShuffleExchangeExec extends ShimCometShuffleExchangeExec {
Expand Down

0 comments on commit d67071e

Please sign in to comment.