Light-City commented on issue #35863:
URL: https://github.com/apache/arrow/issues/35863#issuecomment-1585945204

   > I'm not sure I understand your goal. Is it to only need a single custom 
type matcher? Would it be possible to do:
   > 
   > ```
   > class AvgFinalMatcher : public TypeMatcher {
   >  public:
   >   AvgFinalMatcher(Type::type type_id) : type_id_(type_id) {}
   > 
   >   bool Matches(const DataType& type) const override {
   >     if (type.id() != Type::STRUCT) {
   >       return false;
   >     }
   >     return (type.fields()[0])->type()->id() == type_id_;
   >   }
   > private:
   >   Type::type type_id_;
   >  //......
   > }
   > 
   > // ...
   > 
   > Status Visit(const Decimal128Type&) {
   >     kernel = 
MakeKernel(std::move(InputType(match::AvgFinal(Type::DECIMAL128), 
ValueDescr::ARRAY)),
   >                         AvgSumInit<GroupedAvgFinalImpl<Decimal128Type>>);
   >     return Status::OK();
   >   }
   > 
   >   Status Visit(const Decimal256Type&) {
   >     kernel = 
MakeKernel(std::move(InputType(match::AvgFinal(Type::DECIMAL256), 
ValueDescr::ARRAY)),
   >                         AvgSumInit<GroupedAvgFinalImpl<Decimal256Type>>);
   >     return Status::OK();
   >   }
   > ```
   
   yes, We don't know the specific internal type, it needs to be determined 
according to the input, that is, this Matches lacks a parameter(just for 
inputType)


-- 
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]

Reply via email to