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

   ### Describe the issue this Pull Request addresses
   
     `HiveTestUtil.clear()` deletes the test base path and then immediately 
reinitializes a Hudi table under the same path. This recreates the temporary 
`hivesynctest*`
     directory during cleanup, leaving test-generated directories behind after 
Hive sync tests finish.
   
     This PR refactors Hive test temporary directory handling so tests can use 
JUnit-managed `@TempDir` paths, while keeping cleanup free of table 
reinitialization side
     effects.
   
   ### Summary and Changelog
   
     Fix Hive sync test temporary directory cleanup by separating test setup 
from cleanup.
   
     Changes:
   
     - Add a `HiveTestUtil.setUp(..., Path tempDir)` overload so JUnit tests 
can pass an `@TempDir` root.
     - Create default Hive test base paths under the provided JUnit temp 
directory when available.
     - Move empty Hudi table initialization into `setUp()` after cleanup, 
preserving existing test setup behavior.
     - Remove `HoodieTableMetaClient.newTableBuilder().initTable()` from 
`clear()` so cleanup does not recreate deleted directories.
     - Update `TestHiveSyncTool`, `TestHiveIncrementalPuller`, and 
`TestHudiHiveSyncJob` to pass their JUnit `@TempDir` into `HiveTestUtil`.
     - Update base-path-change cases in `TestHiveSyncTool` to create 
replacement base paths under the same JUnit temp directory.
   
     No code was copied.
   
   ### Impact
   
     No public API, storage format, table metadata, or user-facing behavior 
change.
   
     This change only affects test utilities and tests. Hive sync tests should 
leave fewer residual temporary directories on local disks and CI workers.
   
   ### Risk Level
   
     low
   
     The change is scoped to test code. The main behavioral risk is altering 
the lifecycle of `HiveTestUtil` setup and cleanup. To reduce that risk, empty 
table
     initialization is still performed during `setUp()` for existing default 
test setup paths, but no longer during `clear()`.
   
     Verification performed:
   
     ```bash
     git diff --check
   
     Maven test compilation was not run locally because mvn is not available in 
the current environment.
   
     ### Documentation Update
   
     none
   
     No user-facing feature, configuration, or documented behavior changes.
   
   ### Contributor's checklist
   
     - [x] Read through contributor's guide 
(https://hudi.apache.org/contribute/how-to-contribute)
     - [x] Enough context is provided in the sections above
     - [x] Adequate tests were added if applicable


-- 
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