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



##########
File path: cpp/src/arrow/compute/kernels/scalar_if_else.cc
##########
@@ -1031,7 +1183,16 @@ void AddPrimitiveIfElseKernels(const 
std::shared_ptr<ScalarFunction>& scalar_fun
         internal::GenerateTypeAgnosticPrimitive<ResolveIfElseExec,
                                                 
/*AllocateMem=*/std::false_type>(*type);
     // cond array needs to be boolean always
-    ScalarKernel kernel({boolean(), type, type}, type, exec);
+    std::shared_ptr<KernelSignature> sig;
+    if (type->id() == Type::TIMESTAMP) {
+      auto unit = checked_cast<const TimestampType&>(*type).unit();
+      sig = KernelSignature::Make(
+          {boolean(), match::TimestampTypeUnit(unit), 
match::TimestampTypeUnit(unit)},

Review comment:
       Mismatched timezones get caught by CheckIdenticalTypes. Mismatched units 
get either implicitly casted, or else you get NotImplemented if you have say 
`timestamp[s]` and `timestamp[ms, tz=America/Phoenix]` since no kernel is 
registsered for this combo. There are some tests for 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