txwyy123 opened a new pull request, #19969:
URL: https://github.com/apache/hudi/pull/19969

   ## What is the problem?
   
   `metadata delete-record-index` constructs a `HoodieSparkEngineContext` from 
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?
   
   - Add the standard `--sparkMaster` option used by the other Spark-backed 
metadata commands.
   - Initialize the command's Spark context before deleting the Record Index 
partition.
   - Add a regression test that invokes the command on a fresh 
`MetadataCommand` instance 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 test`
   - `mvn -P spark3.5 -Dtest=TestMetadataCommand 
-Dsurefire.failIfNoSpecifiedTests=false -Dcheckstyle.skip=true 
-Dspotless.check.skip=true -Drat.skip=true test`
   - `mvn -P spark3.5 -DskipTests -Dspotless.check.skip=true -Drat.skip=true 
checkstyle:check`
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to