mbutrovich commented on PR #20482:
URL: https://github.com/apache/datafusion/pull/20482#issuecomment-3945882604
I'm still trying to page this state machine back into memory since it's been
a few months. My first pass mostly makes me wonder about a performance
optimization:
I think the `EmitReady { next_state: Box<SortMergeJoinState> }` adds a heap
allocation on every group boundary. But looking at the current code, the only
`next_state` ever used is `Init`. Could we add the completed-batch flush
directly in the `scanning_finished()` branch?
```rust
if self.buffered_data.scanning_finished() {
self.buffered_data.scanning_reset();
// Flush any completed batch before going to Init
if !needs_deferred_filtering(...) {
if self.joined_record_batches.joined_batches.has_completed_batch() {
// return it
}
}
self.state = SortMergeJoinState::Init;
}
```
--
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]