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

Remove number from assert description #11827

Merged
merged 4 commits into from
Dec 20, 2024
Merged
Changes from all 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 @@ -194,16 +194,16 @@ public void testUnpartitioned() throws Exception {
.option(SizeBasedFileRewriter.REWRITE_ALL, "true")
.execute();
List<DeleteFile> newDeleteFiles = deleteFiles(table);
assertThat(newDeleteFiles).as("Expected 1 new delete file").hasSize(1);
assertThat(newDeleteFiles).as("New delete files").hasSize(1);
assertLocallySorted(newDeleteFiles);
assertNotContains(deleteFiles, newDeleteFiles);
checkResult(result, deleteFiles, newDeleteFiles, 1);
checkSequenceNumbers(table, deleteFiles, newDeleteFiles);

List<Object[]> actualRecords = records(table);
List<Object[]> actualDeletes = deleteRecords(table);
assertEquals("Rows must match", expectedRecords, actualRecords);
assertEquals("Position deletes must match", expectedDeletes, actualDeletes);
assertEquals("Rows", expectedRecords, actualRecords);
assertEquals("Position deletes", expectedDeletes, actualDeletes);
}

@TestTemplate
Expand Down Expand Up @@ -238,8 +238,8 @@ public void testRewriteAll() throws Exception {

List<Object[]> actualRecords = records(table);
List<Object[]> actualDeletes = deleteRecords(table);
assertEquals("Rows must match", expectedRecords, actualRecords);
assertEquals("Position deletes must match", expectedDeletes, actualDeletes);
assertEquals("Rows", expectedRecords, actualRecords);
assertEquals("Position deletes", expectedDeletes, actualDeletes);
}

@TestTemplate
Expand Down Expand Up @@ -284,8 +284,8 @@ public void testRewriteFilter() throws Exception {

List<Object[]> actualRecords = records(table);
List<Object[]> actualDeletes = deleteRecords(table);
assertEquals("Rows must match", expectedRecords, actualRecords);
assertEquals("Position deletes must match", expectedDeletes, actualDeletes);
assertEquals("Rows", expectedRecords, actualRecords);
assertEquals("Position deletes", expectedDeletes, actualDeletes);

withSQLConf(
ImmutableMap.of(SQLConf.CASE_SENSITIVE().key(), "true"),
Expand Down Expand Up @@ -326,16 +326,16 @@ public void testRewriteToSmallerTarget() throws Exception {
.option(SizeBasedFileRewriter.TARGET_FILE_SIZE_BYTES, String.valueOf(avgSize / 2))
.execute();
List<DeleteFile> newDeleteFiles = deleteFiles(table);
assertThat(newDeleteFiles).as("Should have 8 new delete files").hasSize(8);
assertThat(newDeleteFiles).as("New delete files").hasSize(8);
assertNotContains(deleteFiles, newDeleteFiles);
assertLocallySorted(newDeleteFiles);
checkResult(result, deleteFiles, newDeleteFiles, 4);
checkSequenceNumbers(table, deleteFiles, newDeleteFiles);

List<Object[]> actualRecords = records(table);
List<Object[]> actualDeletes = deleteRecords(table);
assertEquals("Rows must match", expectedRecords, actualRecords);
assertEquals("Position deletes must match", expectedDeletes, actualDeletes);
assertEquals("Rows", expectedRecords, actualRecords);
assertEquals("Position deletes", expectedDeletes, actualDeletes);
}

@TestTemplate
Expand Down Expand Up @@ -371,16 +371,16 @@ public void testRemoveDanglingDeletes() throws Exception {
.option(SizeBasedFileRewriter.REWRITE_ALL, "true")
.execute();
List<DeleteFile> newDeleteFiles = deleteFiles(table);
assertThat(newDeleteFiles).as("Should have 0 new delete files").hasSize(0);
assertThat(newDeleteFiles).as("New delete files").isEmpty();
assertNotContains(deleteFiles, newDeleteFiles);
assertLocallySorted(newDeleteFiles);
checkResult(result, deleteFiles, newDeleteFiles, 4);
checkSequenceNumbers(table, deleteFiles, newDeleteFiles);

List<Object[]> actualRecords = records(table);
List<Object[]> actualDeletes = deleteRecords(table);
assertEquals("Rows must match", expectedRecords, actualRecords);
assertThat(actualDeletes).as("Should be no new position deletes").hasSize(0);
assertEquals("Rows", expectedRecords, actualRecords);
assertThat(actualDeletes).as("New position deletes").isEmpty();
}

@TestTemplate
Expand Down Expand Up @@ -413,7 +413,7 @@ public void testSomePartitionsDanglingDeletes() throws Exception {
.option(SizeBasedFileRewriter.REWRITE_ALL, "true")
.execute();
List<DeleteFile> newDeleteFiles = deleteFiles(table);
assertThat(newDeleteFiles).as("Should have 2 new delete files").hasSize(2);
assertThat(newDeleteFiles).as("New delete files").hasSize(2);
assertNotContains(deleteFiles, newDeleteFiles);
assertLocallySorted(newDeleteFiles);
checkResult(result, deleteFiles, newDeleteFiles, 4);
Expand All @@ -432,8 +432,8 @@ public void testSomePartitionsDanglingDeletes() throws Exception {

List<Object[]> actualRecords = records(table);
List<Object[]> actualDeletes = deleteRecords(table);
assertEquals("Rows must match", expectedRecords, actualRecords);
assertEquals("Position deletes must match", expectedDeletes, actualDeletes);
assertEquals("Rows", expectedRecords, actualRecords);
assertEquals("Position deletes", expectedDeletes, actualDeletes);
}

@TestTemplate
Expand Down Expand Up @@ -469,7 +469,7 @@ public void testRewriteFilterRemoveDangling() throws Exception {
.execute();

List<DeleteFile> newDeleteFiles = except(deleteFiles(table), deleteFiles);
assertThat(newDeleteFiles).as("New delete files").hasSize(0);
assertThat(newDeleteFiles).as("New delete files").isEmpty();

List<DeleteFile> expectedRewrittenFiles =
filterFiles(table, deleteFiles, ImmutableList.of(0), ImmutableList.of(1));
Expand All @@ -480,8 +480,8 @@ public void testRewriteFilterRemoveDangling() throws Exception {
// Only non-compacted deletes remain
List<Object[]> expectedDeletesFiltered =
filterDeletes(expectedDeletes, ImmutableList.of(2), ImmutableList.of(3));
assertEquals("Rows must match", expectedRecords, actualRecords);
assertEquals("Position deletes must match", expectedDeletesFiltered, allDeletes);
assertEquals("Rows", expectedRecords, actualRecords);
assertEquals("Position deletes", expectedDeletesFiltered, allDeletes);
}

@TestTemplate
Expand Down Expand Up @@ -524,16 +524,16 @@ public void testPartitionEvolutionAdd() throws Exception {
Stream.concat(unpartitionedDeleteFiles.stream(), partitionedDeleteFiles.stream())
.collect(Collectors.toList());
List<DeleteFile> newDeleteFiles = deleteFiles(table);
assertThat(newDeleteFiles).as("Should have 3 new delete files").hasSize(3);
assertThat(newDeleteFiles).as("New delete files").hasSize(3);
assertNotContains(rewrittenDeleteFiles, newDeleteFiles);
assertLocallySorted(newDeleteFiles);
checkResult(result, rewrittenDeleteFiles, newDeleteFiles, 3);
checkSequenceNumbers(table, rewrittenDeleteFiles, newDeleteFiles);

List<Object[]> actualRecords = records(table);
List<Object[]> actualDeletes = deleteRecords(table);
assertEquals("Rows must match", expectedRecords, actualRecords);
assertEquals("Position deletes must match", expectedDeletes, actualDeletes);
assertEquals("Rows", expectedRecords, actualRecords);
assertEquals("Position deletes", expectedDeletes, actualDeletes);
}

@TestTemplate
Expand Down Expand Up @@ -571,16 +571,16 @@ public void testPartitionEvolutionRemove() throws Exception {
.option(SizeBasedFileRewriter.REWRITE_ALL, "true")
.execute();
List<DeleteFile> newDeleteFiles = deleteFiles(table);
assertThat(newDeleteFiles).as("Should have 3 new delete files").hasSize(3);
assertThat(newDeleteFiles).as("New delete files").hasSize(3);
assertNotContains(expectedRewritten, newDeleteFiles);
assertLocallySorted(newDeleteFiles);
checkResult(result, expectedRewritten, newDeleteFiles, 3);
checkSequenceNumbers(table, expectedRewritten, newDeleteFiles);

List<Object[]> actualRecords = records(table);
List<Object[]> actualDeletes = deleteRecords(table);
assertEquals("Rows must match", expectedRecords, actualRecords);
assertEquals("Position deletes must match", expectedDeletes, actualDeletes);
assertEquals("Rows", expectedRecords, actualRecords);
assertEquals("Position deletes", expectedDeletes, actualDeletes);
}

@TestTemplate
Expand Down Expand Up @@ -622,14 +622,14 @@ public void testSchemaEvolution() throws Exception {
Stream.concat(deleteFiles.stream(), newSchemaDeleteFiles.stream())
.collect(Collectors.toList());
List<DeleteFile> newDeleteFiles = deleteFiles(table);
assertThat(newDeleteFiles).as("Should have 2 new delete files").hasSize(4);
assertThat(newDeleteFiles).as("New delete files").hasSize(4);
assertNotContains(rewrittenDeleteFiles, newDeleteFiles);
assertLocallySorted(newDeleteFiles);
checkResult(result, rewrittenDeleteFiles, newDeleteFiles, 4);
checkSequenceNumbers(table, rewrittenDeleteFiles, newDeleteFiles);

List<Object[]> actualRecords = records(table);
assertEquals("Rows must match", expectedRecords, actualRecords);
assertEquals("Rows", expectedRecords, actualRecords);
}

@TestTemplate
Expand Down Expand Up @@ -724,8 +724,8 @@ public void testRewriteManyColumns() throws Exception {

List<Object[]> actualRecords = records(table);
List<Object[]> actualDeletes = deleteRecords(table);
assertEquals("Rows must match", expectedRecords, actualRecords);
assertEquals("Position deletes must match", expectedDeletes, actualDeletes);
assertEquals("Rows", expectedRecords, actualRecords);
assertEquals("Position deletes", expectedDeletes, actualDeletes);
}

private Table createTablePartitioned(int partitions, int files, int numRecords) {
Expand Down Expand Up @@ -948,7 +948,7 @@ private void assertNotContains(List<DeleteFile> original, List<DeleteFile> rewri
Set<String> rewrittenPaths =
rewritten.stream().map(ContentFile::location).collect(Collectors.toSet());
rewrittenPaths.retainAll(originalPaths);
assertThat(rewrittenPaths).hasSize(0);
assertThat(rewrittenPaths).isEmpty();
}

private void assertLocallySorted(List<DeleteFile> deleteFiles) {
Expand Down Expand Up @@ -1054,48 +1054,44 @@ private void checkResult(
List<DeleteFile> newDeletes,
int expectedGroups) {
assertThat(rewrittenDeletes.size())
.as("Expected rewritten delete file count does not match")
.as("Rewritten delete file count")
.isEqualTo(result.rewrittenDeleteFilesCount());

assertThat(newDeletes.size())
.as("Expected new delete file count does not match")
.as("New delete file count")
.isEqualTo(result.addedDeleteFilesCount());

assertThat(size(rewrittenDeletes))
.as("Expected rewritten delete byte count does not match")
.as("Rewritten delete byte count")
.isEqualTo(result.rewrittenBytesCount());

assertThat(size(newDeletes))
.as("Expected new delete byte count does not match")
.isEqualTo(result.addedBytesCount());
assertThat(size(newDeletes)).as("New delete byte count").isEqualTo(result.addedBytesCount());

assertThat(expectedGroups)
.as("Expected rewrite group count does not match")
.isEqualTo(result.rewriteResults().size());
assertThat(expectedGroups).as("Rewrite group count").isEqualTo(result.rewriteResults().size());

assertThat(rewrittenDeletes.size())
.as("Expected rewritten delete file count in all groups to match")
.as("Rewritten delete file count in all groups")
.isEqualTo(
result.rewriteResults().stream()
.mapToInt(FileGroupRewriteResult::rewrittenDeleteFilesCount)
.sum());

assertThat(newDeletes.size())
.as("Expected added delete file count in all groups to match")
.as("Added delete file count in all groups")
.isEqualTo(
result.rewriteResults().stream()
.mapToInt(FileGroupRewriteResult::addedDeleteFilesCount)
.sum());

assertThat(size(rewrittenDeletes))
.as("Expected rewritten delete bytes in all groups to match")
.as("Rewritten delete bytes in all groups")
.isEqualTo(
result.rewriteResults().stream()
.mapToLong(FileGroupRewriteResult::rewrittenBytesCount)
.sum());

assertThat(size(newDeletes))
.as("Expected added delete bytes in all groups to match")
.as("Added delete bytes in all groups")
.isEqualTo(
result.rewriteResults().stream()
.mapToLong(FileGroupRewriteResult::addedBytesCount)
Expand Down