AlenkaF commented on PR #51404:
URL: https://github.com/apache/arrow/pull/51404#issuecomment-6009481989

   I have run 3 different version of the `test_does_not_mutate_timedelta_dtype` 
on this diff:
   
   ```
   -  if (type == NPY_DATETIME || type == NPY_TIMEDELTA) {
   +  if (type == NPY_DATETIME) {
   ```
   
   which should prodice a bug and the test should fail. That does
   happen for the test on main:
   
   ```python
   expected = np.dtype('m8')
   
   assert np.dtype(np.timedelta64) == expected
   
   df = pd.DataFrame({"a": [np.timedelta64()]})
   t = pa.Table.from_pandas(df)
   t.to_pandas()
   
   assert np.dtype(np.timedelta64) == expected
   ```
   
   and the older version of the test on this PR:
   
   ```python
   expected = np.dtype('m8')
   
   assert np.dtype(np.timedelta64) == expected
   
   df = pd.DataFrame({"a": [np.timedelta64(0, "s")]})
   t = pa.Table.from_pandas(df)
   t.to_pandas()
   
   assert np.dtype(np.timedelta64) == expected
   ```
   
   but the bug can not be reproduced with this change:
   
   ```python
   expected = np.dtype('<m8[s]')
   
   assert np.dtype(np.timedelta64(0, "s")) == expected
   
   df = pd.DataFrame({"a": [np.timedelta64(0, "s")]})
   t = pa.Table.from_pandas(df)
   t.to_pandas()
   
   assert np.dtype(np.timedelta64(0, "s")) == expected
   ```
   
   as @tadeja opened up here: 
https://github.com/apache/arrow/pull/51404#discussion_r4163913027.
   I reverted the change in 
https://github.com/apache/arrow/pull/51404/commits/40997f0a073cd89d8bba912e4ee29b2b5072e296
 so we do keep testing the buggy behavior.


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