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



##########
File path: cpp/src/arrow/compute/kernels/scalar_if_else.cc
##########
@@ -989,23 +1123,41 @@ struct IfElseFunction : ScalarFunction {
     RETURN_NOT_OK(CheckArity(*values));
 
     using arrow::compute::detail::DispatchExactImpl;
-    if (auto kernel = DispatchExactImpl(this, *values)) return kernel;
+    // Do not DispatchExact here because it'll let through something like 
(bool,
+    // timestamp[s], timestamp[s, "UTC"])
 
     // if 0th descriptor is null, replace with bool
     if (values->at(0).type->id() == Type::NA) {
       values->at(0).type = boolean();
     }
 
     // if-else 0'th descriptor is bool, so skip it
-    std::vector<ValueDescr> values_copy(values->begin() + 1, values->end());
-    internal::EnsureDictionaryDecoded(&values_copy);
-    internal::ReplaceNullWithOtherType(&values_copy);
+    ValueDescr* left_arg = &(*values)[1];
+    constexpr size_t num_args = 2;
 
-    if (auto type = internal::CommonNumeric(values_copy)) {
-      internal::ReplaceTypes(type, &values_copy);
+    internal::ReplaceNullWithOtherType(left_arg, num_args);
+
+    if (is_dictionary((*values)[1].type->id()) &&
+        (*values)[1].type->Equals(*(*values)[2].type)) {

Review comment:
       The intent here is to check if both arguments are identical dictionary 
types, in which case we dispatch to the dictionary kernel; otherwise we 
continue on and dictionary-decode. This is a little confusing as written so 
I'll add a comment and refactor this.




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