Skip to content

[GH-2800] Add ST_SharedPaths across engines and GeoPandas - #3250

Merged
jiayuasu merged 10 commits into
apache:masterfrom
jiayuasu:feature/shared-paths
Aug 12, 2026
Merged

[GH-2800] Add ST_SharedPaths across engines and GeoPandas#3250
jiayuasu merged 10 commits into
apache:masterfrom
jiayuasu:feature/shared-paths

Conversation

@jiayuasu

@jiayuasu jiayuasu commented Aug 11, 2026

Copy link
Copy Markdown
Member

Did you read the Contributor Guide?

Is this PR related to a ticket?

  • Yes, and the PR name follows the format [GH-XXX] my subject.

Closes #2800.
Part of #2230.

What changes were proposed in this PR?

This PR adds a PostGIS-compatible ST_SharedPaths implementation for lineal geometries.

  • Implements the shared-path algorithm in the Java common module using robust overlay and spatially indexed source-segment lookup.
  • Returns a GeometryCollection containing:
    • same-direction shared paths as the first MultiLineString;
    • opposite-direction shared paths as the second MultiLineString.
  • Matches PostGIS behavior for direction bucketing, nulls, typed empty geometries, non-lineal input validation, mixed SRIDs, and dimensional handling.
    • A null operand returns null.
    • Typed empty inputs or inputs without a shared path return two empty MultiLineString components.
    • A non-empty result retains Z only when at least one input has Z and every returned path coordinate resolves to a finite source Z. Otherwise, the whole result is two-dimensional. M is always dropped.
    • For non-simple inputs that traverse a path more than once, direction follows the first matching source traversal, so swapping operands can change bucket membership.
  • Exposes ST_SharedPaths through:
    • Spark SQL and Spark Connect registration;
    • the Scala DataFrame API;
    • Python sedona.spark.sql.st_functions;
    • Flink SQL;
    • Snowflake legacy WKB and native GEOMETRY APIs.
  • Prevents generation of a Snowflake GEOGRAPHY overload because this planar lineal operation is supported only for GEOMETRY. The native GeoJSON bridge's SRID limitation is documented.
  • Adds distributed GeoSeries.shared_paths, including scalar-geometry handling, positional and index-based alignment, duplicate MultiIndex support, CRS warnings, and GeoDataFrame delegation.
  • Adds Spark, Flink, and Snowflake API documentation, summary-table entries, and three detailed SVG examples covering direction buckets, multipart noding, and point-only intersections.

How was this patch tested?

  • Passed all 1,271 tests in the common module, including 20 dedicated SharedPathsTest cases.
  • Passed the Spark SQL suite: 236 tests.
  • Passed the Spark DataFrame API suite: 260 tests.
  • Passed targeted Flink and Snowflake DDL-generation tests.
  • Passed focused GeoPandas regression tests on GeoPandas 1.0.1 and 1.1.3.
  • Passed targeted Python DataFrame API tests.
  • Verified direction and ordinate behavior across 520 deterministic lineal reference cases, including the large-coordinate near-parallel regression.
  • Passed Spotless, Markdown lint, MkDocs static build, repository hooks, and git diff --check.

The credentialed Snowflake integration suites were not run locally.

Did this PR include necessary documentation updates?

  • Yes, I am adding a new API and used the current SNAPSHOT version, v2.0.0.
  • Yes, I updated the Spark, Flink, and Snowflake documentation and function summary tables.

@jiayuasu jiayuasu added this to the sedona-2.0.0 milestone Aug 12, 2026
@jiayuasu
jiayuasu marked this pull request as ready for review August 12, 2026 03:07
@jiayuasu
jiayuasu merged commit bd0afed into apache:master Aug 12, 2026
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ST_SharedPaths function

1 participant