Skip to content

Commit

Permalink
SPARK-49618. Using Seq of legs to get hashCode instead of Set
Browse files Browse the repository at this point in the history
  • Loading branch information
ashahid committed Sep 17, 2024
1 parent 82b8cbe commit 91372e4
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@ package org.apache.spark.sql.catalyst.plans

import scala.collection.mutable

import com.google.common.base.Objects

import org.apache.spark.sql.catalyst.expressions.{Attribute, ExprId}

trait UnionEquality [PlanType <: QueryPlan[PlanType]] {
self: PlanType =>

private lazy val positionAgnosticHash = this.children.toSet.hashCode()
// because union legs can have repeats, avoiding this.children.toSet.hashCode
private lazy val positionAgnosticHash =
Objects.hashCode(this.children.map(_.hashCode()).sorted: _*)

// for now should be used only for unionAll. Union distinct may not have size check
def positionAgnosticEquals(that: PlanType): Boolean = {
Expand Down

0 comments on commit 91372e4

Please sign in to comment.