Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spark 3.5: Fix comment and assertion mismatch in PartitionedWritesTestBase/TestRewritePositionDeleteFilesAction #11748

Merged
merged 4 commits into from
Dec 15, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ public void testRewriteFilter() throws Exception {
.execute();

List<DeleteFile> newDeleteFiles = except(deleteFiles(table), deleteFiles);
assertThat(newDeleteFiles).as("Should have 4 delete files").hasSize(2);
assertThat(newDeleteFiles).as("Should have 2 delete files").hasSize(2);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question, should we just remove the number here, how about, 'delete files'?

Wont the assert message in the end already have the expected value from hasSize()?

Copy link
Contributor Author

@wzx140 wzx140 Dec 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ebyhr @huaxingao @szehon-ho I think this suggestion is reasonable, but there are many similar assertions in the existing uts. Do these assertions also need to be modified together?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi sorry for delay, let's simplify it for these wrong ones and we can do it as a follow up pr for the others, wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. The updated assert message is as follows:

[Delete files]
Expected size: 1 but was: 2 in:


List<DeleteFile> expectedRewrittenFiles =
filterFiles(table, deleteFiles, ImmutableList.of(1), ImmutableList.of(2));
Expand Down Expand Up @@ -469,7 +469,7 @@ public void testRewriteFilterRemoveDangling() throws Exception {
.execute();

List<DeleteFile> newDeleteFiles = except(deleteFiles(table), deleteFiles);
assertThat(newDeleteFiles).as("Should have 2 new delete files").hasSize(0);
assertThat(newDeleteFiles).as("Should have 0 new delete files").hasSize(0);

List<DeleteFile> expectedRewrittenFiles =
filterFiles(table, deleteFiles, ImmutableList.of(0), ImmutableList.of(1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void removeTables() {
@TestTemplate
public void testInsertAppend() {
assertThat(scalarSql("SELECT count(*) FROM %s", selectTarget()))
.as("Should have 5 rows after insert")
.as("Should have 3 rows after insert")
.isEqualTo(3L);

sql("INSERT INTO %s VALUES (4, 'd'), (5, 'e')", commitTarget());
Expand All @@ -74,7 +74,7 @@ public void testInsertAppend() {
@TestTemplate
public void testInsertOverwrite() {
assertThat(scalarSql("SELECT count(*) FROM %s", selectTarget()))
.as("Should have 5 rows after insert")
.as("Should have 3 rows after insert")
.isEqualTo(3L);

// 4 and 5 replace 3 in the partition (id - (id % 3)) = 3
Expand Down