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

   ### Apache Iceberg version
   
   0.6.0 (latest release)
   
   ### Please describe the bug 🐞
   
   This bug was reported by Jorge Arada on slack: 
https://apache-iceberg.slack.com/archives/C029EE6HQ5D/p1712309474600169
   
   Reported example to reproduce:
   ```python
   catalog = load_hive("iceberg_catalog", {"uri": "some_url"})
    fields = [NestedField( field_id=0, name="teste_tz", 
field_type=TimestamptzType(), required=False)]
   schema = Schema(*fields)
   catalog.create_table(identifier="raw.test_table", schema=schema)
   ```
   Error: 
   ```
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File 
"/home/revolut/app/.venv/lib/python3.11/site-packages/pyiceberg/catalog/hive.py",
 line 315, in create_table
       sd=_construct_hive_storage_descriptor(schema, location),
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/revolut/app/.venv/lib/python3.11/site-packages/pyiceberg/catalog/hive.py",
 line 155, in _construct_hive_storage_descriptor
       [FieldSchema(field.name, visit(field.field_type, 
SchemaToHiveConverter()), field.doc) for field in schema.fields],
       
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/revolut/app/.venv/lib/python3.11/site-packages/pyiceberg/catalog/hive.py",
 line 155, in <listcomp>
       [FieldSchema(field.name, visit(field.field_type, 
SchemaToHiveConverter()), field.doc) for field in schema.fields],
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/usr/local/lib/python3.11/functools.py", line 909, in wrapper
       return dispatch(args[0].__class__)(*args, **kw)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/revolut/app/.venv/lib/python3.11/site-packages/pyiceberg/schema.py", 
line 847, in _
       return visitor.primitive(obj)
              ^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/revolut/app/.venv/lib/python3.11/site-packages/pyiceberg/catalog/hive.py",
 line 228, in primitive
       return HIVE_PRIMITIVE_TYPES[type(primitive)]
              ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
   KeyError: <class 'pyiceberg.types.TimestamptzType'>
   ```
   
   It seems we miss the TimestampzTypein the [Iceberg to Hive type conversion 
map](https://github.com/apache/iceberg-python/blob/a892309936effa7ec575195ad3be70193e82d704/pyiceberg/catalog/hive.py#L193).
   A similar issue has been observed and fixed in glue: 
https://github.com/apache/iceberg-python/pull/366
   
   Based on discussion, it would be good to include the fix in 0.6.1
   


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