felipecrv commented on code in PR #41012:
URL: https://github.com/apache/arrow/pull/41012#discussion_r1628457872
##########
cpp/src/arrow/compute/kernel.h:
##########
@@ -109,6 +109,9 @@ struct ARROW_EXPORT TypeMatcher {
/// \brief Return true if this matcher accepts the data type.
virtual bool Matches(const DataType& type) const = 0;
+ /// \brief Return true if this matcher accepts the combination types
+ virtual bool Matches(const std::vector<TypeHolder>& types) const { return
true; }
+
Review Comment:
This class is for matching a single matcher (`this`) against a single type.
I don't think it's reasonable to extend the type matching this way as it
makes type checking Turing-complete (wouldn't be easy/possible to encode the
typing rules in a provably-decidable type system).
I'm sorry for this back and forth because I was the one that said "type
matching machinery". I still think this logic shouldn't go on the output type
resolver so I have a more precise suggestion this time. Since functions already
have a way of implementing custom type matching rules -- `DispatchBest` —— you
can add this logic in
https://github.com/apache/arrow/blob/9ee6ea701e20d1b47934f977d87811624061d597/cpp/src/arrow/compute/kernels/scalar_compare.cc#L343-L345
and return `return arrow::compute::detail::NoMatchingKernel(this, *types);`
or a `Status::NotImplemented` with a message that describes that you can't
compare two decimals with different scales.
--
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]