Skip to content

GeoPandas: implement distributed hilbert_distance #3257

Description

@jiayuasu

Summary

GeoPandas exposes GeoSeries.hilbert_distance and the corresponding GeoDataFrame active-geometry method for generating one-dimensional spatial-ordering keys from geometry-envelope midpoints. Sedona does not currently provide this API or a native SQL primitive with matching semantics.

Proposed changes

  • Add a native ST_HilbertDistance scalar function backed by JTS, returning the full unsigned 32-bit address range as Long.
  • Expose the function in Spark, Flink, Snowflake GEOMETRY, and Snowflake GEOGRAPHY APIs.
  • Implement distributed GeoSeries.hilbert_distance(total_bounds=None, level=16) and GeoDataFrame delegation.
  • Infer default midpoint bounds with one distributed metadata aggregation while keeping all per-row results distributed.
  • Preserve GeoPandas index/name behavior and document Spark's signed int64 representation.
  • Add cross-engine, parity, edge-case, and execution-plan tests plus SQL and GeoPandas documentation.

No geometry rows should be collected on the driver and no Python UDF should be introduced.

Part of #2230.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions