This is an automated email from the ASF dual-hosted git repository.
LuciferYang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gluten.git
The following commit(s) were added to refs/heads/main by this push:
new 3342737a42 [MINOR][CORE] Do not re-wrap GlutenException in
ClosableIterator.translateException (#13148)
3342737a42 is described below
commit 3342737a427bac513dfd5d931ed93619110da215
Author: YangJie <[email protected]>
AuthorDate: Sat Nov 14 03:37:35 2026 -0500
[MINOR][CORE] Do not re-wrap GlutenException in
ClosableIterator.translateException (#13148)
## What changes are proposed in this pull request?
`ClosableIterator.translateException` is the hook subclasses override to
map backend-specific errors into Spark-compatible types. Its default wrapped
every `Exception` in a new `GlutenException`, including a `GlutenException`
already raised by a nested iterator, so those errors got nested one level
deeper on each pass and the doubled message prefix appeared in the surfaced
error. It also left overriding subclasses unable to tell an already-translated
Gluten-level error from a raw back [...]
This passes a `GlutenException` through unchanged and only wraps other
exception types.
## How was this patch tested?
No new test. The earlier dedicated `ClosableIteratorTranslateTest` was
dropped per review, since the change is a small pass-through in
`translateException`.
## Was this patch authored or co-authored using generative AI tooling?
Yes. Generated-by: Claude Opus.
---
.../org/apache/gluten/vectorized/ColumnarBatchOutIterator.java | 7 +++++++
.../src/main/java/org/apache/gluten/iterator/ClosableIterator.java | 6 ++++++
2 files changed, 13 insertions(+)
diff --git
a/gluten-arrow/src/main/java/org/apache/gluten/vectorized/ColumnarBatchOutIterator.java
b/gluten-arrow/src/main/java/org/apache/gluten/vectorized/ColumnarBatchOutIterator.java
index d251371841..08b0814851 100644
---
a/gluten-arrow/src/main/java/org/apache/gluten/vectorized/ColumnarBatchOutIterator.java
+++
b/gluten-arrow/src/main/java/org/apache/gluten/vectorized/ColumnarBatchOutIterator.java
@@ -153,6 +153,13 @@ public class ColumnarBatchOutIterator extends
ClosableIterator<ColumnarBatch>
return schemaEx;
}
}
+ // A GlutenException raised by native/nested code is already translated;
return it
+ // as-is rather than nesting it in another GlutenException. Keep this
after every more
+ // specific translation: a GlutenException subclass that needs its own
translation must
+ // be matched above, or this check returns it untranslated.
+ if (e instanceof GlutenException) {
+ return (GlutenException) e;
+ }
return new GlutenException(e);
}
diff --git
a/gluten-core/src/main/java/org/apache/gluten/iterator/ClosableIterator.java
b/gluten-core/src/main/java/org/apache/gluten/iterator/ClosableIterator.java
index 38764ec024..a15b4e4530 100644
--- a/gluten-core/src/main/java/org/apache/gluten/iterator/ClosableIterator.java
+++ b/gluten-core/src/main/java/org/apache/gluten/iterator/ClosableIterator.java
@@ -69,6 +69,12 @@ public abstract class ClosableIterator<T> implements
AutoCloseable, Serializable
* to translate backend-specific exceptions into Spark-compatible exceptions.
*/
protected RuntimeException translateException(Exception e) {
+ // A GlutenException raised by a nested iterator is already translated;
+ // re-wrapping loses the flat type and prevents subclasses overriding this
+ // method from distinguishing backend errors from lifecycle errors.
+ if (e instanceof GlutenException) {
+ return (GlutenException) e;
+ }
return new GlutenException(e);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]