Skip to content

Commit

Permalink
Modified testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-sjayabalan committed Sep 4, 2024
1 parent aa318cb commit 862ed90
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3055,16 +3055,14 @@ public void collect_set() {
@Test
public void from_unixtime1() {
DataFrame df = getSession().sql("select * from values(20231010), (20220515) as t(a)");
Row[] expected = {
Row.create("1970-08-22 20:43:30.000 -0700"), Row.create("1970-08-22 17:48:35.000 -0700")
};
Row[] expected = {Row.create("1970-08-23 03:43:30.000"), Row.create("1970-08-23 00:48:35.000")};
checkAnswer(df.select(Functions.from_unixtime(df.col("a"))), expected, false);
}

@Test
public void from_unixtime2() {
DataFrame df = getSession().sql("select * from values(20231010), (456700809) as t(a)");
Row[] expected = {Row.create("1970/08/22"), Row.create("1984/06/21")};
Row[] expected = {Row.create("1970/08/23"), Row.create("1984/06/21")};
checkAnswer(df.select(Functions.from_unixtime(df.col("a"), "YYYY/MM/DD")), expected, false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2406,13 +2406,13 @@ trait FunctionSuite extends TestData {
val input = Seq("20231010", "20220515").toDF("date")
checkAnswer(
input.select(from_unixtime(col("date")).as("formatted_date")),
Seq(Row("1970-08-22 20:43:30.000 -0700"), Row("1970-08-22 17:48:35.000 -0700")),
Seq(Row("1970-08-23 03:43:30.000"), Row("1970-08-23 00:48:35.000")),
sort = false)
}
test("from_unixtime_2") {

val input = Seq("20231010", "456700809").toDF("date")
val expected = Seq("1970/08/22", "1984/06/21").toDF("formatted_date")
val expected = Seq("1970/08/23", "1984/06/21").toDF("formatted_date")

checkAnswer(
input.select(from_unixtime(col("date"), "YYYY/MM/DD").as("formatted_date")),
Expand Down

0 comments on commit 862ed90

Please sign in to comment.