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



##########
File path: 
mllib/src/main/scala/org/apache/spark/mllib/evaluation/MultilabelMetrics.scala
##########
@@ -178,7 +178,11 @@ private[evaluation] class MultilabelSummarizer extends 
Serializable {
    * @return This MultilabelSummarizer object.
    */
   def add(predictions: Array[Double], labels: Array[Double]): this.type = {
-    val intersection = predictions.intersect(labels)
+    val intersection = if (predictions.isEmpty || labels.isEmpty) {

Review comment:
       In Scala 2.13.5
   ```
   Welcome to Scala 2.13.5 (OpenJDK 64-Bit Server VM, Java 1.8.0_232).
   Type in expressions for evaluation. Or try :help.
   
   scala> Array.empty[Double].intersect(Array(0.0))
   val res0: Array[Double] = Array()
   
   scala> Array(0.0).intersect(Array.empty[Double])
   val res1: Array[Double] = Array()
   ```
   
   but in Scala 2.13.6
   
   ```
   Welcome to Scala 2.13.6 (OpenJDK 64-Bit Server VM, Java 1.8.0_232).
   Type in expressions for evaluation. Or try :help.
   
   scala> Array.empty[Double].intersect(Array(0.0))
   java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [D
     ... 32 elided
   
   scala> Array(0.0).intersect(Array.empty[Double])
   java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [D
     ... 32 elided
   ```
   
   `Array()` is replaced by throw `ClassCastException`, this change is 
uncomfortable ... @dongjoon-hyun @maropu do you think this is a bug of Scala 
2.13.6?
   
   
   




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