apache / apache/arrow

[C++][Acero] VAR_ARG does not work for hash aggregate kernels

Open
#41,723 1 comment 0 reactions 1 assignee Claimed by @awalga View on GitHub
Component: C++ Type: bug
Dominant language
C++
Stars
17.1k
Forks
4.3k
Avg merge
3d 13h
Merged PRs (30d)
88

Description

### Describe the bug, including details regarding any error messages, version, and platform.

"uint32: group_id_array" is appended to input_types for hash aggregate kernel/function signature.

This causes two issues :

- function/kernel resolution does not work for functions with var_arg input because Function::DispatchExact fails.
- group_id_array position in ExecBatch becomes kernel dependent (which is less an issue)

Possible solution is to change hash aggregate kernel signature as to have "uint32: group_id_array" at position 0:
```
HashAggregateKernel MakeKernel(InputType argument_type, KernelInit init,
const bool ordered = false) {
return MakeKernel(
KernelSignature::Make({std::move(argument_type), InputType(Type::UINT32)},
OutputType(ResolveGroupOutputType)),
std::move(init), ordered);
}
```
becomes
```
HashAggregateKernel MakeKernel(InputType argument_type, KernelInit init,
const bool ordered = false) {
return MakeKernel(
KernelSignature::Make({InputType(Type::UINT32), std::move(argument_type)},
OutputType(ResolveGroupOutputType)),
std::move(init), ordered);
}
```

An Alternative solution is to change hash aggregate consume signature and avoid transforming original kernel signature:
```
using HashAggregateConsume = Status (*)(KernelContext*, const ExecSpan&);
```
becomes
```
using HashAggregateConsume = Status (*)(KernelContext*, const ExecValue&, const ExecSpan&);
```

### Component(s)

C++

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.