andygrove opened a new issue, #5707:
URL: https://github.com/apache/datafusion-comet/issues/5707
### Describe the bug
`is_pure_structural_narrowing` (`native/core/src/parquet/schema_adapter.rs`)
decides whether Comet can leave DataFusion's `CastExpr` in place so
apache/datafusion#24090's nested leaf pruning fires. It requires an *exact*,
case-sensitive name match for every target field:
```rust
source_fields
.iter()
.find(|f| f.name() == target_field.name())
.is_some_and(|source_field| ...)
```
An exact match is not the same as an unambiguous one. With
`spark.sql.caseSensitive=false`, a Parquet column `s: struct<ID: bigint, id:
bigint>` read through the explicit schema `s: struct<id: bigint>` passes this
check, so the generic cast is retained and returns `id`. Spark, and Comet's own
`spark_parquet_convert`, instead reject the ambiguity.
So a query Spark errors on can now silently return one of the two candidate
fields.
### Steps to reproduce
Read a Parquet file whose struct has two fields differing only in case,
requesting one of them by its exact name, with `spark.sql.caseSensitive=false`.
### Expected behavior
Uniqueness is required under Spark's configured name resolver at each nested
struct level before the cast is retained; otherwise fall back to
`CometCastColumnExpr` and let the existing duplicate-field check fire.
### Additional context
The existing `CAFÉ`/`café` native-reader regression asks for `Café`, so it
does not cover the case where one sibling matches exactly. A regression
requesting `café` (or `id`) exactly should be added alongside the fix.
Raised during review of #5262; @comphead agreed it is a follow-up rather
than a blocker.
--
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]