diff --git a/mkdocs/docs/geospatial.md b/mkdocs/docs/geospatial.md index f7b8433b49..df5b72c550 100644 --- a/mkdocs/docs/geospatial.md +++ b/mkdocs/docs/geospatial.md @@ -14,7 +14,7 @@ Both types store values as WKB (Well-Known Binary) bytes. ## Requirements - Iceberg format version 3 or higher -- Optional: `geoarrow-pyarrow` for GeoArrow extension type metadata and interoperability. Without it, geometry and geography are written as binary in Parquet while the Iceberg schema still preserves the spatial type. Install with `pip install pyiceberg[geoarrow]`. +- Optional: `geoarrow-types` for GeoArrow extension type metadata and interoperability. Without it, geometry and geography are written as binary in Parquet while the Iceberg schema still preserves the spatial type. Install with `pip install pyiceberg[geoarrow]`. ## Usage @@ -88,7 +88,7 @@ point_wkb = bytes.fromhex("0101000000000000000000000000000000000000") 3. **Bounds Metrics**: Geometry/geography columns do not currently contribute to data file bounds metrics. -4. **Without geoarrow-pyarrow**: When the `geoarrow-pyarrow` package is not installed, geometry and geography columns are stored as binary without GeoArrow extension type metadata. The Iceberg schema preserves type information, but other tools reading the Parquet files directly may not recognize them as spatial types. Install with `pip install pyiceberg[geoarrow]` for full GeoArrow support. +4. **Without geoarrow-types**: When the `geoarrow-types` package is not installed, geometry and geography columns are stored as binary without GeoArrow extension type metadata. The Iceberg schema preserves type information, but other tools reading the Parquet files directly may not recognize them as spatial types. Install with `pip install pyiceberg[geoarrow]` for full GeoArrow support. ## Format Version diff --git a/pyiceberg/io/pyarrow.py b/pyiceberg/io/pyarrow.py index 56dbdf5c20..7549506bdb 100644 --- a/pyiceberg/io/pyarrow.py +++ b/pyiceberg/io/pyarrow.py @@ -30,6 +30,7 @@ import functools import importlib import itertools +import json import logging import math import operator @@ -162,6 +163,7 @@ from pyiceberg.transforms import IdentityTransform, TruncateTransform from pyiceberg.typedef import EMPTY_DICT, Properties, Record, TableVersion from pyiceberg.types import ( + DEFAULT_GEOMETRY_CRS, BinaryType, BooleanType, DateType, @@ -856,33 +858,50 @@ def visit_binary(self, _: BinaryType) -> pa.DataType: def visit_geometry(self, geometry_type: GeometryType) -> pa.DataType: """Convert geometry type to PyArrow type. - When geoarrow-pyarrow is available, returns a GeoArrow WKB extension type + When geoarrow-types is available, returns a GeoArrow WKB extension type with CRS metadata. Otherwise, falls back to large_binary which stores WKB bytes. """ try: - import geoarrow.pyarrow as ga - - return ga.wkb().with_crs(geometry_type.crs) + import geoarrow.types as ga + from geoarrow.types.type_pyarrow import register_extension_types + + register_extension_types() + + # Iceberg cannot represent a GeoArrow/GeoPandas/GeoParquet None CRS as None, + # as its default is OGC:CRS84. Instead, we use the SRID:0 string in the + # Iceberg and Parquet specification examples as the sentinel. This follows + # the meaning of srid:0 in the GeoParquet 2.0 specification, PostGIS, and + # GeoPackage, as well as its mapping to the Parquet logical type in arrow-rs + # and Arrow C++. + crs = None if geometry_type.crs.lower() == "srid:0" else geometry_type.crs + return ga.wkb(crs=crs).to_pyarrow() except ImportError: return pa.large_binary() def visit_geography(self, geography_type: GeographyType) -> pa.DataType: """Convert geography type to PyArrow type. - When geoarrow-pyarrow is available, returns a GeoArrow WKB extension type + When geoarrow-types is available, returns a GeoArrow WKB extension type with CRS and edge type metadata. Otherwise, falls back to large_binary which stores WKB bytes. """ try: - import geoarrow.pyarrow as ga - - wkb_type = ga.wkb().with_crs(geography_type.crs) - # Map Iceberg algorithm to GeoArrow edge type - if geography_type.algorithm == "spherical": - wkb_type = wkb_type.with_edge_type(ga.EdgeType.SPHERICAL) - # "planar" is the default edge type in GeoArrow, no need to set explicitly - return wkb_type + import geoarrow.types as ga + from geoarrow.types.type_pyarrow import register_extension_types + + register_extension_types() + + # Other unsupported values are validated by ga.wkb(); however, this is a valid value + # that if passed to ga.wkb() will result in the value being interpreted as geometry + # instead of geography. + if geography_type.algorithm == "planar": + raise ValueError("The planar algorithm is not supported for geography types") + + crs = None if geography_type.crs.lower() == "srid:0" else geography_type.crs + return ga.wkb(crs=crs, edge_type=geography_type.algorithm).to_pyarrow() except ImportError: return pa.large_binary() + except KeyError as e: + raise ValueError(f"Unsupported geography edge interpolation algorithm: {geography_type.algorithm!r}") from e def _literal_arrow_type(iceberg_type: IcebergType, values: Iterable[Any]) -> pa.DataType: @@ -1473,6 +1492,50 @@ def primitive(self, primitive: pa.DataType) -> bool: return True +def _geoarrow_crs_to_iceberg(crs: object) -> str: + """Convert GeoArrow CRS metadata to a compact Iceberg CRS identifier.""" + # Missing CRS has a specific meaning in GeoArrow that aligns with a + # GeoParquet "null" CRS and a GeoPandas "None" CRS. From the Iceberg + # and Parquet examples and GeoParquet 2.0 guidance, the corresponding + # Iceberg string is "srid:0". + if crs is None: + return "srid:0" + + # PROJJSON CRSes need their authority:code extracted, because the Iceberg + # spec forbids storing a PROJJSON string inline in the schema + # (PROJJSON strings are typically several kilobytes and types are repeated + # in metadata frequently). + if isinstance(crs, dict): + crs_id = crs.get("id") + if ( + not isinstance(crs_id, dict) + or not isinstance(crs_id.get("authority"), str) + or not crs_id["authority"] + or not isinstance(crs_id.get("code"), (str, int, float)) + or isinstance(crs_id["code"], bool) + ): + raise ValueError( + "GeoArrow PROJJSON CRS must have an authority/code ID; inline PROJJSON is not supported in Iceberg schemas" + ) + crs = f"{crs_id['authority']}:{crs_id['code']}" + + if not isinstance(crs, str): + raise ValueError("GeoArrow CRS must be a string, a PROJJSON object, or null") + + # Parquet omits these exact identifiers, defaulting to OGC:CRS84. This ensures + # that the Parquet type and the Iceberg type match for the most common two CRS + # values. The two values are implicitly equivalent according to the Coordinate + # Axis Order of the Parquet specification. + if crs in (DEFAULT_GEOMETRY_CRS, "EPSG:4326"): + return DEFAULT_GEOMETRY_CRS + + # Otherwise, preserve the string exactly as PyArrow writes it. + if not crs.strip(): + raise ValueError("Geospatial CRS must be non-empty") + + return crs + + class _ConvertToIceberg(PyArrowSchemaVisitor[IcebergType | Schema]): """Converts PyArrowSchema to Iceberg Schema.""" @@ -1588,6 +1651,14 @@ def primitive(self, primitive: pa.DataType) -> PrimitiveType: return UnknownType() elif isinstance(primitive, pa.UuidType): return UUIDType() + elif isinstance(primitive, pa.ExtensionType) and primitive.extension_name == "geoarrow.wkb": + metadata = json.loads(primitive.__arrow_ext_serialize__()) + crs = _geoarrow_crs_to_iceberg(metadata.get("crs")) + edges = metadata.get("edges", "planar") + if edges == "planar": + return GeometryType(crs) + else: + return GeographyType(crs, edges) raise TypeError(f"Unsupported type: {primitive}") @@ -1767,6 +1838,16 @@ def _task_to_record_batches( format_kwargs: dict[str, Any] = {"pre_buffer": True, "buffer_size": ONE_MEGABYTE * 8} if dictionary_columns and task.file.file_format == FileFormat.PARQUET: format_kwargs["dictionary_columns"] = dictionary_columns + if ( + task.file.file_format == FileFormat.PARQUET + and hasattr(ds.ParquetFragmentScanOptions, "arrow_extensions_enabled") + and any( + isinstance(table_schema.find_type(field_id), (GeometryType, GeographyType)) + for field_id in projected_field_ids & table_schema.field_ids + ) + ): + # Dataset scans disable logical-type extension decoding by default. + format_kwargs["arrow_extensions_enabled"] = True arrow_format = _create_arrow_read_format(task.file.file_format, task.file.key_metadata, **format_kwargs) with io.new_input(task.file.file_path).open() as fin: fragment = arrow_format.make_fragment(fin) @@ -1946,6 +2027,8 @@ def __init__( self._table_metadata = table_metadata self._io = io self._projected_schema = projected_schema + # Register extension types before inspecting any data file schemas. + self._arrow_schema = schema_to_pyarrow(projected_schema, include_field_ids=False) self._bound_row_filter = bind(table_metadata.schema(), row_filter, case_sensitive=case_sensitive) self._case_sensitive = case_sensitive self._limit = limit @@ -1984,14 +2067,12 @@ def to_table(self, tasks: Iterable[FileScanTask]) -> pa.Table: ResolveError: When a required field cannot be found in the file ValueError: When a field type in the file cannot be projected to the schema type """ - arrow_schema = schema_to_pyarrow(self._projected_schema, include_field_ids=False) - batches = self.to_record_batches(tasks) try: first_batch = next(batches) except StopIteration: # Empty - return arrow_schema.empty_table() + return self._arrow_schema.empty_table() # Note: cannot use pa.Table.from_batches(itertools.chain([first_batch], batches))) # as different batches can use different schema's (due to large_ types) diff --git a/pyiceberg/types.py b/pyiceberg/types.py index 3295beb666..6bfddd4f2e 100644 --- a/pyiceberg/types.py +++ b/pyiceberg/types.py @@ -66,11 +66,12 @@ DEFAULT_GEOGRAPHY_CRS = "OGC:CRS84" DEFAULT_GEOGRAPHY_ALGORITHM = "spherical" -# Regex patterns for parsing geometry and geography type strings -# Matches: geometry, geometry('CRS'), geometry('crs'), geometry("CRS") -GEOMETRY_REGEX = re.compile(r"geometry(?:\(\s*['\"]([^'\"]+)['\"]\s*\))?$") -# Matches: geography, geography('CRS'), geography('crs', 'algo') -GEOGRAPHY_REGEX = re.compile(r"geography(?:\(\s*['\"]([^'\"]+)['\"](?:\s*,\s*['\"]([^'\"]+)['\"])?\s*\))?$") +# Accept Java's unquoted parameters and the existing quoted forms. +_GEOSPATIAL_PARAMETER = r"""('[^']+'|"[^"]+"|[^'",()\s][^'",()]*?)""" +GEOMETRY_REGEX = re.compile(rf"geometry\s*(?:\(\s*{_GEOSPATIAL_PARAMETER}\s*\))?", re.IGNORECASE) +GEOGRAPHY_REGEX = re.compile( + rf"geography\s*(?:\(\s*{_GEOSPATIAL_PARAMETER}\s*(?:,\s*{_GEOSPATIAL_PARAMETER}\s*)?\))?", re.IGNORECASE +) def transform_dict_value_to_str(d: dict[str, Any]) -> dict[str, str]: @@ -105,6 +106,12 @@ def _parse_fixed_type(fixed: Any) -> int: return fixed +def _parse_geospatial_parameter(value: str | None, default: str) -> str: + if value is None: + return default + return value[1:-1] if value.startswith(("'", '"')) else value.strip() + + def _parse_geometry_type(geometry: Any) -> str: """Parse geometry type string and return CRS. @@ -115,10 +122,9 @@ def _parse_geometry_type(geometry: Any) -> str: The CRS string (defaults to DEFAULT_GEOMETRY_CRS if not specified). """ if isinstance(geometry, str): - match = GEOMETRY_REGEX.match(geometry) + match = GEOMETRY_REGEX.fullmatch(geometry.strip()) if match: - crs = match.group(1) - return crs if crs else DEFAULT_GEOMETRY_CRS + return _parse_geospatial_parameter(match.group(1), DEFAULT_GEOMETRY_CRS) else: raise ValidationError(f"Could not parse {geometry} into a GeometryType") elif isinstance(geometry, dict): @@ -137,10 +143,10 @@ def _parse_geography_type(geography: Any) -> tuple[str, str]: Tuple of (CRS, algorithm) with defaults applied where not specified. """ if isinstance(geography, str): - match = GEOGRAPHY_REGEX.match(geography) + match = GEOGRAPHY_REGEX.fullmatch(geography.strip()) if match: - crs = match.group(1) if match.group(1) else DEFAULT_GEOGRAPHY_CRS - algorithm = match.group(2) if match.group(2) else DEFAULT_GEOGRAPHY_ALGORITHM + crs = _parse_geospatial_parameter(match.group(1), DEFAULT_GEOGRAPHY_CRS) + algorithm = _parse_geospatial_parameter(match.group(2), DEFAULT_GEOGRAPHY_ALGORITHM).lower() return crs, algorithm else: raise ValidationError(f"Could not parse {geography} into a GeographyType") @@ -188,9 +194,9 @@ def handle_primitive_type(cls, v: Any, handler: ValidatorFunctionWrapHandler) -> # a CRS string (or CRS, algorithm tuple). If we try to parse those as type # strings here, we'd re-enter this validator (or raise) instead of letting # pydantic validate the raw root values. - if cls.__name__ == "GeometryType" and not v.startswith("geometry"): + if cls.__name__ == "GeometryType" and not v.lstrip().lower().startswith("geometry"): return handler(v) - if cls.__name__ == "GeographyType" and not v.startswith("geography"): + if cls.__name__ == "GeographyType" and not v.lstrip().lower().startswith("geography"): return handler(v) if v == "boolean": @@ -228,10 +234,10 @@ def handle_primitive_type(cls, v: Any, handler: ValidatorFunctionWrapHandler) -> if v.startswith("decimal"): precision, scale = _parse_decimal_type(v) return DecimalType(precision, scale) - if v.startswith("geometry"): + if v.lstrip().lower().startswith("geometry"): crs = _parse_geometry_type(v) return GeometryType(crs) - if v.startswith("geography"): + if v.lstrip().lower().startswith("geography"): crs, algorithm = _parse_geography_type(v) return GeographyType(crs, algorithm) else: diff --git a/pyproject.toml b/pyproject.toml index a377f434f8..da86f7b199 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -99,7 +99,7 @@ pyiceberg-core = ["pyiceberg-core>=0.10.1,<0.11.0"] datafusion = ["datafusion>=53,<54"] gcp-auth = ["google-auth>=2.4.0"] entra-auth = ["azure-identity>=1.25.1"] -geoarrow = ["geoarrow-pyarrow>=0.2.0"] +geoarrow = ["geoarrow-types>=0.3.0"] encryption = ["cryptography>=42.0.0"] [dependency-groups] diff --git a/tests/integration/test_reads.py b/tests/integration/test_reads.py index f3e55f48e6..19cfb4aa58 100644 --- a/tests/integration/test_reads.py +++ b/tests/integration/test_reads.py @@ -58,6 +58,8 @@ from pyiceberg.types import ( BinaryType, BooleanType, + GeographyType, + GeometryType, IntegerType, LongType, NestedField, @@ -1252,6 +1254,49 @@ def test_initial_default(catalog: Catalog, spark: SparkSession) -> None: assert len(result_table) == 10 +@pytest.mark.integration +@pytest.mark.parametrize("catalog", [lf("session_catalog")]) +def test_read_geospatial_types_written_by_spark(catalog: Catalog, spark: SparkSession) -> None: + pytest.importorskip("geoarrow.types") + identifier = "default.test_read_geospatial_types_written_by_spark" + geom_wkb = "01010000000000000000003e400000000000002440" # POINT (30 10) + geog_wkb = "01010000000000000000c051c00000000000004540" # POINT (-71 42) + geospatial_enabled = spark.conf.get("spark.sql.geospatial.enabled", "false") + spark.conf.set("spark.sql.geospatial.enabled", "true") + try: + spark.sql("CREATE NAMESPACE IF NOT EXISTS default") + spark.sql(f"DROP TABLE IF EXISTS {identifier}") + spark.sql( + f"CREATE TABLE {identifier} (id BIGINT, geom GEOMETRY(4326), geog GEOGRAPHY(4326)) " + "USING iceberg TBLPROPERTIES ('format-version'='3')" + ) + spark.sql( + f"INSERT INTO {identifier} VALUES " + f"(1, st_setsrid(st_geomfromwkb(X'{geom_wkb}'), 4326), st_setsrid(st_geogfromwkb(X'{geog_wkb}'), 4326)), " + "(2, NULL, NULL)" + ) + + table = catalog.load_table(identifier) + assert table.schema().find_type("geom") == GeometryType() + assert table.schema().find_type("geog") == GeographyType() + + result = table.scan().to_arrow() + assert sorted(result.to_pylist(), key=lambda row: row["id"]) == [ + {"id": 1, "geom": bytes.fromhex(geom_wkb), "geog": bytes.fromhex(geog_wkb)}, + {"id": 2, "geom": None, "geog": None}, + ] + for name in ("geom", "geog"): + arrow_type = result.schema.field(name).type + assert isinstance(arrow_type, pa.ExtensionType) + assert arrow_type.extension_name == "geoarrow.wkb" + assert pyarrow_to_schema(result.schema, name_mapping=table.schema().name_mapping, format_version=3) == table.schema() + finally: + try: + spark.sql(f"DROP TABLE IF EXISTS {identifier}") + finally: + spark.conf.set("spark.sql.geospatial.enabled", geospatial_enabled) + + @pytest.mark.integration @pytest.mark.parametrize("catalog", [lf("session_catalog")]) def test_read_first_row_ids_written_by_spark(catalog: Catalog, spark: SparkSession) -> None: diff --git a/tests/io/test_pyarrow.py b/tests/io/test_pyarrow.py index ca21fd05f0..af35a3095d 100644 --- a/tests/io/test_pyarrow.py +++ b/tests/io/test_pyarrow.py @@ -723,44 +723,71 @@ def mock_import(name: str, *args: Any, **kwargs: Any) -> Any: def test_geometry_type_to_pyarrow_with_geoarrow() -> None: """Test geometry type uses geoarrow WKB extension type when available.""" - pytest.importorskip("geoarrow.pyarrow") - import geoarrow.pyarrow as ga + pytest.importorskip("geoarrow.types") + import geoarrow.types as ga # Test default CRS iceberg_type = GeometryType() result = visit(iceberg_type, _ConvertToArrowSchema()) - expected = ga.wkb().with_crs("OGC:CRS84") + expected = ga.wkb(crs="OGC:CRS84").to_pyarrow() assert result == expected # Test custom CRS iceberg_type_custom = GeometryType("EPSG:4326") result_custom = visit(iceberg_type_custom, _ConvertToArrowSchema()) - expected_custom = ga.wkb().with_crs("EPSG:4326") + expected_custom = ga.wkb(crs="EPSG:4326").to_pyarrow() assert result_custom == expected_custom + assert json.loads(result_custom.__arrow_ext_serialize__()) == {"crs": "EPSG:4326"} + + schema = pa.schema([("geometry", result_custom)]) + assert pa.ipc.read_schema(schema.serialize()).equals(schema, check_metadata=True) def test_geography_type_to_pyarrow_with_geoarrow() -> None: """Test geography type uses geoarrow WKB extension type with edge type when available.""" - pytest.importorskip("geoarrow.pyarrow") - import geoarrow.pyarrow as ga + pytest.importorskip("geoarrow.types") + import geoarrow.types as ga # Test default (spherical algorithm) iceberg_type = GeographyType() result = visit(iceberg_type, _ConvertToArrowSchema()) - expected = ga.wkb().with_crs("OGC:CRS84").with_edge_type(ga.EdgeType.SPHERICAL) + expected = ga.wkb(crs="OGC:CRS84", edge_type="spherical").to_pyarrow() assert result == expected - # Test custom CRS with spherical - iceberg_type_custom = GeographyType("EPSG:4326", "spherical") - result_custom = visit(iceberg_type_custom, _ConvertToArrowSchema()) - expected_custom = ga.wkb().with_crs("EPSG:4326").with_edge_type(ga.EdgeType.SPHERICAL) - assert result_custom == expected_custom + # Test custom CRS with each geography algorithm + for algorithm in ("spherical", "vincenty", "thomas", "andoyer", "karney"): + iceberg_type_custom = GeographyType("EPSG:4326", algorithm) + result_custom = visit(iceberg_type_custom, _ConvertToArrowSchema()) + assert result_custom.edge_type.name.lower() == algorithm + assert json.loads(result_custom.__arrow_ext_serialize__()) == {"crs": "EPSG:4326", "edges": algorithm} + + schema = pa.schema([("geography", result_custom)]) + restored_type = pa.ipc.read_schema(schema.serialize()).field("geography").type + assert restored_type.edge_type == result_custom.edge_type + assert restored_type.__arrow_ext_serialize__() == result_custom.__arrow_ext_serialize__() + + +def test_geography_type_to_pyarrow_planar() -> None: + with pytest.raises(ValueError, match="The planar algorithm is not supported for geography types"): + visit(GeographyType("OGC:CRS84", "planar"), _ConvertToArrowSchema()) + + +def test_spatial_type_to_pyarrow_unspecified_crs() -> None: + pytest.importorskip("geoarrow.types") + + for crs in ("srid:0", "SRID:0", "sRiD:0"): + for iceberg_type in (GeometryType(crs), GeographyType(crs)): + result = visit(iceberg_type, _ConvertToArrowSchema()) + assert result.crs is None + expected_metadata = {"edges": "spherical"} if isinstance(iceberg_type, GeographyType) else {} + assert json.loads(result.__arrow_ext_serialize__()) == expected_metadata + + +def test_geography_type_to_pyarrow_unsupported_algorithm() -> None: + pytest.importorskip("geoarrow.types") - # Test planar algorithm (no edge type set, uses default) - iceberg_type_planar = GeographyType("OGC:CRS84", "planar") - result_planar = visit(iceberg_type_planar, _ConvertToArrowSchema()) - expected_planar = ga.wkb().with_crs("OGC:CRS84") - assert result_planar == expected_planar + with pytest.raises(ValueError, match="Unsupported geography edge interpolation algorithm: 'unsupported'"): + visit(GeographyType("OGC:CRS84", "unsupported"), _ConvertToArrowSchema()) def test_struct_type_to_pyarrow(table_schema_simple: Schema) -> None: diff --git a/tests/io/test_pyarrow_visitor.py b/tests/io/test_pyarrow_visitor.py index e98d76e262..d9b53ae4ac 100644 --- a/tests/io/test_pyarrow_visitor.py +++ b/tests/io/test_pyarrow_visitor.py @@ -15,11 +15,14 @@ # specific language governing permissions and limitations # under the License. # pylint: disable=protected-access,unused-argument,redefined-outer-name +import json import re import pyarrow as pa +import pyarrow.parquet as pq import pytest +from pyiceberg.catalog import Catalog from pyiceberg.expressions import ( And, BoundEqualTo, @@ -37,6 +40,7 @@ _ConvertToIceberg, _ConvertToIcebergWithoutIDs, _expression_to_complementary_pyarrow, + _geoarrow_crs_to_iceberg, _HasIds, _NullNaNUnmentionedTermsCollector, _pyarrow_schema_ensure_large_types, @@ -55,6 +59,8 @@ DoubleType, FixedType, FloatType, + GeographyType, + GeometryType, IcebergType, IntegerType, ListType, @@ -259,6 +265,136 @@ def test_pyarrow_variable_binary_to_iceberg(pyarrow_type: pa.DataType) -> None: assert visit(converted_iceberg_type, _ConvertToArrowSchema()) == pa.large_binary() +def test_pyarrow_geoarrow_edges_to_iceberg() -> None: + ga = pytest.importorskip("geoarrow.types") + + for edges in ("planar", "spherical", "vincenty", "thomas", "andoyer", "karney"): + expected = GeometryType() if edges == "planar" else GeographyType(algorithm=edges) + for type_spec in (ga.wkb, ga.large_wkb): + arrow_type = type_spec(crs="OGC:CRS84", edge_type=edges).to_pyarrow() + assert visit_pyarrow(arrow_type, _ConvertToIceberg(format_version=3)) == expected + + +def test_pyarrow_geoarrow_crs_to_iceberg() -> None: + ga = pytest.importorskip("geoarrow.types") + + crs84 = ga.OGC_CRS84.to_json_dict() + epsg4326 = ga.OGC_CRS84.to_json_dict() + epsg4326["name"] = "WGS 84" + epsg4326["id"] = {"authority": "EPSG", "code": 4326} + epsg4326["coordinate_system"]["axis"].reverse() + for crs, expected_crs in ( + (None, "srid:0"), + ("OGC:CRS84", "OGC:CRS84"), + ("ogc:crs84", "ogc:crs84"), + ("EPSG:4326", "OGC:CRS84"), + ("epsg:4326", "epsg:4326"), + (" \tEPSG:4326\n", " \tEPSG:4326\n"), + (crs84, "OGC:CRS84"), + (epsg4326, "OGC:CRS84"), + (json.dumps(epsg4326), "OGC:CRS84"), + (ga.OGC_CRS84, "OGC:CRS84"), + ("EPSG:3857", "EPSG:3857"), + ({"id": {"authority": "EPSG", "code": 3857}}, "EPSG:3857"), + ({"id": {"authority": "CUSTOM", "code": 1.5}}, "CUSTOM:1.5"), + ({"id": {"authority": "CUSTOM", "code": ""}}, "CUSTOM:"), + ("CUSTOM:" + "x" * 250, "CUSTOM:" + "x" * 250), + ({"id": {"authority": "CUSTOM", "code": "x" * 250}}, "CUSTOM:" + "x" * 250), + ): + for edges in ("planar", "spherical"): + arrow_type = ga.wkb(crs=crs, edge_type=edges).to_pyarrow() + expected = GeometryType(expected_crs) if edges == "planar" else GeographyType(expected_crs, edges) + assert visit_pyarrow(arrow_type, _ConvertToIceberg(format_version=3)) == expected + + +def test_pyarrow_geoarrow_crs_matches_parquet() -> None: + ga = pytest.importorskip("geoarrow.types") + + for crs in ("OGC:CRS84", "EPSG:4326", "ogc:crs84", "epsg:4326", " EPSG:4326 ", "EPSG:3857", "srid:4326"): + for edges in ("planar", "spherical"): + arrow_type = ga.wkb(crs=crs, edge_type=edges).to_pyarrow() + array = pa.ExtensionArray.from_storage(arrow_type, pa.array([], type=arrow_type.storage_type)) + sink = pa.BufferOutputStream() + pq.write_table(pa.table({"geom": array}), sink) + logical_type = pq.read_metadata(pa.BufferReader(sink.getvalue())).schema.column(0).logical_type + if logical_type.type not in ("GEOMETRY", "GEOGRAPHY"): + pytest.skip("PyArrow does not support geospatial Parquet logical types") + parquet_crs = json.loads(logical_type.to_json()).get("crs", "OGC:CRS84") + iceberg_type = visit_pyarrow(arrow_type, _ConvertToIceberg(format_version=3)) + assert isinstance(iceberg_type, (GeometryType, GeographyType)) + assert iceberg_type.crs == parquet_crs + + +def test_pyarrow_geoarrow_crs_without_authority_to_iceberg() -> None: + ga = pytest.importorskip("geoarrow.types") + + crs = ga.OGC_CRS84.to_json_dict() + del crs["id"] + arrow_type = ga.wkb(crs=crs).to_pyarrow() + with pytest.raises(ValueError, match="PROJJSON CRS must have an authority/code ID"): + visit_pyarrow(arrow_type, _ConvertToIceberg(format_version=3)) + + +def test_pyarrow_geoarrow_invalid_crs() -> None: + ga = pytest.importorskip("geoarrow.types") + + for crs in ("", " \t\n"): + for edges in ("planar", "spherical"): + arrow_type = ga.wkb(crs=crs, edge_type=edges).to_pyarrow() + with pytest.raises(ValueError, match="Geospatial CRS must be non-empty"): + visit_pyarrow(arrow_type, _ConvertToIceberg(format_version=3)) + + +def test_pyarrow_geoarrow_invalid_crs_id() -> None: + ga = pytest.importorskip("geoarrow.types") + + crs_id: object + for crs_id in ( + None, + [], + {"authority": "", "code": 4326}, + {"authority": 42, "code": 4326}, + {"authority": "EPSG"}, + {"authority": "EPSG", "code": None}, + {"authority": "EPSG", "code": True}, + {"authority": "EPSG", "code": False}, + ): + arrow_type = ga.wkb(crs={"id": crs_id}).to_pyarrow() + with pytest.raises(ValueError, match="PROJJSON CRS must have an authority/code ID"): + visit_pyarrow(arrow_type, _ConvertToIceberg(format_version=3)) + + +def test_geoarrow_crs_metadata_values() -> None: + # GeoArrow constructors parse JSON strings before serializing extension metadata. + for crs in ("{}", "[]", '{"name":"custom"}'): + assert _geoarrow_crs_to_iceberg(crs) == crs + invalid_crs: object + for invalid_crs in (42, 1.5, True, []): + with pytest.raises(ValueError, match="GeoArrow CRS must be a string, a PROJJSON object, or null"): + _geoarrow_crs_to_iceberg(invalid_crs) + + +def test_pyarrow_geoarrow_schema_to_iceberg() -> None: + ga = pytest.importorskip("geoarrow.types") + + schema = pa.schema( + [ + pa.field("geometry", ga.wkb(crs=None).to_pyarrow()), + pa.field("geography", ga.wkb(crs="EPSG:4326", edge_type="karney").to_pyarrow()), + ] + ) + converted = Catalog._convert_schema_if_needed(schema, format_version=3) + assert converted.fields[0].field_type == GeometryType("srid:0") + assert converted.fields[1].field_type == GeographyType("OGC:CRS84", "karney") + + expected = Schema( + NestedField(1, "geometry", GeometryType("srid:0")), + NestedField(2, "geography", GeographyType("OGC:CRS84", "karney")), + ) + assert pyarrow_to_schema(schema, name_mapping=expected.name_mapping, format_version=3) == expected + assert pyarrow_to_schema(schema_to_pyarrow(expected), format_version=3) == expected + + def test_pyarrow_struct_to_iceberg() -> None: pyarrow_struct = pa.struct( [ diff --git a/tests/test_types.py b/tests/test_types.py index eb8ae2ea52..283962eb7e 100644 --- a/tests/test_types.py +++ b/tests/test_types.py @@ -15,6 +15,7 @@ # specific language governing permissions and limitations # under the License. # pylint: disable=W0123,W0613 +import json import pickle import pydantic_core @@ -781,13 +782,19 @@ def test_geometry_type_deserialization() -> None: """Test GeometryType JSON deserialization.""" assert GeometryType.model_validate_json('"geometry"') == GeometryType() assert GeometryType.model_validate_json("\"geometry('EPSG:4326')\"") == GeometryType("EPSG:4326") + for value in ("geometry(OGC:CRS84)", " GEOMETRY ( OGC:CRS84 ) ", "Geometry", 'geometry("OGC:CRS84")'): + assert GeometryType.model_validate_json(json.dumps(value)) == GeometryType() + assert IcebergType.model_validate(value) == GeometryType() + assert NestedField.model_validate({"id": 1, "name": "geom", "type": value}).field_type == GeometryType() + for crs in ("EPSG:3857", "projjson:custom_crs", "srid:0", "custom"): + assert GeometryType.model_validate_json(json.dumps(f"geometry({crs})")) == GeometryType(crs) def test_geometry_type_deserialization_failure() -> None: """Test GeometryType deserialization with invalid input.""" - with pytest.raises(ValidationError) as exc_info: - GeometryType.model_validate_json('"geometry(invalid)"') - assert "Could not parse geometry(invalid) into a GeometryType" in str(exc_info.value) + for value in ("geometry()", "geometry( )", "geometry(a,b)", "geometry('EPSG:4326\")", "geometry(a) trailing"): + with pytest.raises(ValidationError, match="Could not parse"): + GeometryType.model_validate_json(json.dumps(value)) def test_geometry_type_singleton() -> None: @@ -857,13 +864,36 @@ def test_geography_type_deserialization() -> None: assert GeographyType.model_validate_json('"geography"') == GeographyType() assert GeographyType.model_validate_json("\"geography('EPSG:4326')\"") == GeographyType("EPSG:4326") assert GeographyType.model_validate_json("\"geography('EPSG:4326', 'planar')\"") == GeographyType("EPSG:4326", "planar") + for value in ( + "geography(OGC:CRS84, spherical)", + " GEOGRAPHY ( OGC:CRS84 , SPHERICAL ) ", + "Geography", + "geography(OGC:CRS84)", + 'geography("OGC:CRS84", "spherical")', + ): + assert GeographyType.model_validate_json(json.dumps(value)) == GeographyType() + assert IcebergType.model_validate(value) == GeographyType() + assert NestedField.model_validate({"id": 1, "name": "geog", "type": value}).field_type == GeographyType() + for algorithm in ("spherical", "vincenty", "thomas", "andoyer", "karney"): + assert GeographyType.model_validate_json(json.dumps(f"geography(EPSG:4326, {algorithm})")) == GeographyType( + "EPSG:4326", algorithm + ) def test_geography_type_deserialization_failure() -> None: """Test GeographyType deserialization with invalid input.""" - with pytest.raises(ValidationError) as exc_info: - GeographyType.model_validate_json('"geography(invalid)"') - assert "Could not parse geography(invalid) into a GeographyType" in str(exc_info.value) + for value in ( + "geography()", + "geography( )", + "geography(,spherical)", + "geography(OGC:CRS84,)", + "geography(a,b,c)", + "geography('OGC:CRS84\", spherical)", + "geography(OGC:CRS84, 'spherical\")", + "geography(a) trailing", + ): + with pytest.raises(ValidationError, match="Could not parse"): + GeographyType.model_validate_json(json.dumps(value)) def test_geography_type_singleton() -> None: diff --git a/uv.lock b/uv.lock index 49d0f7f147..30cc2d1ff1 100644 --- a/uv.lock +++ b/uv.lock @@ -506,8 +506,8 @@ resolution-markers = [ "python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform != 'emscripten' and sys_platform != 'win32'", ] dependencies = [ - { name = "soupsieve" }, - { name = "typing-extensions" }, + { name = "soupsieve", marker = "python_full_version >= '3.11.5'" }, + { name = "typing-extensions", marker = "python_full_version >= '3.11.5'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/43/65/318323f98dbee45d42dff61d8f047181bc6f2268a9068cfad035a46be5af/beautifulsoup4-4.15.0.tar.gz", hash = "sha256:288e3ca7d54b06f2ac191970bc275c1939cb46d450b255bf6718b04aa37ab4f7", size = 632571, upload-time = "2026-06-07T16:44:20.453Z" } wheels = [ @@ -1570,73 +1570,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/0f/64/bd0cd661009e1e379a7d5d100f13d40dd0a1a28fa70115931d0e0328f7bd/gcsfs-2026.10.1-py3-none-any.whl", hash = "sha256:037e7e1fa695f12719eeb778be6453085dce0ecd8b17ef1dbeecbbce05fa3b60", size = 88539, upload-time = "2026-10-16T02:07:26.913Z" }, ] -[[package]] -name = "geoarrow-c" -version = "0.3.1" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/21/28/fe727122e139df3ebca696d9ed2c4eae43ae916a3d6beb92fe7f845f8337/geoarrow_c-0.3.1.tar.gz", hash = "sha256:a488794aab6631f5c54c3f77fcff734b2dda162e2ef74cd22fff6989d7aed89d", size = 299004, upload-time = "2025-10-10T03:04:30.772Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/73/ad/b688d7825a786b0dfbe1363ad087f9436e6c26bcd8788f97487f44d0512c/geoarrow_c-0.3.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:946bc5816f7158092d27b76e2e436e03edad814a90b767745534cf02dff2d4b1", size = 574886, upload-time = "2025-10-10T03:05:36.676Z" }, - { url = "https://files.pythonhosted.org/packages/07/7a/53dfdb581d28755c206f7245fb259ca68758a75169b3b1cbcf671dad4915/geoarrow_c-0.3.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:a4f8d7d269446772c887bf8682d67877ea6ba12187de86ee2f7d7ae679b00bed", size = 561122, upload-time = "2025-10-10T03:05:27.884Z" }, - { url = "https://files.pythonhosted.org/packages/c5/f4/b46d6a95415fa385894b22444106fd506e0b3e514ceec205d6960e57d669/geoarrow_c-0.3.1-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:081ec4d7eeaefa1a381e43e7f676ca3ba4c718ef97c26c834627cac77821f4c1", size = 1931003, upload-time = "2025-10-10T03:04:44.926Z" }, - { url = "https://files.pythonhosted.org/packages/a4/b7/6b6a007f1b59aace626c244040dc76a6ea996bc06baf7ecb00717f6381b5/geoarrow_c-0.3.1-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c11b3d1fe1f4c54a5666ca9816af68764197e73c3c548d935f336cbf43d705ea", size = 1953137, upload-time = "2025-10-10T03:05:08.787Z" }, - { url = "https://files.pythonhosted.org/packages/92/38/a9b7422d5f4c84799ef9d541f93bb5b8e65b0d2b815b0a594f2e44203281/geoarrow_c-0.3.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:85de6694e6d304ed002aa81d3f1d8625455317c97fde05f1e12e985ca37ad53e", size = 2870043, upload-time = "2025-10-10T03:04:46.493Z" }, - { url = "https://files.pythonhosted.org/packages/5b/bf/19175d8a61ca41ef316437a8f3db2fc338cf67f511a23feccb152bd615f8/geoarrow_c-0.3.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:49871c87a7c0ce2a416e006fb4d4273b0302f92aa76bb2706379e2b61e9f8fd2", size = 2964436, upload-time = "2025-10-10T03:05:09.937Z" }, - { url = "https://files.pythonhosted.org/packages/7f/a5/505c59de3abee3af7b0a15418cab32349a51bb63cfeba0a150114023ac98/geoarrow_c-0.3.1-cp311-cp311-win32.whl", hash = "sha256:a70edf5531198a3bcb590566e3927c62b5f25cfc030e551625ca01238278f8db", size = 431483, upload-time = "2025-10-10T03:06:01.893Z" }, - { url = "https://files.pythonhosted.org/packages/de/71/1b95bc02a9eb165026e6c404cbb7f8de42cc8856142ef2a6cf506ba842e7/geoarrow_c-0.3.1-cp311-cp311-win_amd64.whl", hash = "sha256:7e9aa0f1e063fab642d2b9d24f2bb8a8311e8cfdc48cd2df1340d90b387a9a8b", size = 450199, upload-time = "2025-10-10T03:05:44.705Z" }, - { url = "https://files.pythonhosted.org/packages/f0/1c/85d256b0c95861e2251684d7e9d5faeb41a9d5723b85924a13bf62541ad3/geoarrow_c-0.3.1-cp311-cp311-win_arm64.whl", hash = "sha256:60707a335d40807e806ca295a80087d8cd2c6e061dc4135ca22116208dfa477f", size = 425425, upload-time = "2025-10-10T03:05:54.712Z" }, - { url = "https://files.pythonhosted.org/packages/01/3c/5b2ada5b6166495ad1fd1f93127a6ad313833a25c38f98bab0c9b4acc95d/geoarrow_c-0.3.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:49b0cf15d73223138fae38b6f8426897c3352006d2b4216be55d5c38383fb5d5", size = 574941, upload-time = "2025-10-10T03:05:37.628Z" }, - { url = "https://files.pythonhosted.org/packages/66/ec/ffd43f0671a5c7d46776afe4a3d15d21a04206339df3054ef676b3c36fbf/geoarrow_c-0.3.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:d0bab5f31ad17e7c6baaf2a7a0e65b67011e1b008daf4bd4ecbf9172085f0a20", size = 560325, upload-time = "2025-10-10T03:05:29.035Z" }, - { url = "https://files.pythonhosted.org/packages/74/05/c28749e651921e469d22c06c694b3e42dac5605228ac1c34add3371bb4ba/geoarrow_c-0.3.1-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:0700091e9bbb0ffdee37e5ac59ef2a38aab5683e33df14f99a7bfec487dd12f1", size = 1910515, upload-time = "2025-10-10T03:04:48.188Z" }, - { url = "https://files.pythonhosted.org/packages/2a/c8/71f5632a1912551e0f1a04280c7a14fa6378f01b3fe849d78bb3817226a2/geoarrow_c-0.3.1-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:3aa9370ac8bb295fc192c70f499502e8ae419b335fbe29ecb344a2a368f3afb1", size = 1949508, upload-time = "2025-10-10T03:05:11.23Z" }, - { url = "https://files.pythonhosted.org/packages/e7/e4/e7a4de01e1ac1cbcf8e20f4747182a5c2d8655a0532c1e3eada1182904b1/geoarrow_c-0.3.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:434536677f328923ea9be366824abe6fd177881eb46ebcf7cca4d7b73546cf0c", size = 2846395, upload-time = "2025-10-10T03:04:49.857Z" }, - { url = "https://files.pythonhosted.org/packages/7f/c8/f62fbad76e8baf7209b8f20fa849457a7b493639f5b0ec4343b69ebcf554/geoarrow_c-0.3.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:08d48af947d76a983c6cbaf05587c106d81149fad63c18ac644b72c599e70711", size = 2947165, upload-time = "2025-10-10T03:05:12.321Z" }, - { url = "https://files.pythonhosted.org/packages/14/8a/dda4390f01ebc29a8a4b2190f132e9e251afecdb12afe1c0143f3525b0b2/geoarrow_c-0.3.1-cp312-cp312-win32.whl", hash = "sha256:bee0205900f3b88f6a3e833ab08007b654298840bd9e4e39f6aa1595cf294f1e", size = 430547, upload-time = "2025-10-10T03:06:02.895Z" }, - { url = "https://files.pythonhosted.org/packages/36/1f/63d7d5491f1dc81e6c793276b898b983824faa6167616ed4130477d4629e/geoarrow_c-0.3.1-cp312-cp312-win_amd64.whl", hash = "sha256:b9101c94ee44687f2c62ce3cc55acef99bb032b0653e17ab12c83f3505f8b4b9", size = 451193, upload-time = "2025-10-10T03:05:46.211Z" }, - { url = "https://files.pythonhosted.org/packages/1b/fb/a153ad1381899459442b46c028819bc945837459bc8d7e0847c74bd375d9/geoarrow_c-0.3.1-cp312-cp312-win_arm64.whl", hash = "sha256:be77085242d5db5f85271da15a1aa5adc84c30e198691af04490b4fa91f09a8b", size = 424403, upload-time = "2025-10-10T03:05:55.602Z" }, - { url = "https://files.pythonhosted.org/packages/f4/66/f408e4c5cea55d056657ff3a8ae46ca1c9f47adb4d4edeffaacbdccd940d/geoarrow_c-0.3.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:105ce761cf7e59b335ebff256f7d65ae7ddedda587bc1c5a63191169f14a18ef", size = 576484, upload-time = "2025-10-10T03:05:38.585Z" }, - { url = "https://files.pythonhosted.org/packages/9c/ba/d3a5e04f9ebd511dd5e269af2b4227463b7327a17a817267d64fadbfe662/geoarrow_c-0.3.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:ea64cb38ae2af47973a28c7d36ac089f35dcf2916765511aace63fc2c868f39a", size = 566953, upload-time = "2025-10-10T03:05:29.998Z" }, - { url = "https://files.pythonhosted.org/packages/8c/24/9b956c023046f7c082347d57de6d11683d713b4b4a6edf92b364f551da1f/geoarrow_c-0.3.1-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e5849c656a8ab8359215befbaaf197a0e2eddfa3b030ee11f49a58c985c4c59c", size = 1955242, upload-time = "2025-10-10T03:04:51.061Z" }, - { url = "https://files.pythonhosted.org/packages/01/b0/7226069e909fb54c9b799ea6f5ff97c500c689311bd0b81eabf22f5c6eec/geoarrow_c-0.3.1-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:3b2b90b22caf3756e63f7038a4277368865e3541101872ba73e38cebd462c790", size = 1995358, upload-time = "2025-10-10T03:05:13.477Z" }, - { url = "https://files.pythonhosted.org/packages/dc/0d/01d32c9b57f86fdb38aca62ec29c24c02c324982d7fa8108e38744ec460f/geoarrow_c-0.3.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:a1f544cf77a724f7853a0bb167640915a458dbce802dc0869f3f40968f2022cf", size = 2884255, upload-time = "2025-10-10T03:04:52.2Z" }, - { url = "https://files.pythonhosted.org/packages/88/d1/51e16079cb33cb2271717391585f95002930a2886e7f43127f9a1b644711/geoarrow_c-0.3.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:15b1b920b01532903bc11a1fac351cb93d12b6965a97b365f2c88e1667ef488d", size = 2988622, upload-time = "2025-10-10T03:05:14.751Z" }, - { url = "https://files.pythonhosted.org/packages/d4/79/f57f8f8971770285d62d5d76afe42bca248a25304fbc4733bac58d14ab0e/geoarrow_c-0.3.1-cp313-cp313-win32.whl", hash = "sha256:1664774a1540721ab42ac3131a9e0941e6394ba4f82e408f7ce27800cbd1aed2", size = 431565, upload-time = "2025-10-10T03:06:03.778Z" }, - { url = "https://files.pythonhosted.org/packages/b5/de/2b53a0c1a3b7641f2662a69089a0bb15fd7e7d25b04a92d2330a73a4de96/geoarrow_c-0.3.1-cp313-cp313-win_amd64.whl", hash = "sha256:dd13290d9fab82e7c6470da6ec6ee0f4a2e1d05a6b4050650c71f5bfb2b023e9", size = 455825, upload-time = "2025-10-10T03:05:47.245Z" }, - { url = "https://files.pythonhosted.org/packages/53/e1/1b99b2252163fc68197fd0514087569ca610a75e0926716a4c591803822a/geoarrow_c-0.3.1-cp313-cp313-win_arm64.whl", hash = "sha256:ab4511159b0405c1b094b631c259ad07a16b4f1a3b84d453999e9dc60c302397", size = 427610, upload-time = "2025-10-10T03:05:56.549Z" }, - { url = "https://files.pythonhosted.org/packages/3f/e9/36e6cfeeb1713c1f1b409e81065a2011a4a1c618cebc663153cedae47e0a/geoarrow_c-0.3.1-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:8204245dd903f99fcd2f9309c1103392d1150735a2221f02575b07a5c66fa285", size = 577089, upload-time = "2025-10-10T03:05:39.69Z" }, - { url = "https://files.pythonhosted.org/packages/f2/f1/b6aae1316d28a44b9604a66cc4f3a7b38f0f1e7ef86e68e1e6a7c7e13ea7/geoarrow_c-0.3.1-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:4a69d707e21d7d2acdbd61eb11df7b052ce1b6c08cd92793c329342d4e501ce7", size = 567589, upload-time = "2025-10-10T03:05:30.965Z" }, - { url = "https://files.pythonhosted.org/packages/a4/a3/0d68cb5eff8e18bfdf8b6a624678e36ed4c47b2a32d5a27d48e0f130e7e0/geoarrow_c-0.3.1-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:80060160896849351f998b77b536853e91cc8eaddc13fedd5785b2459f9ce0a0", size = 1953668, upload-time = "2025-10-10T03:04:53.838Z" }, - { url = "https://files.pythonhosted.org/packages/f1/56/f12733a85737688a74029fd598a15e5f97fff999210d395fd25e3d70ae58/geoarrow_c-0.3.1-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:1c566c80aec907de482f9b87095b6f026a69538ff37cf701a7efbcaee6ba5389", size = 1988200, upload-time = "2025-10-10T03:05:16.355Z" }, - { url = "https://files.pythonhosted.org/packages/ea/b5/1529f5d8cc892790c3524252f6961e0887a6116a9c8b1f8c4f6441c5b95f/geoarrow_c-0.3.1-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:775615b2e77d7615ca23ac37f3a00ae11696eed3bb2a1e153a5cc094c662799f", size = 2883956, upload-time = "2025-10-10T03:04:55.185Z" }, - { url = "https://files.pythonhosted.org/packages/8b/0d/d269507838d049ffb090108d2000c4638f9a27606fdaee74ff6d6b400b29/geoarrow_c-0.3.1-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:ec1f29501d9d28c2642b0f84b2a1b958e3332375ebf1c6f2d7cb1b3876daa500", size = 2982956, upload-time = "2025-10-10T03:05:17.633Z" }, - { url = "https://files.pythonhosted.org/packages/09/46/d1fc8d114ca713d9f25b0a130fa1e2a5f250b75680020cf63c610044a7eb/geoarrow_c-0.3.1-cp314-cp314-win32.whl", hash = "sha256:e3a310a06edebb7289785cdab19a9e64a11150644d3b657c23125aafe404f0d4", size = 436258, upload-time = "2025-10-10T03:06:04.953Z" }, - { url = "https://files.pythonhosted.org/packages/7d/48/33c41748a4f7dd461745b7fbedb19e81f773771144d851e12ff12b2fc546/geoarrow_c-0.3.1-cp314-cp314-win_amd64.whl", hash = "sha256:86f87599950abe7412a85a20fd5a045a859e7bb8f69d9376ccaa3c3a7cbf293a", size = 460679, upload-time = "2025-10-10T03:05:48.491Z" }, - { url = "https://files.pythonhosted.org/packages/87/21/c7d14179893f83c76b528276aeeefc5f6ed3409ea0ef723d8e157840dd8d/geoarrow_c-0.3.1-cp314-cp314-win_arm64.whl", hash = "sha256:6502ab08968f427e94e267ae223020c0c5eb7a09db00885e349a6fab3fe632c6", size = 433657, upload-time = "2025-10-10T03:05:57.449Z" }, - { url = "https://files.pythonhosted.org/packages/f0/87/96bda2d65fa1da8a27f11f56bfd5d99f335829ab9892149a68acc04bf04e/geoarrow_c-0.3.1-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:9bafb69791a1ca78273b0f69ab7358d1ec90e5fa80b20816fb8b7228c107bf42", size = 584495, upload-time = "2025-10-10T03:05:40.686Z" }, - { url = "https://files.pythonhosted.org/packages/5e/a8/772aa9c0df3e285d14eb4ae1c47d310b4c2dcc8ad96225f16841d86613c3/geoarrow_c-0.3.1-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:dcf61d7b35999c3fbde3152a3774ba5b6633dbcbe7fc40fea385a96ff3b5f42a", size = 576697, upload-time = "2025-10-10T03:05:31.987Z" }, - { url = "https://files.pythonhosted.org/packages/2e/ad/8b10f728f2b0467c9859b1170dcc4c460350f935bb6600842d7bbd51b377/geoarrow_c-0.3.1-cp314-cp314t-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:24da8395d5b298f2071f54497d876645daad5bee78fcf627bee746dc425cba2b", size = 1992239, upload-time = "2025-10-10T03:04:56.306Z" }, - { url = "https://files.pythonhosted.org/packages/73/69/521cf08fa59d1d492b9906b7d43238bbb0b50e9d5a119b94af6ce89cfc3c/geoarrow_c-0.3.1-cp314-cp314t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:82350f13e1a31d1d4825fb65e6efb8d1b0368c17ddf5145d81049c532e3a1198", size = 1988446, upload-time = "2025-10-10T03:05:18.901Z" }, - { url = "https://files.pythonhosted.org/packages/d9/56/abee559124e989d9f60101aedb8385e13bc808ffaabdb711ee77f27bbf7a/geoarrow_c-0.3.1-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:0eb54b4d6ecddfdfdf726fefbed477b64b006873523c014d73b7d3b37818592c", size = 2901820, upload-time = "2025-10-10T03:04:57.524Z" }, - { url = "https://files.pythonhosted.org/packages/7a/39/dab9032f617c5e6bec8a1bfe2037fd26853576c958c75af2aacfc76bb7ac/geoarrow_c-0.3.1-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:aa17482255471b2d954866588480aa5a494d41fc3f8e00a8ab6f25d25b06157d", size = 2975926, upload-time = "2025-10-10T03:05:20.669Z" }, - { url = "https://files.pythonhosted.org/packages/b8/60/ce8fbc75f1d6dab9faccbd002bb11eaa2d584df948bc33a4abca15df6aa3/geoarrow_c-0.3.1-cp314-cp314t-win32.whl", hash = "sha256:dea8b9e16699909725e80c214ca4b4968b4c512213816876fae9e56087cf1f57", size = 452711, upload-time = "2025-10-10T03:06:06.012Z" }, - { url = "https://files.pythonhosted.org/packages/91/2d/fb9923dcb9f04f8ee4479ca9e1c601e1327cdeb63cc67c25d0bf3c1465df/geoarrow_c-0.3.1-cp314-cp314t-win_amd64.whl", hash = "sha256:3394440734affd699dfa766eeaec1e53d76d0fe1ece5f5ee3c80e06a0e647abf", size = 482826, upload-time = "2025-10-10T03:05:49.903Z" }, - { url = "https://files.pythonhosted.org/packages/65/c4/c96e10f0e26ec59fe89470686486f6ef75d13b8de4ee423cefd9b4ae8823/geoarrow_c-0.3.1-cp314-cp314t-win_arm64.whl", hash = "sha256:430a177b6a2145f0bcf7e39d575f2e01352608054f848e53198bfda7f59e59fb", size = 442172, upload-time = "2025-10-10T03:05:58.508Z" }, -] - -[[package]] -name = "geoarrow-pyarrow" -version = "0.3.0" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "geoarrow-c" }, - { name = "geoarrow-types" }, - { name = "pyarrow" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/d0/cc/3e68442f995188beae12ccd3849f92a23df60829f0456e63f2a0ed1a8b47/geoarrow_pyarrow-0.3.0.tar.gz", hash = "sha256:8d01902ba83015e7b7286c884c6ee2126d006fdfa8f70bd1c104bf924ef94aa1", size = 34799, upload-time = "2026-09-28T03:21:06.848Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/6d/aa/ad595ff8a2130a70175321e9e67f6a1bab02e4f90356a2e4f1053577359a/geoarrow_pyarrow-0.3.0-py3-none-any.whl", hash = "sha256:accfcaafb5b2914bd2df14e605ea75dc803b6ead5e7308a013fba502392af198", size = 26158, upload-time = "2026-09-28T03:21:05.547Z" }, -] - [[package]] name = "geoarrow-types" version = "0.3.0" @@ -4550,7 +4483,7 @@ gcsfs = [ { name = "gcsfs" }, ] geoarrow = [ - { name = "geoarrow-pyarrow" }, + { name = "geoarrow-types" }, ] glue = [ { name = "boto3" }, @@ -4662,7 +4595,7 @@ requires-dist = [ { name = "duckdb", marker = "extra == 'duckdb'", specifier = ">=0.5.0" }, { name = "fsspec", specifier = ">=2023.1.0" }, { name = "gcsfs", marker = "extra == 'gcsfs'", specifier = ">=2023.1.0" }, - { name = "geoarrow-pyarrow", marker = "extra == 'geoarrow'", specifier = ">=0.2.0" }, + { name = "geoarrow-types", marker = "extra == 'geoarrow'", specifier = ">=0.3.0" }, { name = "google-auth", marker = "extra == 'gcp-auth'", specifier = ">=2.4.0" }, { name = "google-cloud-bigquery", marker = "extra == 'bigquery'", specifier = ">=3.33.0,<4" }, { name = "huggingface-hub", marker = "extra == 'hf'", specifier = ">=0.24.0" },