itholic commented on code in PR #39469:
URL: https://github.com/apache/spark/pull/39469#discussion_r1067229362


##########
python/pyspark/sql/tests/connect/test_connect_basic.py:
##########
@@ -1071,6 +1071,25 @@ def test_to_pandas(self):
             self.spark.sql(query).toPandas(),
         )
 
+    def test_create_dataframe_from_pandas_with_ns_timestamp(self):
+        """Truncate the timestamps for nanoseconds."""
+        from datetime import datetime, timezone, timedelta
+        from pandas import Timestamp
+        import pandas as pd
+
+        pdf = pd.DataFrame(
+            {
+                "naive": [datetime(2019, 1, 1, 0)],
+                "aware": [
+                    Timestamp(
+                        year=2019, month=1, day=1, nanosecond=1, 
tz=timezone(timedelta(hours=-8))
+                    )
+                ],
+            }
+        )
+        rows = self.connect.createDataFrame(pdf).collect()
+        self.assertEqual(1, len(rows))

Review Comment:
   Cool! Thanks :-)



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

Reply via email to