comphead opened a new pull request, #5275:
URL: https://github.com/apache/datafusion-comet/pull/5275

   ## Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and 
enhancements and this helps us generate change logs for our releases. You can 
link an issue to this PR using the GitHub syntax. For example `Closes #123` 
indicates that this PR will close issue #123.
   -->
   
   Closes #5724.
   
   ## Rationale for this change
   
    Make the native library load lazily. The library is only loaded when a code 
path that actually needs JNI executes:
   
     - Remove the static-initializer `load()` call.
     - Add a `protected NativeBase()` constructor that calls a new 
`ensureLoaded()` helper, so `new Native()` (the subclass used by every native 
code path) triggers the load.
     - Make `isLoaded()` call `ensureLoaded()` so 
`CometSparkSessionExtensions.isCometLoaded` (already gated on `COMET_ENABLED` 
etc.) triggers the load only when Comet is confirmed enabled.
     - Change `releaseNative()` to read the `loaded` field directly instead of 
going through `isLoaded()`, so plugin shutdown never lazy-loads a library that 
was never used. Wrap `release()` in try/catch so
     shutdown never propagates.
     - Wrap the two public static native entry points (`isFeatureEnabled`, 
`isObjectStoreSchemeSupported`) so they call `ensureLoaded()` before invoking 
the renamed private native methods `nativeIsFeatureEnabled`
     / `nativeIsObjectStoreSchemeSupported`. This keeps the public API stable 
while avoiding `UnsatisfiedLinkError`.
     - Rename the corresponding JNI symbols in `native/core/src/lib.rs` to 
match.
   
   


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