korowa opened a new issue, #2698: URL: https://github.com/apache/arrow-datafusion/issues/2698
**Is your feature request related to a problem or challenge? Please describe what you are trying to do.** Existing `SortMergeJoin` creates output batches [in following sequence](https://github.com/apache/arrow-datafusion/blob/master/datafusion/core/src/physical_plan/sort_merge_join.rs#L796): 1. push all streamed (outer) records without matches on buffered (inner) side to output 2. push all streamed records with matches 3. push all buffered records without matches (active only in case of Full join) Due to the fact, that batch creation for streamed side is divided into two steps (1 and 2 described above), output sorting after MergeJoin can be random in case of Left/Right joins. **Describe the solution you'd like** The suggestion is to preserve sort order of streamed (logical outer) input - it could be really helpful, because in general non-random ordering could be a nice clue for an optimizer i.e. while choosing between SortAggregation and HashAggregation (not applicable to DF right now, just an example). **Describe alternatives you've considered** Let it be as it is. **Additional context** Add any other context or screenshots about the feature request here. -- 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]
