cloud-fan commented on a change in pull request #32577:
URL: https://github.com/apache/spark/pull/32577#discussion_r636108150



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/sources/filters.scala
##########
@@ -174,7 +174,8 @@ case class In(attribute: String, values: Array[Any]) 
extends Filter {
     case _ => false
   }
   override def toString: String = {
-    s"In($attribute, [${values.mkString(",")}])"
+    // Sort elements for deterministic behaviours
+    s"In($attribute, [${values.map(_.toString).sorted.mkString(",")}])"

Review comment:
       `_.toString` is not null safe, while `Seq(null).mkString` is fine. I 
think we should use `String.valueOf`

##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/sources/filters.scala
##########
@@ -174,7 +174,8 @@ case class In(attribute: String, values: Array[Any]) 
extends Filter {
     case _ => false
   }
   override def toString: String = {
-    s"In($attribute, [${values.mkString(",")}])"
+    // Sort elements for deterministic behaviours
+    s"In($attribute, [${values.map(_.toString).sorted.mkString(",")}])"

Review comment:
       `_.toString` is not null safe, while `Seq(null).mkString` is fine. I 
think we should use `String.valueOf`




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