aboutsummaryrefslogtreecommitdiff
path: root/python/pyspark
diff options
context:
space:
mode:
authorWenchen Fan <wenchen@databricks.com>2017-03-07 17:14:26 -0800
committerWenchen Fan <wenchen@databricks.com>2017-03-07 17:14:26 -0800
commit47b2f68a885b7a2fc593ac7a55cd19742016364d (patch)
treed80a0b287d527f74c64ca95227d5503a551fc2e5 /python/pyspark
parent8e41c2eed873e215b13215844ba5ba73a8906c5b (diff)
downloadspark-47b2f68a885b7a2fc593ac7a55cd19742016364d.tar.gz
spark-47b2f68a885b7a2fc593ac7a55cd19742016364d.tar.bz2
spark-47b2f68a885b7a2fc593ac7a55cd19742016364d.zip
Revert "[SPARK-19561] [PYTHON] cast TimestampType.toInternal output to long"
This reverts commit 711addd46e98e42deca97c5b9c0e55fddebaa458.
Diffstat (limited to 'python/pyspark')
-rw-r--r--python/pyspark/sql/tests.py6
-rw-r--r--python/pyspark/sql/types.py2
2 files changed, 1 insertions, 7 deletions
diff --git a/python/pyspark/sql/tests.py b/python/pyspark/sql/tests.py
index 4d48ef694d..81f3d1d36a 100644
--- a/python/pyspark/sql/tests.py
+++ b/python/pyspark/sql/tests.py
@@ -1555,12 +1555,6 @@ class SQLTests(ReusedPySparkTestCase):
self.assertEqual(now, now1)
self.assertEqual(now, utcnow1)
- # regression test for SPARK-19561
- def test_datetime_at_epoch(self):
- epoch = datetime.datetime.fromtimestamp(0)
- df = self.spark.createDataFrame([Row(date=epoch)])
- self.assertEqual(df.first()['date'], epoch)
-
def test_decimal(self):
from decimal import Decimal
schema = StructType([StructField("decimal", DecimalType(10, 5))])
diff --git a/python/pyspark/sql/types.py b/python/pyspark/sql/types.py
index 1d31f25efa..26b54a7fb3 100644
--- a/python/pyspark/sql/types.py
+++ b/python/pyspark/sql/types.py
@@ -189,7 +189,7 @@ class TimestampType(AtomicType):
if dt is not None:
seconds = (calendar.timegm(dt.utctimetuple()) if dt.tzinfo
else time.mktime(dt.timetuple()))
- return long(seconds) * 1000000 + dt.microsecond
+ return int(seconds) * 1000000 + dt.microsecond
def fromInternal(self, ts):
if ts is not None: