dongjoon-hyun commented on a change in pull request #32648:
URL: https://github.com/apache/spark/pull/32648#discussion_r638518735



##########
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:
       As @LuciferYang mentioned at the Scala community, I also confirmed that 
only Scala 2.13.6 has this bug unlike Scala 2.13.5/3.0.0.
   
   ```
   scala3-3.0.0:$ bin/scala
   scala> Array.empty[Double].intersect(Array(0.0))
   val res0: Array[Double] = Array()
   
   scala-2.13.6:$ bin/scala
   Welcome to Scala 2.13.6 (OpenJDK 64-Bit Server VM, Java 1.8.0_292).
   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
   ```
   
   




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