diff options
Diffstat (limited to 'python/pyspark/sql/types.py')
-rw-r--r-- | python/pyspark/sql/types.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/python/pyspark/sql/types.py b/python/pyspark/sql/types.py index d638576916..f75791fad1 100644 --- a/python/pyspark/sql/types.py +++ b/python/pyspark/sql/types.py @@ -188,7 +188,8 @@ class TimestampType(AtomicType): def fromInternal(self, ts): if ts is not None: - return datetime.datetime.fromtimestamp(ts / 1e6) + # using int to avoid precision loss in float + return datetime.datetime.fromtimestamp(ts // 1000000).replace(microsecond=ts % 1000000) class DecimalType(FractionalType): |