felipepessoto opened a new pull request, #13560:
URL: https://github.com/apache/gluten/pull/13560
<!--
Thank you for submitting a pull request! Here are some tips:
1. For first-time contributors, please read our contributing guide:
https://github.com/apache/gluten/blob/main/CONTRIBUTING.md
2. If necessary, create a GitHub issue for discussion beforehand to avoid
duplicate work.
3. If the PR is specific to a single backend, include [VL] or [CH] in the PR
title to indicate the
Velox or ClickHouse backend, respectively.
4. If the PR is not ready for review, please mark it as a draft.
-->
## What changes are proposed in this pull request?
<!--
Provide a clear and concise description of the changes introduced in this PR.
Ensure the PR description aligns with the code changes, especially after
updates.
If applicable, include "Fixes #<GitHub_Issue_ID>" to automatically close the
corresponding issue
when the PR is merged.
-->
Relates to #13133. This is **layer 1 of the three-PR split**, containing
only backend-neutral JNI exception transport. It remains a draft while the
replacement layers are prepared; the source PR is not closed or modified by
this split.
- Introduce `gluten::JavaException`, retaining the original Java throwable
in shared global-reference state across copies, `std::exception_ptr`, and
thread boundaries. Final cleanup uses the current thread's JNI environment and
detaches only a thread it attached itself.
- Capture the throwable before best-effort diagnostic construction.
Diagnostic failures, including native allocation failure, do not replace the
captured throwable; a pending Java allocation error is retained if creating the
global reference fails.
- Delegate `checkException` to the carrier and restore direct or standard
nested Java carriers through `JNI_METHOD_END`. Native-only errors retain the
existing `GlutenException` fallback.
- Register the carrier in the existing `gluten_core_impl` object library and
add lifetime, thread-cleanup, nesting, and allocation-failure coverage. The
replacement-allocator regression is a separate executable so it cannot affect
other core tests.
- Document the core contract and its limits. Preserving the original Java
stack does **not** implement hybrid Java/C++ stack merging from #9642.
The nine core implementation/build/test files are extracted unchanged from
source head `b25dc154cab6e5df33ad8f65465cc15e3b89dbd8`, on the selected current
`main` base. Documentation is restricted to this layer. There are no Velox
changes, memory-callback propagation changes, Spark/Delta integration suites or
profile wiring, Delta failure-list changes, cast classification, or
partition-materialization changes. In particular, this first layer does not by
itself protect the full Velox driver path or establish that Delta native writes
preserve their exceptions; those depend on the later layers.
## How was this patch tested?
<!--
Describe how the changes were tested, if applicable.
Include new tests to validate the functionality, if necessary.
For UI-related changes, attach screenshots to demonstrate the updates.
-->
All checks below used this layer's source, not a prebuilt library from the
full implementation:
- **10 focused core tests passed**, compiled with GCC 13.3, C++20, `-Wall
-Wextra -Werror`, JNI headers and gtest/glog: nine cases in
`java_exception_test` and one in the isolated `java_exception_allocation_test`
executable.
- **Fresh native core CMake build passed** in the cached
`apache/gluten:centos-9-jdk17` image using GCC 12.2.1: configured the
repository's `cpp` project with `BUILD_VELOX_BACKEND=OFF` and
`BUILD_TESTS=OFF`, then ran `cmake --build <fresh-build> --target gluten -j4`.
This compiled the actual `gluten_core_impl` and linked `libgluten.so`; cached
third-party dependencies and the cached Velox compiler-flags helper were
read-only.
- **504 additional real-JVM round trips passed** with JDK 17 and
`-Xcheck:jni`, using a newly compiled carrier/standalone JNI bridge. The smoke
check verifies throwable identity, class, cause, suppressed exception, Java
stack, and synthetic structured metadata, including caller/attached-worker
paths, concurrent calls, a failing describer, and normal returns.
- `dev/format-cpp-code.sh` with clang-format **15.0.7**, a strict dry-run of
all seven changed C++ files, `cmake-format --first-comment-is-literal True
--check` separately for both changed CMake files,
`.github/workflows/util/check.py header main --fix` followed by its read-only
check, and `git diff --check` all passed. Windows-host script execution used
WSL with CRLF-safe copies where needed.
The full Velox backend, Spark/Delta integration suites, and remote CI were
not rerun or awaited for this core-only layer. The focused gtests were built
separately; the fresh native CMake build did not enable the full CTest suite.
## Was this patch authored or co-authored using generative AI tooling?
<!--
If generative AI tooling has been used in the process of authoring this
patch, please include the
phrase: 'Generated-by: ' followed by the name of the tool and its version.
If no, write 'No'.
Please refer to the [ASF Generative Tooling
Guidance](https://www.apache.org/legal/generative-tooling.html) for details.
-->
Generated-by: GitHub Copilot 1.0.102-0.unstable.r40949665530.gab1eef5
(model: gpt-6-astra)
--
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]