Skip to content

[GH-3124] Prepare shared Spark sources and spatial boundaries - #3525

Merged
jiayuasu merged 7 commits into
apache:masterfrom
jiayuasu:codex/oss-spatial-boundary-preparation
Nov 10, 2026
Merged

jiayuasu merged 7 commits into
apache:masterfrom
jiayuasu:codex/oss-spatial-boundary-preparation

Conversation

@jiayuasu

@jiayuasu jiayuasu commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Did you read the Contributor Guide?

Yes, I have read the Contributor Rules and Contributor Development Guide.

Is this PR related to a ticket?

Related to #3124. Consolidated preparation for #3391. This PR includes the source-sharing changes from #3526 and shared-result test changes from #3531; those PRs are superseded by this one.

What changes were proposed in this PR?

Prepare the existing Spark implementation for the native spatial boundary in one reviewable change:

  • Centralize the DataFrame/spatial-RDD geometry conversions used by Adapter, StructuredAdapter, and DfUtils behind the version-selected SpatialTypeSupport implementation. The selected implementation retains existing GeometryUDT schemas and JTS values. Its scala-spatial-udt source set names the supported Sedona UDT implementation explicitly.
  • Share the three unchanged Arrow UDF sources from spark/shared/src/main/scala-spark-4 across Spark 4.0 and 4.1, removing the duplicate Spark 4.0 copies. Share the unchanged Spark 4.1 parser from spark/shared/src/main/scala-spark-4.1 while retaining ownership in the version-specific module. Spark 4.2 can reuse both source roots.
  • Adapt shared geometry-result tests through SpatialTestValues and toGeometrySeq, preserving the existing values, layouts and test coverage.

The build, Spotless and Scalastyle configuration includes the shared source roots. The parser and SpatialTypeSupport behavior are unchanged. This does not enable native types or change SQL, RDD/index, or S2 serialization. The SQL ISO WKB migration remains in #3528.

How was this patch tested?

Previous-head validation at c92a66fa331c5791c0bce86098eb34783305ebdc used clean shaded builds and focused suites on Spark 3.5.8/Scala 2.12 and Spark 4.1.1/Scala 2.13:

  • Each runtime passed 373 Scala adapter/result/function/join checks and 10 Java adapter checks; one existing Scala test remains ignored.
  • Each runtime passed 11 version-module parser, cast and embedded Python Arrow strategy checks. Seven SQL-cast checks retain their existing parser-capability cancellations.
  • mvn -B -pl spark-shaded -am -Dspark=<3.5|4.1> -Dspark.version=<3.5.8|4.1.1> -Dscala=<2.12|2.13> -DskipTests clean install passed for both profiles.
  • mvn -B -pl spark/common ... -Dtest=adapterTestJava -Dsuites=<SpatialAdapterBoundaryTest,adapterTestScala,structuredAdapterTestScala,SpatialTestValuesTest,functionTestScala,predicateJoinTestScala,BroadcastIndexJoinSuite> verify and version-module SQLSyntaxTestScala, Box2DCastSuite, Box3DCastSuite, StrategySuite passed for both profiles.
  • Spotless, Scalastyle, commit hooks and git diff --check passed at that head.

Those 788 passing checks describe the preceding preparation head. The three shared Arrow sources preserve their original bytes; source inspection confirms one copy of each class in each Spark 4.0/4.1 build and unchanged parser and SpatialTypeSupport sources.

Previous-head validation at a6640a89a37449df6e37be3332be4edb170cdc08: clean shaded packaging passed on Spark 4.0.2 and 4.1.1 / Scala 2.13. Spark 4.0.2 passed 18 version-module JVM tests and 14 Python Arrow tests; Spark 4.1.1 passed 11 JVM tests and 14 Python Arrow tests, with the same seven parser-option assumptions canceled. Both jars contain exactly one copy of each relocated class and companion, and runtime-loaded class origins and bytes match the freshly built artifacts. Spotless, Scalastyle, repository commit hooks and git diff --check passed. All applicable CI at that previous head passed, including the JVM matrix, Python matrix, wheel builds, PyFlink and pre-commit. Exact commands and reports are retained outside the repository.

Previous-head parser relocation validation at 61a757ae910b70f2b3b7b60347b64ab4ca253bea: a clean Spark 4.1.1/Scala 2.13 shaded reactor install and spark/spark-4.1 verify passed all 18 version-module tests, with no cancellations. The parser source is byte-identical before and after the move. Packaged-runtime probes verified parsing and internal execution with the extension enabled; parser/helper classes occur once in the version and shaded artifacts, are absent from the common artifact, and loaded class origins and bytes match the fresh jar. Spotless, Scalastyle, normal commit hooks and git diff --check passed. The prior Arrow/shared-suite results above were not rerun for this source-only move. All 42 applicable checks at that previous head passed, including the JVM and Python matrices. Only the release-only upload_pypi job was intentionally skipped.

Current-head UDT naming validation at ec6166d2c8ece85a2052d4d43f4474c1c42bc08c: clean Spark 4.1.1/Scala 2.13 shaded packaging and all five SpatialAdapterBoundaryTest cases passed using the default udt selector. The moved Scala source is byte-identical; the common and shaded jars each contain exactly one matching SpatialTypeSupport class and companion. Compilation, Spotless, Scalastyle, normal commit hooks and whitespace checks passed. Fresh CI is pending.

Did this PR include necessary documentation updates?

No public behavior or API change. The boundary and shared source configuration are documented in code; the public native migration guide belongs to #3391.

@jiayuasu jiayuasu changed the title [GH-3124] Isolate DataFrame and spatial RDD geometry boundaries [GH-3124] Prepare shared Spark sources and spatial boundaries Nov 8, 2026
Move the existing parser unchanged into the shared Spark 4.1 source root.
Keep compilation and Scalastyle in the version module, and remove the
obsolete common-module Spotless include.
@jiayuasu
jiayuasu marked this pull request as ready for review November 10, 2026 09:03
Use scala-spatial-udt and the matching default build selector.
The default UDT implementation remains supported on older Spark versions.
@jiayuasu jiayuasu added this to the sedona-2.0.0 milestone Nov 10, 2026
@jiayuasu
jiayuasu merged commit eaca763 into apache:master Nov 10, 2026
43 checks passed
jiayuasu added a commit to jiayuasu/sedona that referenced this pull request Nov 10, 2026
Record master eaca763 after the squash merge of apache#3525. Its complete
preparation delta matches ec6166d, which is already integrated here.
Preserve the validated native tree and its Spark 4.2 adaptations.
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.

1 participant