uros-b commented on code in PR #56624:
URL: https://github.com/apache/spark/pull/56624#discussion_r3444997977
##########
python/pyspark/pandas/data_type_ops/timedelta_ops.py:
##########
@@ -72,6 +73,35 @@ def restore(self, col: pd.Series) -> pd.Series:
else:
return col.astype(self.dtype)
+ def _with_inferred_unit(
+ self, result: SeriesOrIndex, left: IndexOpsLike, right:
Union[IndexOpsMixin, timedelta]
+ ) -> SeriesOrIndex:
+ # pandas 3.0.0+ promotes timedelta arithmetic to the finer resolution
of the
+ # operands; before that timedelta64 is always nanoseconds.
Review Comment:
The last part is a bit imprecisely worded. pandas 2.0 introduced
non-nanosecond resolution, so timedelta64[s]/[ms]/[us] have existed in plain
pandas since well before 3.0.0.
Perhaps a better note would be `; before that, pandas-on-Spark represented
timedelta as nanoseconds.`.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]