Skip to content

HDDS-15174. Add tests for Ozone Iceberg statistics file copy plan.#10189

Merged
ashishkumar50 merged 4 commits into
apache:masterfrom
slfan1989:HDDS-15174
May 13, 2026
Merged

HDDS-15174. Add tests for Ozone Iceberg statistics file copy plan.#10189
ashishkumar50 merged 4 commits into
apache:masterfrom
slfan1989:HDDS-15174

Conversation

@slfan1989

@slfan1989 slfan1989 commented May 5, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

This PR adds unit test coverage for the Ozone Iceberg statistics file copy plan helper.

RewriteTablePathOzoneUtils.statsFileCopyPlan is used by the Ozone Iceberg RewriteTablePath implementation to build copy plan entries for table statistics files. The helper validates that the original and rewritten statistics file lists match in count and file size, and then creates mappings from the original statistics file paths to the rewritten statistics file paths.

This PR adds tests for the following cases:

  • empty statistics file lists
  • mismatched before/after statistics file counts
  • mismatched statistics file sizes
  • successful before-to-after path pair generation

The change improves coverage for the Iceberg rewrite path utility without changing production behavior.

What is the link to the Apache JIRA

HDDS-15174. Add tests for Ozone Iceberg statistics file copy plan.

How was this patch tested?

  • Tested with
mvn -pl hadoop-ozone/iceberg test
  • Result
[INFO] Tests run: 12, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.674 s -- in org.apache.hadoop.ozone.iceberg.TestRewriteTablePathOzoneAction
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 12, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

@sreejasahithi sreejasahithi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @slfan1989 for adding tests for statistics file copy plan. left a minor comment below.

Comment on lines +202 to +211
@Test
void statsFileCopyPlanRejectsMismatchedStatsCount() {
IllegalArgumentException exception = assertThrows(IllegalArgumentException.class,
() -> RewriteTablePathOzoneUtils.statsFileCopyPlan(
List.of(statisticsFile("before-1.puffin", 100)),
List.of()));

assertEquals("Before and after path rewrite, statistic files count should be same",
exception.getMessage());
}

@sreejasahithi sreejasahithi May 5, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

statistics files always have the .stats extension in real usage and .puffin is the extension used for Deletion Vector files (*-deletes.puffin). While the test works with any string since statsFileCopyPlan never validates the extension, using .puffin is misleading. Should be .stats

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review! Fixed. The test data now uses .stats for statistics files, which better matches the real file naming and avoids implying deletion vector files.

@sreejasahithi sreejasahithi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @slfan1989
LGTM

@sreejasahithi

Copy link
Copy Markdown
Contributor

@slfan1989 could you please resolve the conflicts.

@ashishkumar50 ashishkumar50 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@slfan1989 Thanks for adding the test, change LGTM except minor nits. Can you please resolve the conflict as well.

List.of()));

assertEquals("Before and after path rewrite, statistic files count should be same",
exception.getMessage());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Use
assertThat(exception).hasMessageContaining("Before and after path rewrite, statistic files count should be same");

List.of(statisticsFile("after-1.stats", 200))));

assertEquals("Before and after path rewrite, statistic files size should be same",
exception.getMessage());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Use
assertThat(exception).hasMessageContaining("Before and after path rewrite, statistic files size should be same");

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated both assertions to use AssertJ hasMessageContaining.

@ashishkumar50 ashishkumar50 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@ashishkumar50
ashishkumar50 merged commit 03ceafc into apache:master May 13, 2026
32 checks passed
@ashishkumar50

Copy link
Copy Markdown
Contributor

@sreejasahithi thanks for the review, @slfan1989 thanks for the patch.

@slfan1989

Copy link
Copy Markdown
Contributor Author

@sreejasahithi thanks for the review, @slfan1989 thanks for the patch.

@ashishkumar50 @sreejasahithi Thank you very much for your help with the review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants