Conversation
Collaborator
hudi-agent
reviewed
Sep 18, 2026
hudi-agent
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the contribution! This PR fixes a NullPointerException in metadata delete-record-index by adding the --sparkMaster option and lazily initializing the CLI's Spark context before the deletion, matching the pattern already used by the other Spark-backed metadata commands, and adds a regression test on a fresh command instance. No issues flagged from this automated pass — a Hudi committer or PMC member can take it from here for a final review.
cc @yihua
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the problem?
metadata delete-record-indexconstructs aHoodieSparkEngineContextfrom the command's Spark context, but does not initialize that context first. When this is the first metadata command executed in a CLI session, the context is null and the command fails with a NullPointerException.What does this change do?
--sparkMasteroption used by the other Spark-backed metadata commands.MetadataCommandinstance and verifies the Record Index partition is removed.This is the smallest targeted fix: it reuses the existing lazy initialization helper and leaves the metadata deletion behavior unchanged.
Fixes #19878
Testing
mvn -P spark3.5 -Dtest=TestMetadataCommand#testMetadataDeleteRecordIndexInitializesSparkContext -Dsurefire.failIfNoSpecifiedTests=false -Dcheckstyle.skip=true -Dspotless.check.skip=true -Drat.skip=true testmvn -P spark3.5 -Dtest=TestMetadataCommand -Dsurefire.failIfNoSpecifiedTests=false -Dcheckstyle.skip=true -Dspotless.check.skip=true -Drat.skip=true testmvn -P spark3.5 -DskipTests -Dspotless.check.skip=true -Drat.skip=true checkstyle:check