paulcichonski opened a new issue, #1431:
URL: https://github.com/apache/iceberg-python/issues/1431

   ### Apache Iceberg version
   
   0.8.1 (latest release)
   
   ### Please describe the bug 🐞
   
   I have a simple Iceberg schema that looks like:
   
   ```json
   {
     "type": "struct",
     "fields": [
       {
         "id": 1,
         "name": "foo",
         "type": "string",
         "required": false,
         "initial-default": "foo-initial-default",
         "write-default": "foo-write-default"
       }
     ],
     "schema-id": 1
   }
   ```
   
   If I attempt to deserialize this into a `pyiceberg.schema.Schema` instance, 
it ignores the `initial-default` and `write-default` attributes:
   
   ```python
   from pyiceberg.schema import Schema
   
   with open('/tmp/simple_schema.json', 'r') as f:
       s = Schema.model_validate_json(f.read())
   
   print(s.fields)  # prints (NestedField(field_id=1, name='foo', 
field_type=StringType(), required=False),)
   print(s.fields[0].initial_default)  # prints None
   print(s.fields[0].write_default)  # prints None
   ```
   
   Perhaps this is expected, but [looking at the 
code](https://github.com/apache/iceberg-python/blob/a051584a3684392d2db6556449eb299145d47d15/pyiceberg/types.py#L310-L311),
 it _seems_ like it should work.
   
   If this is indeed a bug (and not expected or user error), I can work on 
trying to figure out why it is happening and submit a fix. 
   
   ### Willingness to contribute
   
   - [X] I can contribute a fix for this bug independently
   - [X] I would be willing to contribute a fix for this bug with guidance from 
the Iceberg community
   - [ ] I cannot contribute a fix for this bug 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: issues-unsubscr...@iceberg.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to