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_r321552557
##########
File path: core/src/test/scala/org/apache/spark/util/UtilsSuite.scala
##########
@@ -924,6 +926,24 @@ class UtilsSuite extends SparkFunSuite with
ResetSystemProperties with Logging {
}
}
+ test("test class ClassCastException") {
Review comment:
> Yes, but you're not testing anything in Spark, so I don't think this is
useful. You're just copying the same code and asserting that it actually still
fails before the change.
>
> Existing tests don't catch this case?
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]