alamb commented on issue #1570:
URL: 
https://github.com/apache/arrow-datafusion/issues/1570#issuecomment-1245882229

   Thanks for the info @milenkovicm 
   
   In general I think database systems tend to try and shy away from using mmap 
for spilling operations, for the reasons very clearly articulated in "Are You 
Sure You Want to Use MMAP in Your Database Management System?" 
https://db.cs.cmu.edu/mmap-cidr2022/
   
   I think the current state of the art / best practice for dealing with 
grouping when the hashtable doesn't fit in memory is to:
   1. Sort the data by groups and write that data to a spill file (ideally 
sharing / reusing the code used for externalized sort)
   2. Create a new hash table,  spilling repeatedly if needed
   3. When all the input has been processed, then the spill files are read back 
and merged (again sharing code for externalized sort) and a merge group by is 
performed.
   
   Thanks to @yjshen  we have much of the spilling / merging code already. We 
are lacking:
   - [ ] merge group by (where the groups are guaranteed to be contiguous in 
the input stream)
   - [ ] The orchestration logic to spill and then re-merge
   
   Does that make sense? I know it is a high level description
   
   


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

Reply via email to