ShashidharM0118 opened a new pull request, #19073: URL: https://github.com/apache/datafusion/pull/19073
## Which issue does this PR close? - Closes **#18595** ## Rationale for this change Aggregate planning was repartitioning **tiny datasets**, leading to **unnecessary cost** for lightweight queries and occasionally causing **empty results** in TPCH-style tests. The planner now uses statistics to **keep small inputs in single-partition mode** when there aren't enough rows to benefit from the overhead of repartitioning, thus avoiding this performance drain. ## What changes are included in this PR? * Added the function `has_sufficient_rows_for_repartition(...)` in `datafusion/core/src/physical_planner.rs`. * Wired this check into the aggregate planning branch to only build `AggregateMode::FinalPartitioned` when $num\_rows \geq batch\_size$. * Extended planner coverage with tests (e.g., `hash_agg_small_dataset_single_mode`) and dataframe insta snapshots to assert the new single-mode plan and its explain output. * Regenerated all affected SQL logic suites (e.g., aggregate, group\_by, tpch) to reflect the planning change. * Marked an encrypted parquet test query as `rowsort` ## Are these changes tested? **Yes.** ## Are there any user-facing changes? **Yes.** -- 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]
