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

   An idea to brainstorm this feature. 
https://github.com/apache/arrow-datafusion/compare/master...milenkovicm:arrow-datafusion:spill_aggregation_to_mmap
 has a POC code which uses a memory mapped file as the aggregation store, which 
should spill to disc in case of memory pressure.  
   
   This solution is just a prototype, far from perfect, and good chance it is 
not fit for purpose.
   
   The main change is that `Vec<RowGroupState>` has been replaced with 
`Vec<u8>`, which is then replaced with mmap file.
   
   Problems with this solution:
   - assumption is that aggregation buffer size will not change. This 
assumption may go away but working with underlying state will get way more 
complicated, as we will need to implement buffer reallocation, eviction ...
   - we don't have control when the data is going to be evicted from memory, we 
can use `lock` and `unlock` on mmap to try to keep it in memory but not sure if 
that would be the case
   
   good point(s):
   - this solution chunks aggregation state in multiple batches when downstream 
producer finishes, thus limiting memory needed to read aggregation state (in 
theory)
   
   no performance numbers at the moment, and not much experience with datafusion
   
   Any comments welcomed 


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