This is an automated email from the ASF dual-hosted git repository.

raulcd pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new 1b004f2cfd GH-50849: [Python] Return correct ParquetLogicalType.type 
for geometry/geography (#50850)
1b004f2cfd is described below

commit 1b004f2cfd0ea5afbd7583300955c57e84341d76
Author: Joris Van den Bossche <[email protected]>
AuthorDate: Thu Aug 13 10:29:59 2026 +0200

    GH-50849: [Python] Return correct ParquetLogicalType.type for 
geometry/geography (#50850)
    
    ### Rationale for this change
    
    Fix the return value of `ParquetLogicalType.type` for geometry/geography 
types
    
    ### Are these changes tested?
    
    Yes
    
    ### Are there any user-facing changes?
    
    Not apart from the bug fix
    
    * GitHub Issue: #50849
    
    Authored-by: Joris Van den Bossche <[email protected]>
    Signed-off-by: Raúl Cumplido <[email protected]>
---
 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 2358a961eb..932632a504 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 665c9a0e8e..9eee70b125 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"

Reply via email to