Skip to content

Commit

Permalink
Spark 3.5: Fix testReplacePartitionField for rewriting manifests (#9250)
Browse files Browse the repository at this point in the history
  • Loading branch information
bknbkn authored Dec 8, 2023
1 parent 3f5f4d9 commit 504c134
Showing 1 changed file with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -316,20 +316,27 @@ 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 504c134

Please sign in to comment.