You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "Light-City (via GitHub)" <gi...@apache.org> on 2023/06/11 01:28:47 UTC

[GitHub] [arrow] Light-City commented on issue #35863: [C++] Can InputType support nested types in the future?

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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org