matthias-Q commented on code in PR #2173:
URL: https://github.com/apache/iceberg-python/pull/2173#discussion_r2209756001


##########
pyiceberg/utils/schema_conversion.py:
##########
@@ -69,8 +69,10 @@
 LOGICAL_FIELD_TYPE_MAPPING: Dict[Tuple[str, str], PrimitiveType] = {
     ("date", "int"): DateType(),
     ("time-micros", "long"): TimeType(),
+    ("timestamp-millis", "int"): TimestampType(),

Review Comment:
   Ah, you are right:
   I wrote a little script to confirm this:
   ```python
       avro_schema = {
           "fields": [
               {"name": "number", "type": "int", "field-id": 1},
               {
                   "name": "millis",
                   "type": {"type": "int", "logicalType": "timestamp-millis"},
                   "field-id": 2,
               },
               {
                   "name": "micros",
                   "type": {"type": "long", "logicalType": "timestamp-micros"},
                   "field-id": 3,
               },
           ],
           "name": "schema_check",
           "type": "record",
       }
   
       data = [
           {
               "number": 1,
               "millis": datetime.datetime(2025, 1, 1, 8, 0, 0, 123),
               "micros": datetime.datetime(2025, 1, 1, 8, 0, 0, 123000)
           }
       ]
   
       iceberg_schema = 
AvroSchemaConversion().avro_to_iceberg(avro_schema=avro_schema)
   
       arrow_table = pa.Table.from_pylist(data, 
schema=iceberg_schema.as_arrow())
   
       print(arrow_table)
   ```
   
   returns:
   ```
   pyarrow.Table
   number: int32 not null
   millis: timestamp[us] not null
   micros: timestamp[us] not null
   ----
   number: [[1]]
   millis: [[2025-01-01 08:00:00.000123]]
   micros: [[2025-01-01 08:00:00.123000]]
   ```
   The timestamps should be the same, but they are not.
   



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

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