adriangb commented on PR #27938: URL: https://github.com/apache/datafusion/pull/27938#issuecomment-7361028037
Thanks for working on this! Before going further, I'd like to check where the size actually comes from. I ran the slt query on main with some logging in the spill writer. Each spill file had only one chunk, so the dictionary isn't being resent. The batch itself is just big. Each `ARRAY_AGG` state batch had a dictionary with all ~50k distinct input values, but only ~12.5k (about 1/4, one per partition) were referenced. My guess is that `interleave` in `ArrayAggGroupsAccumulator::evaluate` concatenates the source dictionaries without pruning them. `should_compact` then keeps the dictionary because values repeat many times within each group. The query also hit `ResourcesExhausted` on replay, so the in-memory state seems inflated too, not just the spill. Could you check if you see the same thing? If so, I think it'd be better to prune the dictionary in the accumulator after `interleave`, or to base `should_compact` on how many values are actually referenced. Either would fix the memory side as well. -- 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]
