sgilmore10 opened a new issue, #45362:
URL: https://github.com/apache/arrow/issues/45362

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   The identity cast for `Time64Scalar` and `Time32Scalar` no longer works as 
of arrow version `16.1.0`.
   
   If this executable:
   ```c++
   #include "arrow/scalar.h"
   #include "arrow/result.h"
   #include "arrow/status.h"
   #include <iostream>
   
   arrow::Status test_scalar_cast() {
       auto type =  
arrow::time64(arrow::TimeUnit::type::MICRO);//arrow::time64(arrow::TimeUnit::type::MICRO);
       ARROW_ASSIGN_OR_RAISE(auto scalar, arrow::MakeScalar<int64_t>(type, 
int64_t(1e6)));   
       std::cout << "Casting from time64[us] scalar to time64[us] scalar..." << 
std::endl;
       ARROW_ASSIGN_OR_RAISE(auto cast_result, scalar->CastTo(type));
       return arrow::Status::OK();
   }
   
   int main(int argc, char *argv[]) { 
       auto status = test_scalar_cast();
       if (!status.ok()) {
           std::cout << "Cast failed with message: " << status.message() << 
std::endl;
       } else {
           std::cout << "Success!" << std::endl;
       }
       return 0;
   }
   ```
   is linked against arrow version `16.1.0`, the identity cast fails:
   ```bash
   $ ./main
   Casting from time64[us] scalar to time64[us] scalar...
   Cast failed with message: casting scalars of type time64[us] to type 
time64[us]
   ```
   
   However, if the executable is linked against arrow version `16.0.0`, the 
identity cast works as expected:
   ```bash
   $ ./main
   Casting from time64[us] scalar to time64[us] scalar...
   Success!
   ```
   I did some code archeology, and I believe this bug was introduced in #40237. 
   
   
   ### Component(s)
   
   C++


-- 
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: issues-unsubscr...@arrow.apache.org.apache.org

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

Reply via email to