File tree Expand file tree Collapse file tree 3 files changed +6
-3
lines changed
sql/core/src/main/scala/org/apache/spark/sql/execution/python Expand file tree Collapse file tree 3 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -1438,8 +1438,10 @@ def test_time_with_timezone(self):
14381438 # regression test for SPARK-19561
14391439 def test_datetime_at_epoch (self ):
14401440 epoch = datetime .datetime .fromtimestamp (0 )
1441- df = self .spark .createDataFrame ([Row (date = epoch )])
1442- self .assertEqual (df .first ()['date' ], epoch )
1441+ df = self .spark .createDataFrame ([Row (date = epoch )]).select ('date' , lit (epoch ).alias ('lit_date' ))
1442+ first = df .first ()
1443+ self .assertEqual (first ['date' ], epoch )
1444+ self .assertEqual (first ['lit_date' ], epoch )
14431445
14441446 def test_decimal (self ):
14451447 from decimal import Decimal
Original file line number Diff line number Diff line change @@ -189,7 +189,7 @@ def toInternal(self, dt):
189189 if dt is not None :
190190 seconds = (calendar .timegm (dt .utctimetuple ()) if dt .tzinfo
191191 else time .mktime (dt .timetuple ()))
192- return long (seconds ) * 1000000 + dt .microsecond
192+ return int (seconds ) * 1000000 + dt .microsecond
193193
194194 def fromInternal (self , ts ):
195195 if ts is not None :
Original file line number Diff line number Diff line change @@ -112,6 +112,7 @@ object EvaluatePython {
112112 case (c : Int , DateType ) => c
113113
114114 case (c : Long , TimestampType ) => c
115+ case (c : Int , TimestampType ) => c.toLong
115116
116117 case (c, StringType ) => UTF8String .fromString(c.toString)
117118
You can’t perform that action at this time.
0 commit comments