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

   … with the row writer
   
   HoodieAvroWriteSupport spliced the forced shredding schema into top-level 
fields only and shredded values by top-level index, so a variant nested in a 
struct silently declined to the unshredded layout on the AVRO record type while 
the row writer shredded it: same table, same config, two on-disk layouts. 
Closes #19689.
   
   - VariantSchemaUtils.applyForcedShredding walks records, array elements and 
map values the way stripVariantShreddingAt does and force-shreds a variant that 
is a record member at any depth, mirroring 
HoodieRowParquetWriteSupport.processNestedDataType: a variant that is directly 
an array element or map value is not forced on either path (a declared 
typed_value still shreds it). Shredded records are named per (enclosing record 
type, field) in the hoodie.variant.forced namespace, so a record type reused 
under two fields serializes as a name reference instead of tripping Avro's 
"Can't redefine" at file open.
   - HoodieAvroWriteSupport replaces the index-keyed top-level map with a 
Shredder tree built once from the effective schema (the mirror image of 
HoodieVariantReconstruction's rebuilder): values are shredded at every position 
the effective schema declares typed_value, records match input fields by name 
at every level, untouched subtrees are copied by reference. The value walk is 
mandatory: parquet-avro serializes positionally, so a spliced nested 
typed_value over an untransformed {metadata, value} record fails at write time.
   - VariantSchemaUtils.stripVariantShreddingByShape (the TableSchemaResolver 
footer fallback) recurses too, so a nested typed_value never leaks into the 
resolved table schema, where Hive sync would publish a three-member struct and 
both Hive guards would fail open.
   - HoodieFileGroupReaderBasedFileFormat.supportBatch applies the top-level 
variant policy at any depth: with 
spark.sql.parquet.enableNestedColumnVectorizedReader on (off by default) 
Spark's ParquetUtils.isBatchReadSupported treats VariantType as atomic and 
nested columns as batch-readable, so a nested variant reached the vectorized 
reader that #18605 forces off for top-level ones.
   
   Tests: TestHoodieAvroWriteSupportShredding (nested forced reach and the bare 
element/value decline, parquet groups under list/element and key_value/value; 
red before the fix), TestVariantSchemaUtils (splice reach, identity, naming, 
strip-by-shape at depth), TestVariantShreddingMixedLayouts section F (layout 
pinned after the AVRO-leg bin-pack merge; record-writer parity leg for both 
record types; supportBatch at any depth).
   
   The Spark-native internal read path (compaction, clustering, CDC, MOR merge 
over a nested-shredded base) is pinned separately in #19775.
   
   ### Describe the issue this Pull Request addresses
   
   <!-- Either describe the issue inline here with motivation behind the 
changes 
        (or) link to an issue by including `Closes #<issue-number>` for 
context. 
        If this PR includes changes to the storage format, public APIs,
        or has breaking changes, use `!` (e.g., feat!: ...) -->
   
   ### Summary and Changelog
   
   <!-- Short, plain-English summary of what users gain or what changed in 
behavior.
        Followed by a detailed log of all the changes. Highlight if any code 
was copied. -->
   
   ### Impact
   
   <!-- Describe any public API or user-facing feature change or any 
performance impact. -->
   
   ### Risk Level
   
   <!-- Accepted values: none, low, medium or high. Other than `none`, explain 
the risk.
        If medium or high, explain what verification was done to mitigate the 
risks. -->
   
   ### Documentation Update
   
   <!-- Describe any necessary documentation update if there is any new 
feature, config, or user-facing change. If not, put "none".
   
   - The config description must be updated if new configs are added or the 
default value of the configs are changed.
   - Any new feature or user-facing change requires updating the Hudi website. 
Please follow the 
     [instruction](https://hudi.apache.org/contribute/developer-setup#website) 
to make changes to the website. -->
   
   ### Contributor's checklist
   
   - [ ] Read through [contributor's 
guide](https://hudi.apache.org/contribute/how-to-contribute)
   - [ ] Enough context is provided in the sections above
   - [ ] 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