test: cover ambiguous exact nested Parquet field matches - #5751
Open
peterxcli wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Closes #5707.
Rationale for this change
Comet can retain DataFusion's generic
CastExprfor pure structural narrowing of nested Parquet columns, allowing DataFusion's nested leaf pruning to read only the requested fields. Retaining that cast is safe only when DataFusion's exact-name lookup agrees with Spark's configured field-name resolver.An exact match alone is insufficient: with case-insensitive resolution, a file containing
s: struct<ID: bigint, id: bigint>and a requested schema ofs: struct<id: bigint>is ambiguous. DataFusion's generic cast can select the exactidfield, whereas Spark and Comet's Parquet converter reject the duplicate match. The same problem applies to non-ASCII names such asCAFÉandcafé, and to structs nested inside other structs or lists.The implementation merged in #5262 already requires exactly one source match under Spark's configured resolver at each nested struct level, in addition to an exact-name match. Ambiguous narrowing therefore falls back to
CometCastColumnExpr, preserving the existing duplicate-field error. This PR adds the missing regression coverage for that behavior; it does not change production code.What changes are included in this PR?
CometCastColumnExpr; case-sensitive exact matches must retain DataFusion'sCastExprso valid pruning remains enabled.Caféand exact-casecaféfromCAFÉ/cafésiblings. Both reads must raise a duplicate-field error, and the test asserts that the plan usesCometNativeScanExec.How are these changes tested?
CometNativeReaderSuitetests passed on Spark 4.1.git diff --checkpassed.