liuzqt commented on code in PR #38064:
URL: https://github.com/apache/spark/pull/38064#discussion_r994897386


##########
core/src/test/scala/org/apache/spark/scheduler/TaskSchedulerImplSuite.scala:
##########
@@ -761,11 +761,13 @@ class TaskSchedulerImplSuite extends SparkFunSuite with 
LocalSparkContext
         }
         // End the other task of the taskset, doesn't matter whether it 
succeeds or fails.
         val otherTask = tasks(1)
-        val result = new 
DirectTaskResult[Int](valueSer.serialize(otherTask.taskId), Seq(), Array())
+        val result = new 
DirectTaskResult[Int](valueSer.serialize(otherTask.taskId), Seq(),
+          Array[Long]())
         tsm.handleSuccessfulTask(otherTask.taskId, result)
       } else {
         tasks.foreach { task =>
-          val result = new 
DirectTaskResult[Int](valueSer.serialize(task.taskId), Seq(), Array())
+          val result = new 
DirectTaskResult[Int](valueSer.serialize(task.taskId), Seq(),
+            Array[Long]())

Review Comment:
   If I remove `[Long]`, will get a compile error:
   ```
   overloaded method constructor DirectTaskResult with alternatives:
     (valueByteBuffer: java.nio.ByteBuffer,accumUpdates: 
Seq[org.apache.spark.util.AccumulatorV2[_, _]],metricPeaks: 
Array[Long])org.apache.spark.scheduler.DirectTaskResult[Int] <and>
     (valueByteBuffer: org.apache.spark.util.io.ChunkedByteBuffer,accumUpdates: 
Seq[org.apache.spark.util.AccumulatorV2[_, _]],metricPeaks: 
Array[Long])org.apache.spark.scheduler.DirectTaskResult[Int]
    cannot be applied to (java.nio.ByteBuffer, Seq[Nothing], Array[Nothing])
             val result = new 
DirectTaskResult[Int](valueSer.serialize(task.taskId), Seq(),
   
   ```
   The compiler somehow failed to infer the type. This happened after I added 
the overloaded constructor in `DirectTaskResult`.
   
   My guessing is that overloading has to be resolved before type constraints 
can be determined for each parameter, those that drive type inference but 
overloading resolution can't happen without knowing the types of each 
parameter.....I haven't figured out a way to solve this



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

To unsubscribe, e-mail: [email protected]

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