What is the problem the feature request solves?
If the upstream operator of HashAggregate is sorted, HashAggregate will try to emit first groups if possible. Our custom SumDecimalGroupsAccumulator doesn't support Emit::First. So if Sort is followed by HashAggregate and there is sum of decimal, the query will fail with:
at std::backtrace::Backtrace::create(__internal__:0)
at comet::errors::init::{{closure}}(__internal__:0)
at std::panicking::rust_panic_with_hook(__internal__:0)
at std::panicking::begin_panic_handler::{{closure}}(__internal__:0)
at std::sys_common::backtrace::__rust_end_short_backtrace(__internal__:0)
at _rust_begin_unwind(__internal__:0)
at core::panicking::panic_fmt(__internal__:0)
at <comet::execution::datafusion::expressions::sum_decimal::SumDecimalGroupsAccumulator as datafusion_physical_expr::aggregate::groups_accumulator::GroupsAccumulator>::state(__internal__:0)
at datafusion_physical_plan::aggregates::row_hash::GroupedHashAggregateStream::emit(__internal__:0)
at <datafusion_physical_plan::aggregates::row_hash::GroupedHashAggregateStream as futures_core::stream::Stream>::poll_next(__internal__:0)
at <datafusion_physical_plan::aggregates::row_hash::GroupedHashAggregateStream as futures_core::stream::Stream>::poll_next(__internal__:0)
at <datafusion_physical_plan::projection::ProjectionStream as futures_core::stream::Stream>::poll_next(__internal__:0)
at std::panicking::try::do_call(__internal__:0)
at _Java_org_apache_comet_Native_executePlan(__internal__:0)
Describe the potential solution
Support Emit::First for SumDecimalGroupsAccumulator
Additional context
No response
What is the problem the feature request solves?
If the upstream operator of
HashAggregateis sorted,HashAggregatewill try to emit first groups if possible. Our customSumDecimalGroupsAccumulatordoesn't supportEmit::First. So ifSortis followed byHashAggregateand there is sum of decimal, the query will fail with:Describe the potential solution
Support Emit::First for SumDecimalGroupsAccumulator
Additional context
No response