LuciferYang commented on a change in pull request #29689:
URL: https://github.com/apache/spark/pull/29689#discussion_r485370823



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/AttributeSet.scala
##########
@@ -105,10 +105,12 @@ class AttributeSet private (private val baseSet: 
mutable.LinkedHashSet[Attribute
    */
   def --(other: Iterable[NamedExpression]): AttributeSet = {
     other match {
+      // SPARK-32755: `--` method behave differently under scala 2.12 and 2.13,
+      // use a Scala 2.12 based code to maintains the insertion order in Scala 
2.13
       case otherSet: AttributeSet =>
-        new AttributeSet(baseSet -- otherSet.baseSet)
+        new AttributeSet(baseSet.clone() --= otherSet.baseSet)

Review comment:
       `diff` method is defined as `Computes the difference of this set and 
another set`, I haven't tested overall behavior of `diff`, but I think the 
current changes don't look complicated either




----------------------------------------------------------------
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.

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