mbutrovich opened a new issue, #3808: URL: https://github.com/apache/iceberg-rust/issues/3808
### Is your feature request related to a problem or challenge? When a Parquet data file has no field ids and the table has no `schema.name-mapping.default`, iceberg-rust reads columns by position ([`build_fallback_field_id_map`](https://github.com/apache/iceberg-rust/blob/1d4c20a03f03d9480dce13440b1511cf93dbfbc5/crates/iceberg/src/arrow/reader/projection.rs#L553), [`get_arrow_projection_mask_fallback`](https://github.com/apache/iceberg-rust/blob/1d4c20a03f03d9480dce13440b1511cf93dbfbc5/crates/iceberg/src/arrow/reader/projection.rs#L443)). Variant is the one type it rejects on that path. Projecting a Variant, or a struct, list, or map that contains one, returns `FeatureUnsupported: Reading variant columns from Parquet files without field ids is not supported yet` ([`projection.rs`](https://github.com/apache/iceberg-rust/blob/1d4c20a03f03d9480dce13440b1511cf93dbfbc5/crates/iceberg/src/arrow/reader/projection.rs#L112-L123)). [`test_read_variant_without_field_ids_is_rejected`](https://github.com/apache/iceberg-rust/blob/1d4c20a03f03d9480dce13440b 1511cf93dbfbc5/crates/iceberg/src/arrow/reader/projection.rs#L3914-L3933) checks this error. apache/iceberg-rust#2880 kept the rejection from before that PR ([comment](https://github.com/apache/iceberg-rust/pull/2880#issuecomment-6585138724)). The error fails the whole read. A query engine can't plan around it, because it would have to open every data file's footer to find out. In apache/datafusion-comet#7575 the native scan fails a query that Spark's Iceberg reader answers. iceberg-java reads these files by position. [`ReadConf`](https://github.com/apache/iceberg/blob/9203eaff9eb97fef9d1f5a3ef4460e8453adaed9/parquet/src/main/java/org/apache/iceberg/parquet/ReadConf.java#L80-L89) assigns top-level ids with [`addFallbackIds`](https://github.com/apache/iceberg/blob/9203eaff9eb97fef9d1f5a3ef4460e8453adaed9/parquet/src/main/java/org/apache/iceberg/parquet/ParquetSchemaUtil.java#L285-L295) and projects with `pruneColumnsFallback`. I checked this with Iceberg 1.11 and Spark 4.1. I wrote this file with Spark's Parquet writer, which writes no field ids: ``` message spark_schema { required int64 id; optional group v (VARIANT(1)) { required binary value; required binary metadata; } optional group s { required binary label (STRING); required group v (VARIANT(1)) { required binary value; required binary metadata; } } } ``` I then appended it with `newAppend().appendFile(...)` to a v3 table `(id bigint, v variant, s struct<label: string, v: variant>)` with no name mapping. Spark's Iceberg reader, vectorized and not, returned the top-level `v` with the same values as Spark's own Parquet read of the file. It returned `s.label` and `s.v` as NULL, because fallback ids cover only top-level fields. The spec's [Column Projection](https://github.com/apache/iceberg/blob/9203eaff9eb97fef9d1f5a3ef4460e8453adaed9/format/spec.md?plain=1#L443-L452) rules say to return `null` for a field id that is not in the file and that no name mapping resolves. Both iceberg-rust and iceberg-java go past that with the position fallback for every other type. ### Describe the solution you'd like Read a top-level Variant on the position fallback path the way iceberg-rust reads other top-level columns there. The check above exists because position-based projection selects the whole column without checking its storage layout. The fallback could run the same storage validation that the field-id path runs when it enters a projected Variant (`metadata` and `value` binary children, matched by name, `typed_value` handled as on that path) and keep the error only for storage that fails it. A Variant nested in a struct, list, or map has no fallback id, so it would read as NULL like any other nested field on this path, as in iceberg-java. The other option is to follow the spec and return `null` for the Variant. That would differ from how iceberg-rust treats every other column in these files, so I'd prefer the first option, but either one removes the read failure. `test_read_variant_without_field_ids_is_rejected` would change to check the Variant values, and a nested case would check the NULL result. ### Willingness to contribute I cannot contribute to this feature at this time -- 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]
