Include `initial-default` and `write-default` in repr
Feature Request / Improvement
Right now we don't show the initial-default and write-default in the repr of the NestedField. This is because we use it internally to deserialize the Iceberg metadata. With V3, this will also be exposed to the user. It would be good to include these in the repr if they are set. This will not change the repr for existing NestedFields, but it will show it for the ones that have an initial default. The first step would be to look into Pydantic if we can make this conditional.
@Fokko Can I take a stab at implementing this ?
please do @guptaakashdeep btw there are some somewhat relevant changes in https://github.com/apache/iceberg-python/pull/1770/files#diff-da13ee837fb063bfbb89e7c2b2016dafbe5b9c258286ffe948c370cc84d2c1b7R359-R377
@kevinjqliu I looked into the mentioned PR. I can see Fokko has already finished changes for initial-default. 👍 I see some additional changes for write-default, are we planning to work separately on write-default or it'll be part of same PR ?
If Fokko is already working on write-default, I will follow along the changes as I am still getting familiar with codebase and following such changes will help me understand it better.
These are the relevant lines:
https://github.com/apache/iceberg-python/blob/ccaa15cf8ac1eb1202256d17efc9cf9d20723d20/pyiceberg/types.py#L343-L344
Right now we never show them, but it would be nice to conditionally include them in the repr when they are not-null.
Created #2287 to solve this. Unfortunately, Pydantic doesn't natively support this.