felipepessoto commented on code in PR #13386:
URL: https://github.com/apache/gluten/pull/13386#discussion_r4650673089


##########
backends-velox/src-delta4/main/scala/org/apache/spark/sql/delta/GlutenDeltaNativeWriteGate.scala:
##########
@@ -220,6 +245,14 @@ object GlutenDeltaNativeWriteGate {
 
   private def lower(key: String): String = key.toLowerCase(Locale.ROOT)
 
+  // Fails closed: if the native probe cannot run in this JVM, the write falls 
back.
+  private def registeredInVelox(path: String): Boolean =
+    try {
+      
VeloxFileSystemValidationJniWrapper.allSupportedByRegisteredFileSystems(Array(path))
+    } catch {
+      case _: LinkageError | NonFatal(_) => false

Review Comment:
   Could we keep the fallback but distinguish a failed JNI call from a negative 
registry result? A JAR/native-library mismatch can throw `UnsatisfiedLinkError` 
here even for `file:`. Returning `false` then makes the log say the local 
filesystem is missing from the build.
   
   I'd let `registeredInVelox` call JNI directly and move the catch into the 
allowed-scheme branch of `unsupportedPath`:
   
   ```scala
   try {
     Option.when(!registered(path.toString)) {
       s"The Velox filesystem for scheme ${scheme.get} is not available in this 
build"
     }
   } catch {
     case e @ (_: LinkageError | NonFatal(_)) =>
       Some(s"Could not check Velox filesystem registration for scheme 
${scheme.get}: $e")
   }
   ```
   
   Both cases still use Delta's writer, and the transaction's existing log 
records why.



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