felipepessoto opened a new pull request, #13135:
URL: https://github.com/apache/gluten/pull/13135

   <!--
   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.
   -->
   
   **Depends on #13133.** This branch includes its verified JNI 
throwable-carrier commit (`7e977538f`), followed by the separate native-cast 
commit (`cbae44487`, 13 files). Both head branches are in a fork, so this PR 
targets upstream `main` and its upstream diff is temporarily cumulative until 
the lower PR merges. [Review only the native-cast 
layer](https://github.com/felipepessoto/gluten/compare/felipepessoto-jni-exception-preservation...felipepessoto-native-cast-exceptions).
 No native GitHub stack registration is used for these fork heads.
   
   Translate native-origin cast failures that currently arrive as generic 
`GlutenException`s, targeting the eight scalar/struct-member shapes behind the 
16 ANSI-enabled `ImplicitStreamingMergeCastingSuite` failures.
   
   - At the Velox output boundary, recover original Java throwables first. Only 
then recognize native `USER` / `INVALID_ARGUMENT` errors attributed to a 
built-in `cast` by `ExpressionExceptionProperties`.
   - Carry the separate native reason and diagnostic in a typed 
`NativeCastException`, using UTF-8 byte arrays and the existing `JavaException` 
transport from #13133. There is no string-envelope protocol or exception-class 
reconstruction from stack traces.
   - Extend `ColumnarBatchOutIterator.translateException` with a Spark-package 
helper that calls real `QueryExecutionErrors` factories: numeric narrowing 
becomes `SparkArithmeticException` / `CAST_OVERFLOW`; string-to-integral 
failures become `SparkNumberFormatException` / `CAST_INVALID_INPUT`; decimal 
precision failures use Spark's version-specific `NUMERIC_VALUE_OUT_OF_RANGE` 
factory (`.WITH_SUGGESTION` on Spark 4).
   - Preserve the native diagnostic as the cause and retain schema translation 
and the existing fallback for unrecognized or ambiguous reasons. Recognition 
uses a narrow, type-checked native reason grammar; embedded unescaped string 
delimiters are rejected rather than guessed.
   
   No changes to overflow evaluation, ANSI support, legacy/TRY cast behavior, 
or ARRAY/MAP casts. Original-Java preservation is owned by #13133 rather than 
reimplemented here. Developer documentation explains the native-cast boundary 
and grammar limitation.
   
   ## 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.
   -->
   
   **Executed locally:**
   
   - Compiled the actual new Java carrier, Scala helper, and checked-in 
`GlutenNativeCastExceptionSuite` against real Spark APIs in an isolated JVM 
harness, resolving dependencies through `build/mvn`. All **13 tests passed on 
each of Spark 3.4.4, 3.5.5, 4.0.2, and 4.1.1** (52 passing cases; Scala 
2.12/2.13, JDK 17). These assert exact Spark exception classes, error classes, 
message parameters, SQLSTATE, original-cause identity, UTF-8/NUL handling, and 
unknown/malformed/ambiguous negative controls. No mock Spark exception 
implementations were used.
   - Verified the compiled JNI constructor descriptor `([B[B)V` and 
Java-callable Spark helper descriptor with `javap`.
   - `dev/format-cpp-code.sh` and targeted `clang-format-15 --dry-run 
--Werror`, using clang-format 15.0.7.
   - `dev/format-scala-code.sh` and its `check` mode, scoped to changed 
Java/Scala files with `spotlessFiles`.
   - The actual CI license-header fixer/checker, 
`.github/workflows/util/license-header.py`, on every changed source file; `git 
diff --check` also passed.
   
   **Added but not executed here:** `ColumnarBatchOutIteratorExceptionSuite` 
(iterator-hook/schema/fallback coverage), native cast-attribution and 
legacy/TRY cases in `SparkFunctionTest`, and Velox integration cases covering 
the eight shapes under both LEGACY and ANSI assignment policies plus legacy/TRY 
results in `VeloxCastSuite`.
   
   **Remaining verification:** the native additions, full native/JVM reactor 
builds, and the original **16 Delta streaming tests have not been run**. A 
bounded native configuration attempt reached GCC/CMake/Ninja but stopped 
because the pinned Velox checkout/build dependencies are absent 
(`velox_ep/scripts/setup-helper-functions.sh` is missing). This is not a claim 
that the native build or all 16 streaming cases are green.
   
   On this Windows checkout, the unscoped Scala formatter encounters a 
pre-existing symlink checked out as path text in the Delta sources; scoped 
formatting of this patch passes. The documented `dev/check.py` entrypoint also 
expects the absent `dev/license-header.py`; the repository's actual CI header 
checker was run directly instead. Formatter-only line-ending changes and 
temporary build artifacts were cleaned up before committing.
   
   ## 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.87-0 (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]

Reply via email to