LuciferYang commented on code in PR #13100:
URL: https://github.com/apache/gluten/pull/13100#discussion_r4110033799
##########
gluten-core/src/main/scala/org/apache/spark/shuffle/ShuffleManagerRegistry.scala:
##########
@@ -32,14 +32,21 @@ class ShuffleManagerRegistry
private[ShuffleManagerRegistry] {
// will take higher precedence during lookup.
def register(lookupKey: LookupKey, shuffleManagerClass: String): Unit = {
val clazz = Utils.classForName(shuffleManagerClass)
- require(
- !clazz.isAssignableFrom(classOf[GlutenShuffleManager]),
- "It's not allowed to register GlutenShuffleManager recursively")
+ // Check the ShuffleManager implementation first, so a class that is not a
+ // ShuffleManager at all (e.g. a non-ShuffleManager supertype of
+ // GlutenShuffleManager) is rejected with the accurate message rather than
+ // the recursion one.
require(
classOf[ShuffleManager].isAssignableFrom(clazz),
s"Shuffle manager class to register is not an implementation of Spark
ShuffleManager: " +
s"$shuffleManagerClass"
)
+ require(
+ !clazz.isAssignableFrom(classOf[GlutenShuffleManager]) &&
+ !classOf[GlutenShuffleManager].isAssignableFrom(clazz),
Review Comment:
Done in 2ee61d039. Extracted a positive boolean
`isGlutenShuffleManagerRelated =
clazz.isAssignableFrom(classOf[GlutenShuffleManager]) ||
classOf[GlutenShuffleManager].isAssignableFrom(clazz)` and require
`!isGlutenShuffleManagerRelated`, so the truth table reads directly.
##########
gluten-core/src/main/scala/org/apache/spark/shuffle/ShuffleManagerRegistry.scala:
##########
@@ -32,14 +32,21 @@ class ShuffleManagerRegistry
private[ShuffleManagerRegistry] {
// will take higher precedence during lookup.
def register(lookupKey: LookupKey, shuffleManagerClass: String): Unit = {
val clazz = Utils.classForName(shuffleManagerClass)
- require(
- !clazz.isAssignableFrom(classOf[GlutenShuffleManager]),
- "It's not allowed to register GlutenShuffleManager recursively")
+ // Check the ShuffleManager implementation first, so a class that is not a
+ // ShuffleManager at all (e.g. a non-ShuffleManager supertype of
+ // GlutenShuffleManager) is rejected with the accurate message rather than
+ // the recursion one.
require(
classOf[ShuffleManager].isAssignableFrom(clazz),
s"Shuffle manager class to register is not an implementation of Spark
ShuffleManager: " +
s"$shuffleManagerClass"
)
+ require(
+ !clazz.isAssignableFrom(classOf[GlutenShuffleManager]) &&
+ !classOf[GlutenShuffleManager].isAssignableFrom(clazz),
+ "It's not allowed to register GlutenShuffleManager or its subtype /
supertype " +
+ "recursively"
Review Comment:
Done in 2ee61d039. The message now spells out what is rejected and why, and
includes the offending class name: "Cannot register GlutenShuffleManager, any
of its subclasses, or a supertype such as the ShuffleManager interface, because
the router would then recurse into itself. Offending class:
$shuffleManagerClass".
--
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]