hddong commented on a change in pull request #25389: [SPARK-28657][CORE] Fix 
currentContext Instance failed sometimes
URL: https://github.com/apache/spark/pull/25389#discussion_r321562585
 
 

 ##########
 File path: core/src/main/scala/org/apache/spark/util/Utils.scala
 ##########
 @@ -2991,7 +2991,7 @@ private[spark] class CallerContext(
     if (CallerContext.callerContextSupported) {
       try {
         val callerContext = 
Utils.classForName("org.apache.hadoop.ipc.CallerContext")
-        val builder = 
Utils.classForName("org.apache.hadoop.ipc.CallerContext$Builder")
+        val builder: Class[_] = 
Utils.classForName("org.apache.hadoop.ipc.CallerContext$Builder")
 
 Review comment:
   > OK, that's odd, but without a generic type we should see the same thing in 
many places. I can't see why this one behaves differently. Maybe so, but I'm 
worried the cause is actually different.
   
   I try to read some use of `Utils.classForName`,  and I found there are about 
two usage scenarios: 
   1. load class and not need to `getConstructor().newInstance()`
   2. need to `getConstructor().newInstance()` or `getMethods`.
   
   In second case, usually use ` :Class[_]` or write as 
`Utils.classForName[class]`.
   
   Some of the uses are as follows:
   
https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/CallMethodViaReflection.scala#L151,L153
   
   
https://github.com/apache/spark/blob/master/core/src/test/scala/org/apache/spark/scheduler/TaskResultGetterSuite.scala#L191
   
   
https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/types/DataType.scala#L184,L185

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to