spock-abadai opened a new issue, #925:
URL: https://github.com/apache/iceberg-python/issues/925

   ### Apache Iceberg version
   
   main (development)
   
   ### Please describe the bug 🐞
   
   On one of my iceberg tables, when I load a table and scan it, during the 
parsing of the name mapping in the table properties, pydantic issues the 
following `ValidationError`:
   
   ```
       def parse_mapping_from_json(mapping: str) -> NameMapping:
   >       return NameMapping.model_validate_json(mapping)
   E       pydantic_core._pydantic_core.ValidationError: 1 validation error for 
NameMapping
   E       9.names
   E         Value error, At least one mapped name must be provided for the 
field [type=value_error, input_value=[], input_type=list]
   E           For further information visit 
https://errors.pydantic.dev/2.8/v/value_error
   ```
   
   This seems to be a result of the code in `table/name_mapping.py` in the 
method `check_at_least_one`, which (if I understand correctly) checks that all 
fields in the name mapping have at least one `name`. However, if I'm reading 
the [Iceberg spec](https://iceberg.apache.org/spec/#column-projection) 
correctly, it states that:
   
   
![image](https://github.com/user-attachments/assets/849de6b3-ccfd-4845-9d6a-58b81883784e)
   
   I'm not 100% sure what scenario lead to this but I can say that the name 
mapping we have indeed has a field with id 10 that has an empty list of names. 
This field existed at one point in the schema but it seems like it was removed. 
In any case, it doesn't seem like requiring that the list of names contain at 
least one value is in line with the spec (and it seems that situations where 
this isn't the case do happen). 
   
   Note that the said iceberg table was never created, written to or modified 
using `pyiceberg` (only using spark and trino). `pyiceberg` is only used to 
read. 
   
   


-- 
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