mbutrovich commented on code in PR #21484:
URL: https://github.com/apache/datafusion/pull/21484#discussion_r3053896553


##########
datafusion/physical-plan/src/joins/piecewise_merge_join/classic_join.rs:
##########
@@ -460,6 +460,14 @@ fn resolve_classic_join(
     let buffered_len = buffered_side.buffered_data.values().len();
     let stream_values = stream_batch.compare_key_values();
 
+    // Build comparator once for the batch pair
+    let cmp = JoinKeyComparator::new(

Review Comment:
   Note: piecewise merge join rebuilds the `JoinKeyComparator` on each 
`resolve_classic_join` re-entry (when output exceeds batch size mid-scan), even 
though the batch pair hasn't changed. Could lift it to `ClassicPWMJStream` and 
rebuild only in `fetch_stream_batch`, but the cost is one `make_comparator` 
call per ~8192 rows of output, so probably not worth the added lifecycle 
coupling. Left as-is for now.



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