Copilot commented on code in PR #13148:
URL: https://github.com/apache/gluten/pull/13148#discussion_r4344896808


##########
gluten-core/src/main/java/org/apache/gluten/iterator/ClosableIterator.java:
##########
@@ -69,6 +69,12 @@ public final void close() {
    * 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);
   }

Review Comment:
   This changes the exception translation contract (pass-through for 
`GlutenException` instead of always wrapping). Adding a small regression test 
would help prevent reintroducing nested `GlutenException` behavior and should 
cover both paths: (1) `translateException(new GlutenException(...))` returns 
the same instance, and (2) `translateException(new Exception(...))` returns a 
`GlutenException` wrapping the original.



##########
gluten-arrow/src/main/java/org/apache/gluten/vectorized/ColumnarBatchOutIterator.java:
##########
@@ -153,6 +153,13 @@ protected RuntimeException translateException(Exception e) 
{
         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);

Review Comment:
   This duplicates the default wrapping/pass-through logic that now exists in 
`ClosableIterator.translateException`. To keep behavior consistent across 
iterators and reduce drift, consider replacing the `GlutenException` check + 
`new GlutenException(e)` with a single `return super.translateException(e);` 
after the more-specific translations.



-- 
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