From a3007b35096dc4db892c045b458f4002d2209342 Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Tue, 11 Aug 2026 15:04:00 +0200 Subject: [PATCH 1/2] GH-50849: [Python] Return correct ParquetLogicalType.type for geometry/geography --- python/pyarrow/_parquet.pyx | 2 ++ python/pyarrow/tests/parquet/test_metadata.py | 22 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/python/pyarrow/_parquet.pyx b/python/pyarrow/_parquet.pyx index 2358a961ebd9..c5ba4eb8465c 100644 --- a/python/pyarrow/_parquet.pyx +++ b/python/pyarrow/_parquet.pyx @@ -1464,6 +1464,8 @@ cdef logical_type_name_from_enum(ParquetLogicalTypeId type_): ParquetLogicalType_JSON: 'JSON', ParquetLogicalType_BSON: 'BSON', ParquetLogicalType_UUID: 'UUID', + ParquetLogicalType_GEOMETRY: 'GEOMETRY' + ParquetLogicalType_GEOGRAPHY: 'GEOGRAPHY', ParquetLogicalType_NONE: 'NONE', }.get(type_, 'UNKNOWN') diff --git a/python/pyarrow/tests/parquet/test_metadata.py b/python/pyarrow/tests/parquet/test_metadata.py index 665c9a0e8e49..9eee70b125e5 100644 --- a/python/pyarrow/tests/parquet/test_metadata.py +++ b/python/pyarrow/tests/parquet/test_metadata.py @@ -871,3 +871,25 @@ def test_read_schema_uuid_extension_type(tmp_path): schema_disabled = pq.read_schema(file_path_str, arrow_extensions_enabled=False) assert schema_disabled.field("ext").type == pa.binary(16) + + +def test_geospatial_types(parquet_test_datadir): + metadata = pq.read_metadata( + parquet_test_datadir / "geospatial" / "crs-default.parquet" + ) + column_schema = metadata.schema.column(1) + assert column_schema.name == "geometry" + assert column_schema.logical_type.type == "GEOMETRY" + + col_chunk = metadata.row_group(0).column(1) + assert col_chunk.is_geo_stats_set + assert isinstance(col_chunk.geo_statistics, pa._parquet.GeoStatistics) + assert isinstance(col_chunk.geo_statistics.geospatial_types, list) + assert isinstance(col_chunk.geo_statistics.xmin, float) + + metadata = pq.read_metadata( + parquet_test_datadir / "geospatial" / "crs-geography.parquet" + ) + column_schema = metadata.schema.column(1) + assert column_schema.name == "geography" + assert column_schema.logical_type.type == "GEOGRAPHY" From 7542395cfab03ddca65d9ca9f917e7dc4083511a Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Tue, 11 Aug 2026 15:13:52 +0200 Subject: [PATCH 2/2] fixup --- python/pyarrow/_parquet.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/pyarrow/_parquet.pyx b/python/pyarrow/_parquet.pyx index c5ba4eb8465c..932632a50410 100644 --- a/python/pyarrow/_parquet.pyx +++ b/python/pyarrow/_parquet.pyx @@ -1464,7 +1464,7 @@ cdef logical_type_name_from_enum(ParquetLogicalTypeId type_): ParquetLogicalType_JSON: 'JSON', ParquetLogicalType_BSON: 'BSON', ParquetLogicalType_UUID: 'UUID', - ParquetLogicalType_GEOMETRY: 'GEOMETRY' + ParquetLogicalType_GEOMETRY: 'GEOMETRY', ParquetLogicalType_GEOGRAPHY: 'GEOGRAPHY', ParquetLogicalType_NONE: 'NONE', }.get(type_, 'UNKNOWN')