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



##########
File path: cpp/src/arrow/compute/kernels/codegen_internal.h
##########
@@ -1169,6 +1169,19 @@ ArrayKernelExec 
GeneratePhysicalNumeric(detail::GetTypeId get_id) {
   }
 }
 
+template <template <typename... Args> class Generator, typename... Args>
+ArrayKernelExec GeneratePhysicalDecimal(detail::GetTypeId get_id) {
+  switch (get_id.id) {

Review comment:
       There are two kinds of kernel generator dispatchers, each with an 
"almost" name convention:
   * Fixed output type, set via `typename Type0` --> named `GenerateXXX`
   * Output type same as input type (do not have `typename Type0`) --> named 
`GenerateXXXToXXX`
   
   Based on this, I suggest to rename this function to 
`GeneratePhysicalDecimalToPhysicalDecimal`.

##########
File path: cpp/src/arrow/compute/kernels/scalar_compare.cc
##########
@@ -439,6 +469,325 @@ struct ScalarMinMax {
   }
 };
 
+template <typename Type, typename Op>
+struct BinaryScalarMinMax {
+  using ArrayType = typename TypeTraits<Type>::ArrayType;
+  using BuilderType = typename TypeTraits<Type>::BuilderType;
+  using offset_type = typename Type::offset_type;
+
+  static Status Exec(KernelContext* ctx, const ExecBatch& batch, Datum* out) {
+    const ElementWiseAggregateOptions& options = MinMaxState::Get(ctx);
+    if (std::all_of(batch.values.begin(), batch.values.end(),
+                    [](const Datum& d) { return d.is_scalar(); })) {
+      return ExecOnlyScalar(ctx, options, batch, out);
+    }
+    return ExecContainingArrays(ctx, options, batch, out);
+  }
+
+  static Status ExecOnlyScalar(KernelContext* ctx,
+                               const ElementWiseAggregateOptions& options,
+                               const ExecBatch& batch, Datum* out) {
+    if (batch.values.empty()) {
+      return Status::OK();
+    }
+    BaseBinaryScalar* output = 
checked_cast<BaseBinaryScalar*>(out->scalar().get());

Review comment:
       Use `auto` since the type is explicit in `checked_cast<>`.




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