`NestedLoopsJoin` memory tracking may be insufficient
- Dominant language
- Rust
- Stars
- 9.3k
- Forks
- 2.4k
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 344
Description
### Is your feature request related to a problem or challenge?
Similarly to https://github.com/apache/arrow-datafusion/issues/7848, @metesynnada noted https://github.com/apache/arrow-datafusion/pull/8020#issuecomment-1903359773 that it is possible for `NestedLoopsJoin` to generate a single (very) large `RecordBatch`. For certain pathalogical queries this may lead to DataFusion far exceeding its memory limits and erroring out
### Describe the solution you'd like
Implement / adapt the same approach as @korowa did in https://github.com/apache/arrow-datafusion/pull/8020 (❤️ ) to incrementally create join output for joins that match many keys rather than doing it all at once.
### Describe alternatives you've considered
_No response_
### Additional context
_No response_
Contributor guide
Research direction
Start by reading the related issue 7848 and pull request 8020, especially the approach for incrementally producing join output. Then trace NestedLoopsJoin to identify where many matching keys create one large RecordBatch; done means join output is produced incrementally without exceeding configured memory limits for pathological queries.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100