c-jamie commented on a change in pull request #12270:
URL: https://github.com/apache/arrow/pull/12270#discussion_r793013493



##########
File path: cpp/src/arrow/compute/kernels/vector_selection.cc
##########
@@ -2392,6 +2392,29 @@ struct NonZeroVisitor {
 
     return Status::OK();
   }
+
+  template <typename Type>
+  enable_if_t<is_decimal128_type<Type>::value || 
is_decimal256_type<Type>::value, Status>

Review comment:
       done

##########
File path: cpp/src/arrow/compute/kernels/vector_selection.cc
##########
@@ -2426,25 +2449,33 @@ std::shared_ptr<VectorFunction> 
MakeIndicesNonZeroFunction(std::string name,
                                                            const FunctionDoc* 
doc) {
   auto func = std::make_shared<VectorFunction>(name, Arity::Unary(), doc);
 
-  for (const auto& ty : NumericTypes()) {
-    VectorKernel kernel;
-    kernel.exec = IndicesNonZeroExec;
-    kernel.null_handling = NullHandling::OUTPUT_NOT_NULL;
-    kernel.mem_allocation = MemAllocation::NO_PREALLOCATE;
-    kernel.output_chunked = false;
-    kernel.can_execute_chunkwise = false;
-    kernel.signature = KernelSignature::Make({InputType(ty->id())}, uint64());
-    DCHECK_OK(func->AddKernel(kernel));
-  }
-
-  VectorKernel boolkernel;
-  boolkernel.exec = IndicesNonZeroExec;
-  boolkernel.null_handling = NullHandling::OUTPUT_NOT_NULL;
-  boolkernel.mem_allocation = MemAllocation::NO_PREALLOCATE;
-  boolkernel.output_chunked = false;
-  boolkernel.can_execute_chunkwise = false;
-  boolkernel.signature = KernelSignature::Make({boolean()}, uint64());
-  DCHECK_OK(func->AddKernel(boolkernel));
+  VectorKernel kernel;
+  kernel.null_handling = NullHandling::OUTPUT_NOT_NULL;
+  kernel.mem_allocation = MemAllocation::NO_PREALLOCATE;
+  kernel.output_chunked = false;
+  kernel.can_execute_chunkwise = false;
+
+  auto AddKernels = [&](const std::vector<std::shared_ptr<DataType>>& types) {
+    for (const std::shared_ptr<DataType>& ty : types) {
+      kernel.signature = KernelSignature::Make({InputType::Array(ty)}, 
uint64());
+      kernel.exec = IndicesNonZeroExec;

Review comment:
       done

##########
File path: cpp/src/arrow/compute/kernels/vector_selection.cc
##########
@@ -2426,25 +2449,33 @@ std::shared_ptr<VectorFunction> 
MakeIndicesNonZeroFunction(std::string name,
                                                            const FunctionDoc* 
doc) {
   auto func = std::make_shared<VectorFunction>(name, Arity::Unary(), doc);
 
-  for (const auto& ty : NumericTypes()) {
-    VectorKernel kernel;
-    kernel.exec = IndicesNonZeroExec;
-    kernel.null_handling = NullHandling::OUTPUT_NOT_NULL;
-    kernel.mem_allocation = MemAllocation::NO_PREALLOCATE;
-    kernel.output_chunked = false;
-    kernel.can_execute_chunkwise = false;
-    kernel.signature = KernelSignature::Make({InputType(ty->id())}, uint64());
-    DCHECK_OK(func->AddKernel(kernel));
-  }
-
-  VectorKernel boolkernel;
-  boolkernel.exec = IndicesNonZeroExec;
-  boolkernel.null_handling = NullHandling::OUTPUT_NOT_NULL;
-  boolkernel.mem_allocation = MemAllocation::NO_PREALLOCATE;
-  boolkernel.output_chunked = false;
-  boolkernel.can_execute_chunkwise = false;
-  boolkernel.signature = KernelSignature::Make({boolean()}, uint64());
-  DCHECK_OK(func->AddKernel(boolkernel));
+  VectorKernel kernel;
+  kernel.null_handling = NullHandling::OUTPUT_NOT_NULL;
+  kernel.mem_allocation = MemAllocation::NO_PREALLOCATE;
+  kernel.output_chunked = false;
+  kernel.can_execute_chunkwise = false;
+
+  auto AddKernels = [&](const std::vector<std::shared_ptr<DataType>>& types) {
+    for (const std::shared_ptr<DataType>& ty : types) {
+      kernel.signature = KernelSignature::Make({InputType::Array(ty)}, 
uint64());
+      kernel.exec = IndicesNonZeroExec;
+      DCHECK_OK(func->AddKernel(kernel));
+    }
+  };
+
+  AddKernels(NumericTypes());
+  AddKernels({boolean()});
+
+  VectorKernel deckernel;

Review comment:
       done




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