Kristofferjoha opened a new issue, #26901: URL: https://github.com/apache/datafusion/issues/26901
Following #26592, I'd like to discuss the design before attempting another implementation. I should have discussed the approach before opening the PR. Sorry about that. ### Proposed approach The main issue I'm trying to address is that `AsOfJoinExec` currently collects the entire right input into memory. This means ASOF joins can run out of memory on large right inputs, even when the upstream sorts can spill. My idea was to use hash-partitioned execution when equality keys are present. Then i could just sort each partition according to the ordering required by the join and have each left partition stream its corresponding right partition instead of collecting and broadcasting the complete right input. Since `InputCursor` already advances through the right input, I thought this could reuse much of the existing join logic while removing the need to materialize the complete right side. The join would still need memory for its active batches, candidate matches, and pending output rows, but it would no longer need to collect the entire right input. ### Tradeoffs Hash-partitioning both inputs adds work compared to the existing broadcast approach. If most rows share the same equality key, one partition can end up doing most of the work. In my benchmarks, partitioned execution was nearly twice as slow for skewed keys. ### Alternatives Another possibility would be to make the existing right-input collection spillable. However, this would still require merging the right input into a single stream, and each left partition could end up rereading the spilled data. I think supporting both broadcast and partitioned execution could make sense, depending on input size and key distribution ### Additional context The comment about my PR mentions proto and config as changes i made, highlighting them as something bad. Are we not allowed to @Xuanwo implemented the original ASOF joins, so i'd appreciate his perspective on this. I noticed he hasnt been active on DataFusion recently, so I'm not sure if he will see this. @jayzhan211 @alamb I'd also appreciate your thoughts on the design and on how i should approach it. One thing I was also wondering about is the mention of config and proto changes in the feedback on my PR. Are these generally changes I should avoid making, or was the concern more about how many parts of DataFusion the PR touched without discussing the design first? -- 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]
