Light-City opened a new issue, #35863:
URL: https://github.com/apache/arrow/issues/35863
### Describe the enhancement requested
## 1.our problem
we have a kernel, input is struct array, such as struct<sum, count>, When
registering the kernel, in order to distinguish between `struct<decimal128,
int64>` and `struct<decimal256. int64>` (means: sum column is decimal128 or
decimal256), we need to use TypeMatcher to match one.
for example:
```cpp
Status Visit(const Decimal128Type&) {
kernel = MakeKernel(std::move(InputType(match::AvgFinalDecimal128(),
ValueDescr::ARRAY)),
AvgSumInit<GroupedAvgFinalImpl<Decimal128Type>>);
return Status::OK();
}
Status Visit(const Decimal256Type&) {
kernel = MakeKernel(std::move(InputType(match::AvgFinalDecimal256(),
ValueDescr::ARRAY)),
AvgSumInit<GroupedAvgFinalImpl<Decimal256Type>>);
return Status::OK();
}
```
Take `AvgFinalDecimal128` for example:
```cpp
class AvgFinalDecimal128Matcher : public TypeMatcher {
public:
AvgFinalDecimal128Matcher() {}
bool Matches(const DataType& type) const override {
if (type.id() != Type::STRUCT) {
return false;
}
return (type.fields()[0])->type()->id() == Type::DECIMAL128;
}
//......
}
```
In the current code, we need to write two matchers. In fact, we can simplify
it to a matcher (the input is a struct input by the user), but currently
TypeMatcher does not support input. The constructor is as follows:
```
InputType(std::shared_ptr<TypeMatcher> type_matcher) {}
```
It does not support passing parameters, so will it be possible to support
extended parameters in the future?
### Component(s)
C++
--
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]