rich7420 commented on code in PR #7804:
URL: https://github.com/apache/datafusion-comet/pull/7804#discussion_r4758935176
##########
native/core/src/execution/jni_api.rs:
##########
@@ -1641,10 +1640,10 @@ fn execute_plan(
exec_context.stream = Some(stream);
}
exec_context.root_op = Some(root_op);
- } else {
- // Pull input batches
- pull_input_batches(exec_context)?;
}
+ // JVM input is pulled only after a poll returns `Pending`, in
`next_batch` below, never before
+ // the first poll. An operator above a scan, such as a `BatchSplitExec`,
can still hold rows of
+ // the last batch it took, and a limit can finish on them without the JVM
producing another.
Review Comment:
`BatchSplitExec` is still only in #7316. An already-met limit is enough, as
the new test shows. Maybe say that?
##########
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
Review Comment:
On the #7316 perf question: scan + project gets an extra `Pending` per later
`executePlan` call. Any before/after numbers?
--
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]