zanmato1984 commented on code in PR #47297:
URL: https://github.com/apache/arrow/pull/47297#discussion_r2266894589


##########
cpp/src/arrow/compute/kernel.cc:
##########
@@ -475,23 +475,78 @@ std::string OutputType::ToString() const {
   return "computed";
 }
 
+// ----------------------------------------------------------------------
+// MatchConstraint
+
+std::shared_ptr<MatchConstraint> DecimalsHaveSameScale() {
+  class DecimalsHaveSameScaleConstraint : public MatchConstraint {
+   public:
+    bool Validate(const std::vector<TypeHolder>& types) const override {
+      DCHECK_GE(types.size(), 2);
+      DCHECK(std::all_of(types.begin(), types.end(),
+                         [](const TypeHolder& type) { return 
is_decimal(type.id()); }));
+      auto ty0 = dynamic_cast<const DecimalType*>(types[0].type);

Review Comment:
   Updated.



##########
cpp/src/arrow/compute/kernel.h:
##########
@@ -348,7 +348,24 @@ class ARROW_EXPORT OutputType {
   Resolver resolver_ = NULLPTR;
 };
 
-/// \brief Holds the input types and output type of the kernel.
+/// \brief Additional constraints to apply to the input types of a kernel when 
matching a
+/// specific kernel signature.
+class ARROW_EXPORT MatchConstraint {
+ public:
+  virtual ~MatchConstraint() = default;
+
+  /// \brief Return true if the input types satisfy the constraint.
+  virtual bool Validate(const std::vector<TypeHolder>& types) const = 0;

Review Comment:
   Updated.



-- 
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-unsubscr...@arrow.apache.org

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

Reply via email to