lidavidm commented on pull request #10933:
URL: https://github.com/apache/arrow/pull/10933#issuecomment-901351526


   There's already a cast from timestamp to date32/date64, however, placing 
this implementation there would change semantics a little bit:
   
   ```
   >>> timestamps
   <pyarrow.lib.TimestampArray object at 0x7f676cd86fa0>
   [
     1970-01-01 00:00:59.123456789,
     2000-02-29 23:23:23.999999999,
     1899-01-01 00:59:20.001001001
   ]
   >>> timestamps.cast(pa.date64(), safe=False)
   <pyarrow.lib.Date64Array object at 0x7f676cf277c0>
   [
     1970-01-01,
     2000-02-29,
     1899-01-02
   ]
   >>> pc.date64(timestamps)
   <pyarrow.lib.Date64Array object at 0x7f676cf27d00>
   [
     1970-01-01,
     2000-02-29,
     1899-01-01
   ]
   ```
   
   Also Python doesn't expose a way to set only allow_time_truncate (though 
maybe we should just allow the cast if we refactor things here). But that does 
raise the question of whether a cast is appropriate for this operation (since 
it seems like casting is generally interpreted more like reinterpret_cast, 
while this is an actual conversion). Also for instance a cast of a 
timestamp-with-timezone right now is quite different than what this does.


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