NopeCharon opened a new pull request, #3886:
URL: https://github.com/apache/parquet-java/pull/3886

   ### Rationale for this change
   
   `GroupType.union(Type, boolean strict)` takes a `strict` flag but then calls 
`mergeFields(GroupType)`, which always merges strictly. So a non-strict 
`MessageType.union(other, false)` only relaxes the primitive type checks for 
top-level fields. Once the conflicting primitive sits inside a group, the merge 
throws `IncompatibleSchemaModificationException`, the same as in strict mode.
   
   `ParquetFileWriter.mergeInto(..., false)` delegates to this method, and so 
does `ParquetInputFormat` when `parquet.strict.typing` is `false`. Both fail 
the same way on nested conflicts.
   
   ### What changes are included in this PR?
   
   - `GroupType.union(Type, boolean)` now passes `strict` through to 
`mergeFields`, so non-strict merging works the same at every nesting level. 
Strict merging is unchanged.
   - Remove the package-private `mergeFields(GroupType)` overload. Its only 
caller was the buggy one, and it quietly defaulted to strict merging.
   
   ### Are these changes tested?
   
   Yes. The new test `TestMessageType#testNonStrictMergeSchemaWithNestedFields` 
merges two schemas whose conflicting primitive (`binary` vs `int32`) is two 
groups deep. It checks that:
   - strict merging still fails with the existing message
   - non-strict merging, in both directions, keeps the receiver's type and adds 
the missing field
   
   The test fails without the fix and passes with it. `./mvnw verify -pl 
parquet-column` passes: 718 tests, Spotless, RAT and japicmp.
   
   ### Are there any user-facing changes?
   
   Yes. Non-strict schema merging (`MessageType.union(other, false)`, or 
`parquet.strict.typing=false` in `ParquetInputFormat`) no longer fails on 
conflicting primitive types inside nested groups. There are no public API 
changes.
   
   Closes #1901
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to