|
33 | 33 | NestedField,
|
34 | 34 | StringType,
|
35 | 35 | StructType,
|
| 36 | + TimestampType, |
36 | 37 | UnknownType,
|
| 38 | + UUIDType, |
37 | 39 | )
|
38 | 40 | from pyiceberg.utils.schema_conversion import AvroSchemaConversion
|
39 | 41 |
|
@@ -327,6 +329,30 @@ def test_convert_date_type() -> None:
|
327 | 329 | assert actual == DateType()
|
328 | 330 |
|
329 | 331 |
|
| 332 | +def test_convert_uuid_str_type() -> None: |
| 333 | + avro_logical_type = {"type": "string", "logicalType": "uuid"} |
| 334 | + actual = AvroSchemaConversion()._convert_logical_type(avro_logical_type) |
| 335 | + assert actual == UUIDType() |
| 336 | + |
| 337 | + |
| 338 | +def test_convert_uuid_fixed_type() -> None: |
| 339 | + avro_logical_type = {"type": "fixed", "logicalType": "uuid"} |
| 340 | + actual = AvroSchemaConversion()._convert_logical_type(avro_logical_type) |
| 341 | + assert actual == UUIDType() |
| 342 | + |
| 343 | + |
| 344 | +def test_convert_timestamp_millis_type() -> None: |
| 345 | + avro_logical_type = {"type": "int", "logicalType": "timestamp-millis"} |
| 346 | + actual = AvroSchemaConversion()._convert_logical_type(avro_logical_type) |
| 347 | + assert actual == TimestampType() |
| 348 | + |
| 349 | + |
| 350 | +def test_convert_timestamp_micros_type() -> None: |
| 351 | + avro_logical_type = {"type": "int", "logicalType": "timestamp-micros"} |
| 352 | + actual = AvroSchemaConversion()._convert_logical_type(avro_logical_type) |
| 353 | + assert actual == TimestampType() |
| 354 | + |
| 355 | + |
330 | 356 | def test_unknown_logical_type() -> None:
|
331 | 357 | """Test raising a ValueError when converting an unknown logical type as part of an Avro schema conversion"""
|
332 | 358 | avro_logical_type = {"type": "bytes", "logicalType": "date"}
|
|
0 commit comments