Repository navigation
[VL] Translate native cast failures into Spark exceptions - #13135
Draft
felipepessoto wants to merge 6 commits into
Draft
felipepessoto wants to merge 6 commits into
felipepessoto wants to merge 6 commits into
Conversation
|
Run Gluten Clickhouse CI on x86 |
|
Run Gluten Clickhouse CI on x86 |
3 similar comments
|
Run Gluten Clickhouse CI on x86 |
|
Run Gluten Clickhouse CI on x86 |
|
Run Gluten Clickhouse CI on x86 |
felipepessoto
force-pushed
the
felipepessoto-native-cast-exceptions
branch
from
October 30, 2026 22:54
974370b to
51a5bf0
Compare
|
Run Gluten Clickhouse CI on x86 |
2 similar comments
|
Run Gluten Clickhouse CI on x86 |
|
Run Gluten Clickhouse CI on x86 |
|
Run Gluten Clickhouse CI on x86 |
This was referenced Nov 6, 2026
felipepessoto
force-pushed
the
felipepessoto-native-cast-exceptions
branch
from
November 6, 2026 21:19
25484ef to
c413b20
Compare
|
Run Gluten Clickhouse CI on x86 |
This was referenced Nov 14, 2026
felipepessoto
force-pushed
the
felipepessoto-native-cast-exceptions
branch
from
November 14, 2026 21:32
c413b20 to
1dbf175
Compare
|
Run Gluten Clickhouse CI on x86 |
Contributor
Author
|
/delta-test |
|
🔄 Delta Spark UT started by @felipepessoto (~2.5 h). View run |
|
Run Gluten Clickhouse CI on x86 |
1 similar comment
|
Run Gluten Clickhouse CI on x86 |
felipepessoto
force-pushed
the
felipepessoto-native-cast-exceptions
branch
from
November 27, 2026 00:35
96e0b3c to
a70432d
Compare
|
Run Gluten Clickhouse CI on x86 |
1 similar comment
|
Run Gluten Clickhouse CI on x86 |
|
Run Gluten Clickhouse CI on x86 |
…the JNI boundary Add JniExceptionMetadataRegistration, a scoped backend callback that describes a native exception as a Java class name, a reason and a diagnostic. JNI_METHOD_END asks it only when no Java exception is pending or carried, then constructs the class through its (byte[] reason, byte[] diagnostic) constructor after releasing the registry lock. A Java exception raised while constructing it stays pending; other failures keep the GlutenException fallback. The unwrapper registration keeps its API and behavior and shares the same null, duplicate and lifetime checks. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
felipepessoto
force-pushed
the
felipepessoto-native-cast-exceptions
branch
from
November 27, 2026 05:56
99bc1f0 to
2aeda77
Compare
|
Run Gluten Clickhouse CI on x86 |
…class A provider exception that isn't a std::exception no longer escapes the JNI boundary. It is logged, and the boundary keeps a pending Java throwable or otherwise the GlutenException fallback with the original diagnostic. The boundary also checks that the described class extends java.lang.Throwable before running its constructor or JNI Throw, and keeps the same fallback when it doesn't. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Velox registers a JNI exception metadata provider for USER/INVALID_ARGUMENT errors that ExpressionExceptionProperties attribute to a built-in cast, so the JNI boundary raises NativeCastException with the native reason and diagnostic. ColumnarBatchOutIterator maps recognized overflow, decimal precision and string-to-integral reasons to Spark's QueryExecutionErrors exceptions, with the native error as the cause. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…h Catalyst Return Spark exceptions from nested native iterators unchanged, so a cast error raised before a shuffle stays the task's top-level exception and Spark 4 reports it instead of "Job aborted". Describe only reasons that start with "Cannot cast ", so other errors raised while a cast runs, such as lazily loading its input, keep the default handling. Tests take their expected errors from Catalyst's ANSI cast and now run REAL sources, infinities, exponent and negative values, integral to decimal, and each integral string target natively. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Only attach CAST_INVALID_INPUT when the parser for the reported target rejects the value. Preserve other native failures and distinguish unescaped target headers from ordinary quoted text. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
felipepessoto
force-pushed
the
felipepessoto-native-cast-exceptions
branch
from
November 27, 2026 07:08
2aeda77 to
bf54454
Compare
|
Run Gluten Clickhouse CI on x86 |
Delta shard 4 passed these multiple-match cases and reported no regressions. Replaying all eight hosted shard reports passes the strict gate with the five stale entries removed. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Run Gluten Clickhouse CI on x86 |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
96ea0d644590d7cc98008ec61b6a4ccf85814efd↑ The only change since the last hosted run removes five now-passing entries; all eight archived shards pass the strict gate with the updated baseline.
↓ Classification still depends on Velox’s reason format, and cast errors lack SQL query context.
↑ The prior mapper mislabeled valid Spark inputs and missed an ordinary quoted string; both regression tests failed before the fix.
↓ The fresh hosted run has not finished on this revision.
What changes are proposed in this pull request?
Depends on #13822. Velox identifies failures from built-in casts at the JNI return boundary. Gluten translates recognized overflow, decimal precision, and invalid string inputs into Spark exceptions with the native diagnostic as the cause. It preserves translated exceptions across nested iterators so Spark 4 can report them even before a shuffle.
For string-to-integral failures, Gluten uses Spark’s exact parser for the target type. If Spark accepts the value, the native failure stays visible rather than becoming
CAST_INVALID_INPUT. Ordinary quoted text such asbad' to sleepis preserved; ambiguous target delimiters are not interpreted. Cast evaluation, legacy and TRY behavior are unchanged. Velox does not supply SQL query context.How was this patch tested?
-Xcheck:jni), 23 Velox suite tests and 17 mapper tests. The mapper suite also passed on Spark 3.4, 4.0 and 4.2.bad' to sleepmatched Catalyst’s error, and a genuinely ambiguous input stayed untranslated.Was this patch authored or co-authored using generative AI tooling?
Generated-by: GitHub Copilot 1.0.106-8.unstable.r43360710077.gff3c476 (GPT-6 Astra, model ID: gpt-6-astra)
Generated-by: GitHub Copilot 1.0.115-7 (GPT-6.2 Astra, model ID: gpt-6.2-astra)
Generated-by: GitHub Copilot 1.0.115-7 (Claude Opus 5.5, model ID: claude-opus-5.5)