You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "parthchandra (via GitHub)" <gi...@apache.org> on 2023/05/12 16:59:17 UTC

[GitHub] [arrow-rs] parthchandra opened a new issue, #4211: Casting Timestamp to date is off by one day for dates before 1970-01-01

parthchandra opened a new issue, #4211:
URL: https://github.com/apache/arrow-rs/issues/4211

   If casting a negative number of micros/millis to date, the cast method divides by the number of (micro/milli)seconds to get the number of days from the beginning of the epoch. 
   For a timestamp like `1969/12/31 23:59:59.995` (in millis) the number of millis from beginning of the epoch is -5. The division by the number of seconds in a day yields `0` which is off by one day since it should be `-1`. 
   
   **To Reproduce**
   ```
   select '1969-12-31 00:00:01'::timestamp::date;
   +-----------------------------+
   | Utf8("1969-12-31 00:00:01") |
   +-----------------------------+
   | 1970-01-01                  |
   +-----------------------------+
   ```
   **Expected behavior**
   ```
   select '1969-12-31 00:00:01'::timestamp::date;
   +-----------------------------+
   | Utf8("1969-12-31 00:00:01") |
   +-----------------------------+
   | 1960-12-31                  |
   +-----------------------------+
   ```
   


-- 
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.apache.org

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


[GitHub] [arrow-rs] tustvold commented on issue #4211: Casting Timestamp to date is off by one day for dates before 1970-01-01

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on issue #4211:
URL: https://github.com/apache/arrow-rs/issues/4211#issuecomment-1573883388

   `label_issue.py` automatically added labels {'arrow'} from #4323


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


[GitHub] [arrow-rs] tustvold closed issue #4211: Casting Timestamp to date is off by one day for dates before 1970-01-01

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold closed issue #4211: Casting Timestamp to date is off by one day for dates before 1970-01-01
URL: https://github.com/apache/arrow-rs/issues/4211


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


[GitHub] [arrow-rs] comphead commented on issue #4211: Casting Timestamp to date is off by one day for dates before 1970-01-01

Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on issue #4211:
URL: https://github.com/apache/arrow-rs/issues/4211#issuecomment-1546039303

   Reverified that on PG it works as @parthchandra expects
   
   ```
   select '1969-12-31 00:00:01'::timestamp::date;
   
   
       date    
   ------------
    1969-12-31
   (1 row)
   
   ```


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