You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/07/27 13:48:58 UTC

[GitHub] [arrow] lidavidm commented on a change in pull request #10642: ARROW-13220: [C++] Implement 'choose' function

lidavidm commented on a change in pull request #10642:
URL: https://github.com/apache/arrow/pull/10642#discussion_r677468073



##########
File path: cpp/src/arrow/compute/kernels/scalar_if_else.cc
##########
@@ -1723,6 +1963,22 @@ void RegisterScalarIfElse(FunctionRegistry* registry) {
     }
     DCHECK_OK(registry->AddFunction(std::move(func)));
   }
+  {
+    auto func = std::make_shared<ChooseFunction>("choose", Arity::VarArgs(/*min_args=*/2),
+                                                 &choose_doc);
+    AddPrimitiveChooseKernels(func, NumericTypes());
+    AddPrimitiveChooseKernels(func, TemporalTypes());
+    AddPrimitiveChooseKernels(func,
+                              {boolean(), null(), day_time_interval(), month_interval()});
+    AddChooseKernel(func, Type::FIXED_SIZE_BINARY,
+                    ChooseFunctor<FixedSizeBinaryType>::Exec);
+    AddChooseKernel(func, Type::DECIMAL128, ChooseFunctor<Decimal128Type>::Exec);
+    AddChooseKernel(func, Type::DECIMAL256, ChooseFunctor<Decimal256Type>::Exec);

Review comment:
       This unfortunately gets a little annoying as the scalar representations are different (Buffer vs Decimal{128,256}).




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

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