TinyMurky commented on PR #25497:
URL: https://github.com/apache/datafusion/pull/25497#issuecomment-5741245345

   I used this function to test the retained memories
   
   ```rust
   
       /// To calculate how maay bytes per row do 
`OrderSensitiveArrayAggAccumulator` need in different rows per update_batch
       #[test]
       #[ignore = "manual retained-memory measurement"]
       fn report_ordered_array_agg_retained_memory() -> Result<()> {
           use arrow::array::Int64Array;
   
           const TOTAL_ROWS: usize = 2048;
   
           for rows_per_update in [1, 8, 64, TOTAL_ROWS] {
               let mut accumulator = ordered_accumulator(
                   DataType::Int64,
                   DataType::Int64,
                   SortOptions::new(false, false),
                   false, // input is not declared preordered
                   false, // not reversed
               )?;
   
               for offset in (0..TOTAL_ROWS).step_by(rows_per_update) {
                   let len = rows_per_update.min(TOTAL_ROWS - offset);
   
                   let values = (offset..offset + len)
                       .map(|value| value as i64)
                       .collect::<Vec<_>>();
   
                   let payload = Arc::new(Int64Array::from(values)) as ArrayRef;
   
                   accumulator.update_batch(&[Arc::clone(&payload), payload])?;
               }
   
               let total_bytes = accumulator.size();
               let bytes_per_row = total_bytes as f64 / TOTAL_ROWS as f64;
   
               eprintln!(
                   "rows/update={rows_per_update:>4}, \
                  batches={:>4}, \
                  total={total_bytes:>8} B, \
                  bytes/row={bytes_per_row:.2}",
                   accumulator.batches.len(),
               );
           }
   
           Ok(())
       }
   ```


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

Reply via email to