Skip to content

Commit

Permalink
Spark 3.5: Fix testReplacePartitionField for Rewrite Manifests
Browse files Browse the repository at this point in the history
  • Loading branch information
bknbkn committed Dec 8, 2023
1 parent 263b530 commit 9420de1
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -316,20 +316,26 @@ public void testReplacePartitionField() {
sql(
"INSERT INTO %s VALUES (1, CAST('2022-01-01 10:00:00' AS TIMESTAMP), CAST('2022-01-01' AS DATE))",
tableName);
sql(
"INSERT INTO %s VALUES (2, CAST('2022-01-01 11:00:00' AS TIMESTAMP), CAST('2022-01-01' AS DATE))",
tableName);

assertEquals(
"Should have expected rows",
ImmutableList.of(
row(1, Timestamp.valueOf("2022-01-01 10:00:00"), Date.valueOf("2022-01-01"))),
sql("SELECT * FROM %s WHERE ts < current_timestamp()", tableName));
row(1, Timestamp.valueOf("2022-01-01 10:00:00"), Date.valueOf("2022-01-01")),
row(2, Timestamp.valueOf("2022-01-01 11:00:00"), Date.valueOf("2022-01-01"))),
sql("SELECT * FROM %s WHERE ts < current_timestamp() order by 1 asc", tableName));

sql("CALL %s.system.rewrite_manifests(table => '%s')", catalogName, tableName);
List<Object[]> output = sql("CALL %s.system.rewrite_manifests(table => '%s')", catalogName, tableName);
assertEquals("Procedure output must match", ImmutableList.of(row(2, 1)), output);

assertEquals(
"Should have expected rows",
ImmutableList.of(
row(1, Timestamp.valueOf("2022-01-01 10:00:00"), Date.valueOf("2022-01-01"))),
sql("SELECT * FROM %s WHERE ts < current_timestamp()", tableName));
row(1, Timestamp.valueOf("2022-01-01 10:00:00"), Date.valueOf("2022-01-01")),
row(2, Timestamp.valueOf("2022-01-01 11:00:00"), Date.valueOf("2022-01-01"))),
sql("SELECT * FROM %s WHERE ts < current_timestamp() order by 1 asc", tableName));
}

@Test
Expand Down

0 comments on commit 9420de1

Please sign in to comment.