LuciferYang commented on code in PR #13146:
URL: https://github.com/apache/gluten/pull/13146#discussion_r4130893039


##########
gluten-core/src/main/scala/org/apache/spark/util/SparkReflectionUtil.scala:
##########
@@ -35,6 +37,13 @@ object SparkReflectionUtil {
     } catch {
       case _: ClassNotFoundException =>
         false
+      case e @ (_: NoClassDefFoundError | _: ExceptionInInitializerError) =>
+        // Present but unusable (a version-skewed optional dependency missing 
a supertype,
+        // or a failing static initializer): treat as not present, but log the 
cause so the
+        // skew is diagnosable. Broader linkage errors (VerifyError, 
UnsupportedClassVersionError,
+        // ...) are left to propagate, since they signal a genuinely broken 
build.
+        logWarning(s"Class $className is present but could not be linked; 
treating it as absent", e)

Review Comment:
   These broader linkage errors are left to propagate on purpose. 
`UnsupportedClassVersionError` (a dependency built for a newer JVM) and 
`VerifyError` / `NoSuchMethodError` (bytecode or API skew) signal a genuinely 
broken deployment rather than a merely-absent optional dependency, and I would 
rather surface that than silently disable a backend. Spark's own 
`Utils.classIsLoadable` draws the same line: it is `Try { classForName(...) 
}.isSuccess`, and `Try` catches only `NonFatal`, which excludes `LinkageError`, 
so a linkage failure propagates there too and only `ClassNotFoundException` 
reads as not-loadable. I catch `NoClassDefFoundError` and 
`ExceptionInInitializerError` specifically because those are the normal signals 
of an absent or half-present optional dependency: a missing supertype, or a 
failing static initializer once the probe initializes the class.



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