ZhangHuiGui commented on code in PR #41012:
URL: https://github.com/apache/arrow/pull/41012#discussion_r1628675148


##########
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:
   Ah, the root cause of the problem that this PR is trying to solve is 
actually CompareFunction with two different decimal scales in BindNonRecursive 
, it is impossible to enter the logic of `DispatchBest`.
   
https://github.com/apache/arrow/blob/9ee6ea701e20d1b47934f977d87811624061d597/cpp/src/arrow/compute/expression.cc#L556-L563
   
   Which means the `DispatchExact ` will always return ok and can't go into 
`DispatchBest` when `CompareFunction` called by expression system with two 
different decimal scales.
   
   This is why we did type judgment in the output type Resolver before, so that 
we can return not-ok in the first `FinishBind` and enter `DispatchBest`.
   
   `DispatchBest` does not need to make additional judgments, because it will 
do cast according to the decimal rules, ensuring that different input scales 
are cast to the same scales according to `DecimalPromotion::kAdd`.



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