Indian-boult opened a new issue, #1022: URL: https://github.com/apache/incubator-xtable/issues/1022
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/incubator-xtable/issues?q=is%3Aissue) and found no similar issues. ### Please describe the bug 🐞 The Delta Kernel source passes only the top-level fields of the schema to the stats parser: - `DeltaKernelDataFileExtractor` (snapshot sync): `this.fields = schema.getFields();` - `DeltaKernelConversionSource#getTableChangeForCommit` (incremental sync): `tableAtVersion.getReadSchema().getFields()` Fields inside a struct column get no min, max or null count, so Iceberg and Hudi targets have no stats for them and cannot skip files on those fields. The Delta Standalone source already passes `getAllFields()` in both places. That was fixed for #771 in #769. The Kernel source was added in #729 shortly before and did not get the change. On Spark 3.5 and newer, `xtable-spark-runtime` uses the Kernel source by default. Repro with Spark 3.4 and Delta 2.4.0: ```sql CREATE TABLE delta.`/tmp/nested_stats` (id INT, nested STRUCT<name: STRING, score: INT>) USING DELTA; INSERT INTO delta.`/tmp/nested_stats` VALUES (1, named_struct('name', 'a', 'score', 10)), (2, named_struct('name', 'b', 'score', NULL)); ``` With `local[1]` both rows land in one data file. Stats in the Delta log: ```text {"numRecords":2,"minValues":{"id":1,"nested":{"name":"a","score":10}},"maxValues":{"id":2,"nested":{"name":"b","score":10}},"nullCount":{"id":0,"nested":{"name":0,"score":1}}} ``` Sync it to Iceberg with `DeltaKernelConversionSourceProvider` and read the metrics of the Iceberg data file: | | Expected | Actual | | --- | --- | --- | | lower_bounds | `id=1, nested.name=a, nested.score=10` | `id=1` | | upper_bounds | `id=2, nested.name=b, nested.score=10` | `id=2` | | null_value_counts | `id=0, nested.name=0, nested.score=1` | `id=0` | `DeltaConversionSourceProvider` (Standalone) gives the expected stats for the same table. Expected behavior: the Kernel source reads stats for nested fields, the same as the Standalone source. ### Are you willing to submit PR? - [X] I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) -- 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]
