emilie-wang opened a new issue, #771:
URL: https://github.com/apache/incubator-xtable/issues/771

   ### 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 🐞
   
   While applying Xtable on a Delta table with a nested schema, the nested 
fields stats become null.
   Example schema:
   ```
    |-- a: struct (nullable = true)
    |    |-- b: string (nullable = true)
    |    |-- c: integer (nullable = true)
   ```
   and the table wit 2 records
   ```
   +----------+
   |a         |
   +----------+
   |{hello, 1}|
   |{world, 2}|
   +----------+
   ```
   In delta the stats look like:
   
`{"numRecords":2,"minValues":{"a":{"b":"hello","c":1}},"maxValues":{"a":{"b":"world","c":2}},"nullCount":{"a":{"b":0,"c":0}}}`
   After converted by Xtable into an Iceberg table, the column stats become 
null:
   ```
   root
    |-- readable_metrics: struct (nullable = true)
    |    |-- a.b: struct (nullable = true)
    |    |    |-- column_size: long (nullable = true)
    |    |    |-- value_count: long (nullable = true)
    |    |    |-- null_value_count: long (nullable = true)
    |    |    |-- nan_value_count: long (nullable = true)
    |    |    |-- lower_bound: string (nullable = true)
    |    |    |-- upper_bound: string (nullable = true)
    |    |-- a.c: struct (nullable = true)
    |    |    |-- column_size: long (nullable = true)
    |    |    |-- value_count: long (nullable = true)
    |    |    |-- null_value_count: long (nullable = true)
    |    |    |-- nan_value_count: long (nullable = true)
    |    |    |-- lower_bound: integer (nullable = true)
    |    |    |-- upper_bound: integer (nullable = true)
   
   
   scala> spark.sql("select readable_metrics from  
iceberg.my_db.my_iceberg_table.entries").show(false)
   
+----------------------------------------------------------------------------+
   |readable_metrics                                                            
|
   
+----------------------------------------------------------------------------+
   |{{NULL, NULL, NULL, NULL, NULL, NULL}, {NULL, NULL, NULL, NULL, NULL, 
NULL}}|
   
+----------------------------------------------------------------------------+
   ```
   
   After some troubleshooting, the issue came from how Xtable extracted the 
stats from Delta Table.
   
   ### Are you willing to submit PR?
   
   - [x] I am willing to submit a PR!
   - [ ] I am willing to submit a PR but need help getting started!
   
   ### 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]

Reply via email to