Skip to content

[GH-3263] Deprecate ST_Force_2D and ST_Force3DZ alias function names - #3264

Open
james-willis wants to merge 1 commit into
apache:masterfrom
james-willis:james/deprecate-force-dim-aliases
Open

[GH-3263] Deprecate ST_Force_2D and ST_Force3DZ alias function names#3264
james-willis wants to merge 1 commit into
apache:masterfrom
james-willis:james/deprecate-force-dim-aliases

Conversation

@james-willis

Copy link
Copy Markdown
Collaborator

Did you read the Contributor Guide?

Is this PR related to a ticket?

What changes were proposed in this PR?

Deprecate the legacy alias function names ST_Force_2D (canonical: ST_Force2D) and ST_Force3DZ (canonical: ST_Force3D) on the Spark surface, as suggested in the review of apache/sedona-db#1162: rather than propagating alias-for-alias parity to other engines, deprecate the aliases with a warning giving the canonical name. Behavior is unchanged — the aliases keep working.

  • SQL users: a one-time-per-JVM WARN log when the deprecated expression is instantiated (new DeprecationWarning.warnOnce helper), since SQL users never see compile-time annotations.
  • Scala DataFrame API: @deprecated("Use ST_Force2D/ST_Force3D instead", "2.0.0") on the st_functions methods.
  • Python API: warnings.warn(..., DeprecationWarning) plus a .. deprecated:: docstring note; the internal GeoPandas force_2d use is switched to the canonical ST_Force2D so it doesn't warn.
  • Docs: the alias pages carry a deprecation warning admonition, the canonical pages no longer advertise the aliases, and the Geometry-Functions summary rows say "Deprecated alias of ...".

Discussion point — ST_Force3DZ: unlike ST_Force_2D (a pre-2.1 PostGIS name that PostGIS itself deprecated), ST_Force3DZ is the canonical name in current PostGIS (ST_Force3D is its alias there). Deprecating it trades PostGIS name-compatibility for a single canonical name in Sedona. Happy to drop the ST_Force3DZ half of this PR if PostGIS parity is preferred.

Flink and Snowflake register the same alias names; if this direction is accepted, those surfaces can follow up separately.

How was this patch tested?

spark/common compiles with the changes; the existing ST_Force_2D/ST_Force3DZ tests in functionTestScala and dataFrameAPITestScala continue to exercise the aliases (behavior is unchanged; the runtime warning is log-only). Python modules pass syntax checks; the alias functions still dispatch to the same JVM functions.

Did this PR include necessary documentation updates?

  • Yes, I have updated the documentation.

…names

Deprecate the legacy alias names on the Spark surface without changing
behavior, as suggested in the apache/sedona-db#1162 review: warn users
toward the canonical names (ST_Force2D, ST_Force3D) instead of
propagating alias-for-alias parity to other engines.

- One-time-per-JVM runtime warning when the deprecated SQL name is
  used (new DeprecationWarning.warnOnce helper) — the only channel
  that reaches SQL users
- @deprecated on the Scala DataFrame API methods
- DeprecationWarning + docstring note in the Python API; internal
  GeoPandas force_2d use switched to the canonical ST_Force2D
- Docs: deprecation admonitions on the alias pages, canonical pages
  no longer advertise the aliases, summary table rows updated
@jiayuasu

Copy link
Copy Markdown
Member

@james-willis PostGIS parity is strongly preferred. I think one important goal we want to achieve in Sedona 2.0 is the PostGIS and GeoPandas parity.

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.

Deprecate ST_Force_2D and ST_Force3DZ alias function names

2 participants