Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

Commit

Permalink
Add a UT
Browse files Browse the repository at this point in the history
  • Loading branch information
PHILO-HE committed Aug 11, 2022
1 parent f447e28 commit 96afc65
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,19 @@ class DateTimeSuite extends QueryTest with SharedSparkSession {
Seq(Row(java.lang.Long.valueOf(1248940800L)),
Row(java.lang.Long.valueOf(1249027200L)),
Row(java.lang.Long.valueOf(1249113600L))))

// Test date format: yyyyMMdd
val datesNoSep = Seq("20090730", "20090731", "20090801")
.map(s => Tuple1(s)).toDF("time")
datesNoSep.createOrReplaceTempView("dates_no_sep")
val frameNoSep = sql("SELECT unix_timestamp(time, 'yyyyMMdd') FROM dates_no_sep")
assert(frameNoSep.queryExecution.executedPlan.find(p => p
.isInstanceOf[ColumnarConditionProjectExec]).isDefined)
checkAnswer(
frameNoSep,
Seq(Row(java.lang.Long.valueOf(1248940800L)),
Row(java.lang.Long.valueOf(1249027200L)),
Row(java.lang.Long.valueOf(1249113600L))))
}
}
}

0 comments on commit 96afc65

Please sign in to comment.