rambleraptor commented on code in PR #4358: URL: https://github.com/apache/iceberg-python/pull/4358#discussion_r4685181038
########## pyiceberg/table/inspect.py: ########## @@ -39,7 +40,36 @@ def _readable_bound(field_type: PrimitiveType, bound: bytes | None) -> Any | None: - return from_bytes(field_type, bound) if bound is not None else None + return _storage_value(from_bytes(field_type, bound)) if bound is not None else None + + +def _storage_type(data_type: pa.DataType) -> pa.DataType: Review Comment: This doesn't appear to work with lists or maps, so UUIDs inside of those will still crash. ########## pyiceberg/table/inspect.py: ########## @@ -39,7 +40,36 @@ def _readable_bound(field_type: PrimitiveType, bound: bytes | None) -> Any | None: - return from_bytes(field_type, bound) if bound is not None else None + return _storage_value(from_bytes(field_type, bound)) if bound is not None else None + + +def _storage_type(data_type: pa.DataType) -> pa.DataType: + """Return the storage type of a data type, replacing extension types inside structs.""" + import pyarrow as pa + + if isinstance(data_type, pa.BaseExtensionType): + return data_type.storage_type + if pa.types.is_struct(data_type): Review Comment: This is striping valid information from geography / geometry types. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
