felipepessoto commented on code in PR #13561:
URL: https://github.com/apache/gluten/pull/13561#discussion_r4685558172


##########
cpp/core/jni/JniWrapper.cc:
##########
@@ -451,32 +451,36 @@ JNIEXPORT jboolean JNICALL 
Java_org_apache_gluten_vectorized_ColumnarBatchOutIte
     JNIEnv* env,
     jobject wrapper,
     jlong iterHandle) {
+  const Runtime* outputRuntime = nullptr;
   JNI_METHOD_START
   auto iter = ObjectStore::retrieve<ResultIterator>(iterHandle);
   if (iter == nullptr) {
     std::string errorMessage =
         "When hasNext() is called on a closed iterator, an exception is 
thrown. To prevent this, consider using the protectInvocationFlow() method when 
creating the iterator in scala side. This will allow the hasNext() method to be 
called multiple times without issue.";
     throw GlutenException(errorMessage);
   }
+  outputRuntime = iter->runtime();
   return iter->hasNext();
-  JNI_METHOD_END(false)
+  JNI_METHOD_END_WITH_RUNTIME(false, outputRuntime)

Review Comment:
   Yes. In 1119fd72e, Velox registers how to read 
`VeloxException::wrappedException()` next to its other factories. 
`nativeHasNext` is back to `JNI_METHOD_END(false)`, and `nativeNext` uses the 
ordinary macro too. There’s no longer a change to the runtime API or either 
output call site relative to main.
   
   The shared handler follows registered and standard nested causes, and leaves 
an already-pending Java exception alone. I also checked the actual shared 
libraries: with the same wrapped exception, an ordinary JNI entry used the 
native fallback before Velox initialization and restored the original throwable 
after registration.



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