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

   ### Describe the issue this Pull Request addresses
   
   Adds a hudi-cli command to change `hoodie.meta.fields.mode` on an existing 
table. This is the sanctioned way to change the property outside of table 
creation — the property is immutable at runtime because it is a 
physical-storage decision baked into files at write time.
   
   **Stacked on top of #19205.** This PR is best reviewed after #19205 lands — 
the base of the diff currently includes PR-A's changes. Once #19205 merges to 
master, this PR will show only the ~209-line CLI addition.
   
   ### Summary and Changelog
   
   New shell command:
   
   ```
   table set-meta-fields-mode --target-mode <MODE> [--force true|false]
   ```
   
   Where `<MODE>` is one of `ALL`, `NONE`, `COMMIT_TIME_ONLY`, 
`FILE_NAME_ONLY`, `COMMIT_TIME_AND_FILE_NAME`.
   
   #### Safety guard
   
   On a table that already has commits, the command refuses to change the mode 
by default:
   
   ```
   Refusing to change hoodie.meta.fields.mode on a table that already has N 
commit(s).
   Existing files were written under X and will not be rewritten by this 
command; new
   commits would be written under Y, producing mixed-mode files whose 
incremental /
   file-pruning semantics differ between old and new data. Pass --force if you 
accept
   the consequences, or recreate the table to change the mode cleanly.
   ```
   
   Pass `--force` to override. A warning is logged describing the 
data-correctness impact.
   
   #### Behavior
   
   - **ALL / NONE**: persisted implicitly via 
`populate.meta.fields=true/false`; the `hoodie.meta.fields.mode` property is 
*cleared* when transitioning to ALL/NONE.
   - **COMMIT_TIME_ONLY / FILE_NAME_ONLY / COMMIT_TIME_AND_FILE_NAME**: 
persisted explicitly on `hoodie.properties` alongside 
`populate.meta.fields=false`.
   - **No-op** when the target matches the current mode.
   - **Unknown enum value**: rejected up-front with a clear error.
   
   #### Test coverage (\`TestTableCommand\`)
   
   - All 5 modes settable on a fresh table.
   - Selective → ALL clears the property.
   - No-op when the target matches the current mode.
   - Rejects unknown enum values.
   - Refuses on a populated table without \`--force\`; mode does not change.
   - Accepts on a populated table with \`--force\`; mode changes.
   
   All 9 tests pass locally.
   
   ### Impact
   
   - **Storage layout**: no change unless the user invokes the command.
   - **API**: additive — new CLI command, no signature changes to existing 
commands.
   - **Configuration**: no new properties.
   - **Performance**: N/A.
   - **Forward-compat**: N/A.
   
   ### Risk Level
   
   low
   
   Narrow, additive change with a strong default-safe guard. \`--force\` is 
required to change mode on a populated table.
   
   ### Documentation Update
   
   - New command documented via the \`@ShellMethod\` value string.
   - If the CLI docs page exists, a separate docs PR will add an entry.
   
   ### Contributor's checklist
   
   - [x] Read through [contributor's 
guide](https://hudi.apache.org/contribute/how-to-contribute)
   - [x] Change Logs and Impact were stated clearly
   - [x] Adequate tests were added if applicable
   - [ ] CI passed
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


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