@@ -73,24 +73,26 @@ class DateFunctionsSuite extends QueryTest with SharedSQLContext {
7373 }
7474
7575 test(" timestamp comparison with timestamp strings with session local timezone" ) {
76+ val sdf1 = new SimpleDateFormat (" yyyy-MM-dd HH:mm:ss" , Locale .US )
7677 val df = Seq (
77- (1 , Timestamp .valueOf (" 2015-12-31 16:00:00" )),
78- (2 , Timestamp .valueOf (" 2016-01-01 00:00:00" ))).toDF(" i" , " t" )
78+ (1 , new Timestamp (sdf1.parse (" 2015-12-31 16:00:00" ).getTime )),
79+ (2 , new Timestamp (sdf1.parse (" 2016-01-01 00:00:00" ).getTime ))).toDF(" i" , " t" )
7980
8081 checkAnswer(
8182 df.select(" t" ).filter($" t" <= " 2016-01-01 00:00:00" ),
8283 Seq (
83- Row (Timestamp .valueOf (" 2015-12-31 16:00:00" )),
84- Row (Timestamp .valueOf (" 2016-01-01 00:00:00" ))))
84+ Row (new Timestamp (sdf1.parse (" 2015-12-31 16:00:00" ).getTime )),
85+ Row (new Timestamp (sdf1.parse (" 2016-01-01 00:00:00" ).getTime ))))
8586
8687 withSQLConf(SQLConf .SESSION_LOCAL_TIMEZONE .key -> " GMT" ) {
88+ sdf1.setTimeZone(DateTimeUtils .TimeZoneGMT )
8789
8890 // $"t" string in GMT would be as follows respectively:
8991 // "2016-01-01 00:00:00"
9092 // "2016-01-01 08:00:00"
9193 checkAnswer(
9294 df.select(" t" ).filter($" t" <= " 2016-01-01 00:00:00" ),
93- Row (Timestamp .valueOf( " 2015-12-31 16 :00:00" )))
95+ Row (new Timestamp (sdf1.parse( " 2016-01-01 00 :00:00" ).getTime )))
9496 }
9597 }
9698
0 commit comments