dmitry-chirkov-dremio opened a new issue, #49454:
URL: https://github.com/apache/arrow/issues/49454

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   `castVARCHAR_timestamp_int64` produces negative milliseconds for pre-epoch 
timestamps (before 1970-01-01).
   
   **Example:** `0107-10-17 12:20:03.900` → `"0107-10-17 12:20:03.-10"`
   **Cause:** `in % MILLIS_IN_SEC` returns negative values for negative 
timestamps.
   **Fix:** Use `EpochTimePoint::TimeOfDay().subseconds().count()` for correct 
millisecond extraction.
   
   **Failing Tests (before fix)**
   ```
       ts = StringToTimestamp("67-5-1 00:00:04") + 920;
       out = castVARCHAR_timestamp_int64(context_ptr, ts, 24L, &out_len);
       EXPECT_EQ(std::string(out, out_len), "0067-05-01 00:00:04.920");
       // Actual: "0067-05-01 00:00:04.-80"
   ```
   
   ### Component(s)
   
   C++, Gandiva


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to