viirya opened a new issue, #7184:
URL: https://github.com/apache/datafusion-comet/issues/7184
### What is the problem the feature request solves?
`CometNativeUDF.register` validates a native UDF library on the driver
through `CometNativeUdfBridge.validateLibrary`. The native side reports every
failure as `CometError::Internal`, so all of them reach the JVM as
`CometNativeException`. `CometNativeUDF.classifyNativeError` then picks the
exception the caller sees by matching the message text:
- the `spark.comet.nativeUdf.allowedPaths` key, or
`spark.comet.nativeUdf.enabled=false`: `CometNativeUdfNotAllowedException`
- `missing required symbol`, `reports ABI v` or `does not export`:
`CometNativeUdfAbiException`
- `' not found in `: `java.util.NoSuchElementException`
- anything else: `CometNativeUdfLoadException("failed to load <path>:
<message>", cause)`
Its own scaladoc says this is fragile. Rewording a message in `policy.rs`,
`loader.rs` or `comet_native_udf_bridge.rs` changes the exception class a
caller gets. `CometNativeUdfSuite` catches that, but only for the cases it
covers.
Separately, `Java_org_apache_comet_udf_CometNativeUdfBridge_validateLibrary`
is the only `Java_org_apache_comet_*` export that still has its logic inline
instead of in a JNI-free core function, so it cannot be unit tested without a
JVM.
### Describe the potential solution
- Move the logic into a core function with no JNI types in its signature,
and leave the export as a thin wrapper.
- Have native code raise the right exception class directly through the
error protocol, with typed `CometError` variants mapped in `to_exception` and
`typed_jvm_exception`, as `ShuffleSizeLimit` and `IllegalState` are. Then
remove the message matching on the JVM side.
- Keep the exception classes and messages users see unchanged.
### Additional context
_No response_
--
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]