pitrou commented on a change in pull request #11793:
URL: https://github.com/apache/arrow/pull/11793#discussion_r763905346



##########
File path: cpp/src/arrow/compute/kernels/scalar_compare.cc
##########
@@ -439,6 +472,224 @@ struct ScalarMinMax {
   }
 };
 
+template <typename Type, typename Op>
+Status ExecBinaryMinMaxScalar(KernelContext* ctx,
+                              const ElementWiseAggregateOptions& options,
+                              const ExecBatch& batch, Datum* out) {
+  if (batch.values.empty()) {
+    return Status::OK();
+  }
+  auto output = checked_cast<BaseBinaryScalar*>(out->scalar().get());
+  if (!options.skip_nulls) {
+    // any nulls in the input will produce a null output
+    for (const auto& value : batch.values) {
+      if (!value.scalar()->is_valid) {
+        output->is_valid = false;
+        return Status::OK();
+      }
+    }
+  }
+  const auto& first_scalar = *batch.values.front().scalar();
+  string_view result = UnboxScalar<Type>::Unbox(first_scalar);

Review comment:
       Hmm... if you use `checked_cast<const 
BaseBinaryScalar&>(first_scalar).view()`, you can probably remove the `Type` 
parametrization and produce less specializations of this function (which is 
always good for code size and compile times).




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