Skip to content

[CORE] Preserve original Java exceptions across JNI boundary#11943

Open
acvictor wants to merge 1 commit intoapache:mainfrom
acvictor:acvictor/exceptionHandling
Open

[CORE] Preserve original Java exceptions across JNI boundary#11943
acvictor wants to merge 1 commit intoapache:mainfrom
acvictor:acvictor/exceptionHandling

Conversation

@acvictor
Copy link
Copy Markdown
Contributor

@acvictor acvictor commented Apr 15, 2026

What changes are proposed in this pull request?

Java-side exceptions thrown during native callbacks (e.g. SparkRuntimeException) were serialized to strings and rethrown as GlutenException, losing the original exception type and error condition codes.

This PR adds JniPendingException to carry the original jthrowable through C++ code, with a thread local fallback for when Velox's internal handlers (Driver.cpp CALL_OPERATOR, Expr.cpp) rewrap the C++ exception as VeloxRuntimeError. JNI_METHOD_END recovers the original throwable from either path and rethrows it via env->Throw(). Java-side translateException() is updated to preserve non GlutenException RuntimeExceptions.

How was this patch tested?

Added UTs

Was this patch authored or co-authored using generative AI tooling?

Assisted-by: GitHub Copilot 1.0.18

Related issue #11912

@github-actions github-actions Bot added CORE works for Gluten Core VELOX labels Apr 15, 2026
@github-actions
Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@acvictor acvictor force-pushed the acvictor/exceptionHandling branch from 9958a43 to 266012f Compare April 15, 2026 10:05
@github-actions
Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@acvictor acvictor force-pushed the acvictor/exceptionHandling branch from 266012f to b84d9e2 Compare April 15, 2026 10:07
@github-actions
Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@acvictor acvictor force-pushed the acvictor/exceptionHandling branch from b84d9e2 to fade37b Compare April 15, 2026 10:09
@github-actions
Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@acvictor acvictor force-pushed the acvictor/exceptionHandling branch from fade37b to e85baad Compare April 15, 2026 10:15
@github-actions
Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@acvictor acvictor force-pushed the acvictor/exceptionHandling branch from e85baad to 4bc88d1 Compare April 15, 2026 10:26
@github-actions
Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@acvictor acvictor force-pushed the acvictor/exceptionHandling branch from 4bc88d1 to eb426fb Compare April 15, 2026 11:09
@github-actions
Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@acvictor acvictor force-pushed the acvictor/exceptionHandling branch from eb426fb to ab0959d Compare April 15, 2026 13:45
@github-actions
Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@acvictor acvictor marked this pull request as ready for review April 15, 2026 16:42
@acvictor acvictor requested review from baibaichen and marin-ma April 15, 2026 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CORE works for Gluten Core VELOX

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant