Skip to content

Commit 4425dbc

Browse files
committed
replace equal by semanticEquals
1 parent 029b5ba commit 4425dbc

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/basicOperators.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import org.apache.spark.sql.catalyst.expressions._
2121
import org.apache.spark.sql.catalyst.expressions.aggregate.Utils
2222
import org.apache.spark.sql.catalyst.plans._
2323
import org.apache.spark.sql.types._
24-
import org.apache.spark.util.collection.OpenHashSet
24+
import scala.collection.mutable.ArrayBuffer
2525

2626
case class Project(projectList: Seq[NamedExpression], child: LogicalPlan) extends UnaryNode {
2727
override def output: Seq[Attribute] = projectList.map(_.toAttribute)
@@ -260,12 +260,12 @@ case class Expand(
260260
* @return the attributes of non selected specified via bitmask (with the bit set to 1)
261261
*/
262262
private def buildNonSelectExprSet(bitmask: Int, exprs: Seq[Expression])
263-
: OpenHashSet[Expression] = {
264-
val set = new OpenHashSet[Expression](2)
263+
: ArrayBuffer[Expression] = {
264+
val set = new ArrayBuffer[Expression](2)
265265

266266
var bit = exprs.length - 1
267267
while (bit >= 0) {
268-
if (((bitmask >> bit) & 1) == 0) set.add(exprs(bit))
268+
if (((bitmask >> bit) & 1) == 0) set += exprs(bit)
269269
bit -= 1
270270
}
271271

@@ -278,14 +278,14 @@ case class Expand(
278278
* are not set for this grouping set (according to the bit mask).
279279
*/
280280
private[this] def expand(): Seq[Seq[Expression]] = {
281-
val result = new scala.collection.mutable.ArrayBuffer[Seq[Expression]]
281+
val result = new ArrayBuffer[Seq[Expression]]
282282

283283
bitmasks.foreach { bitmask =>
284284
// get the non selected grouping attributes according to the bit mask
285285
val nonSelectedGroupExprSet = buildNonSelectExprSet(bitmask, groupByExprs)
286286

287287
val substitution = (child.output :+ gid).map(expr => expr transformDown {
288-
case x: Expression if nonSelectedGroupExprSet.contains(x) =>
288+
case x: Expression if nonSelectedGroupExprSet.exists(_.semanticEquals(x)) =>
289289
// if the input attribute in the Invalid Grouping Expression set of for this group
290290
// replace it with constant null
291291
Literal.create(null, expr.dataType)

0 commit comments

Comments
 (0)