Davis-Zhang-Onehouse opened a new pull request, #20789:
URL: https://github.com/apache/hudi/pull/20789

   ### Describe the issue this Pull Request addresses
   
   issue: #20788
   Part of #20683, RFC-118 (#20684).
   Stacked on #20787: review only the last commit. Until the PRs below it 
merge, this PR also shows their commits.
   
   Several write-path and Hudi Streamer contracts do not hold consistently. The 
Spark row writer (bulk insert and clustering through the row writer) builds its 
Parquet writer from the write config alone, so a configured Parquet config 
injector and the bloom filter settings it sets do not reach it, while the 
record writer path applies them. A file that a writer marks under the table's 
meta folder is judged as an invalid data file at commit time.
   
   In the Hudi Streamer, a failed rollback after a failed error-table commit, 
failed pre-commit validators, or write errors masks the round's original 
failure. With error-table write unification, counting records after the 
error-table commit reads write statuses whose cache that commit may release, so 
the error write runs again and every error record lands twice. Transformer 
names are parsed in two places, schema planning ignores id-scoped transformer 
properties, and the cloud object extension filter matches a single extension 
only.
   
   ### Summary and Changelog
   
   Row-writer Parquet files follow the configured injector, and Hudi Streamer 
failures, transformer parsing and the cloud extension filter behave the same on 
every path.
   
   - `HoodieInternalRowFileWriterFactory` applies 
`ParquetUtils.injectParquetWriterConfigs` and reads codec, block, page and file 
size, compression ratio, dictionary and bloom filter settings (through 
`HoodieFileWriterFactory.createBloomFilter`) from the injected config.
   - `HoodieTable.getInvalidDataPaths` skips marked paths under the table's 
meta folder; such a file belongs to the writer that marked it.
   - `StreamSync` rolls back a failed instant through `rolledBack`, which keeps 
the original failure as the thrown one and adds a rollback failure to it as 
suppressed.
   - `StreamSync` counts records (`SuccessfulRecordCounter.compute`) before it 
commits the error table, so the error-table write runs once even when that 
commit releases its write-status cache.
   - `ChainedTransformer.splitTransformer` (public) parses and trims the 
`class` and `id:class` syntax and rejects an empty id or class. 
`TransformerInfo` is public, with `TransformerInfo.from(String)` and 
`getProperties(TypedProperties, Set<String>)`; schema planning passes each 
transformer its id-scoped properties.
   - `CloudObjectsSelectorCommon` accepts a comma-separated extension list for 
`hoodie.streamer.source.cloud.data.select.file.extension`, ignores blank 
entries, matches any listed extension, and falls back to the file format when 
none remains.
   - Config documentation: 
`hoodie.streamer.source.cloud.data.select.file.extension` describes the list 
syntax; `hoodie.streamer.transformer.class` states that `HoodieStreamer` takes 
its transformers through `--transformer-class`.
   - Tests: `TestHoodieInternalRowParquetConfigInjector`, 
`TestStreamSyncRollbackFailure`, `TestStreamSyncErrorStatusOrder`, 
`TestErrorTableWriteOnce` (over a real error table, with the 
`RddBackedErrorTableWriter` helper), `TestCloudExtensionFilter`, 
`TestChainedTransformerApi`, and new cases in `TestHoodieTable` and 
`TestChainedTransformer`.
   
   Existing files touched: `HoodieTable.java`, 
`HoodieInternalRowFileWriterFactory.java`, `CloudSourceConfig.java`, 
`HoodieStreamerConfig.java`, `CloudObjectsSelectorCommon.java`, 
`StreamSync.java`, `ChainedTransformer.java`, and tests `TestHoodieTable.java`, 
`TestChainedTransformer.java`.
   No code was copied from other projects. 9 test files.
   
   ### Impact
   
   `ChainedTransformer.splitTransformer`, `ChainedTransformer.TransformerInfo`, 
`TransformerInfo.from` and `TransformerInfo.getProperties(TypedProperties, 
Set<String>)` are public API. Row-writer Parquet files honour a configured 
Parquet config injector. With error-table write unification, each error record 
is written to the error table once per round. Behaviour is unchanged for a 
single configured extension, for tables without an injector, and for Streamer 
rounds without failures.
   
   ### Risk Level
   
   medium: the change touches the Parquet settings of the row writer, 
commit-time invalid-file detection, and Streamer failure handling and commit 
order. Covered by `TestHoodieInternalRowParquetConfigInjector`, 
`TestStreamSyncRollbackFailure`, `TestStreamSyncErrorStatusOrder`, 
`TestErrorTableWriteOnce`, `TestCloudExtensionFilter`, 
`TestChainedTransformerApi` and the new `TestHoodieTable` and 
`TestChainedTransformer` cases; module compile, checkstyle and RAT on JDK 11 / 
Spark 3.5 / Scala 2.12; GitHub Java CI runs on the stack tip.
   
   ### Documentation Update
   
   The config documentation of 
`hoodie.streamer.source.cloud.data.select.file.extension` and 
`hoodie.streamer.transformer.class` is updated in the diff. No new configs.
   
   ### 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