Repository navigation
fix: pull JVM input only when the native plan waits for it - #7804
Open
zhangfengcdt wants to merge 3 commits into
Open
zhangfengcdt wants to merge 3 commits into
zhangfengcdt wants to merge 3 commits into
Conversation
rich7420
reviewed
Dec 1, 2026
rich7420
left a comment
Contributor
There was a problem hiding this comment.
@zhangfengcdt thanks for the patch!
Comment on lines
+1644
to
+1646
| // 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. |
Comment on lines
+1303
to
+1304
| /// 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 |
Contributor
There was a problem hiding this comment.
On the #7316 perf question: scan + project gets an extra Pending per later executePlan call. Any before/after numbers?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
No issue. Split out of #7316 at review.
Rationale for this change
execute_planpulls the next JVM batch into every scan before it polls the plan. When a limit is already met by rows from the previous batch, that reads one more batch from the JVM than the query needs, and if reading it fails, the query fails.What changes are included in this PR?
execute_planno longer pulls before polling. It pulls only when a poll returnsPending, whichnext_batchalready handles.How are these changes tested?
New test in
CometExecIteratorLifecycleSuite: a limit of 3 over a scan whose first batch has 10 rows, where reading a second batch throws. It fails before this change and passes with it.