zhangfengcdt commented on code in PR #7804:
URL: https://github.com/apache/datafusion-comet/pull/7804#discussion_r4762908799


##########
native/core/src/execution/jni_api.rs:
##########
@@ -1300,12 +1300,11 @@ unsafe fn export_batch(
     Ok(num_rows as i64)
 }
 
-/// Pull the next input from JVM. Note that we cannot pull input batches in
-/// `ScanStream.poll_next` when the execution stream is polled for output.
-/// Because the input source could be another native execution stream, which
-/// will be executed in another tokio blocking thread. It causes JNI throw
-/// Java exception. So we pull input batches here and insert them into scan
-/// operators before polling the stream,
+/// Pulls the next batch from the JVM into every JVM-fed scan whose slot is 
empty. `next_batch`
+/// calls it only after a poll of the stream returns `Pending`. It cannot run 
inside
+/// `ScanStream.poll_next`, because the input source can be another native 
execution stream
+/// running on another tokio blocking thread, and calling into it from there 
makes JNI throw.
+/// With two JVM inputs, a poll waiting on one also refills the other if its 
slot is empty.
 #[inline]

Review Comment:
   Thanks, @comphead, for the review and I just made a change so that a scan 
can indicate it wants input when a poll finds its slot empty, and 
pull_input_batches refills only those scans.  
   
   This new test: hash_join_wants_only_the_input_it_waits_on should capture 
this case now.
   
   This should fix the join pin scenarios described above.
   



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