Skip to content

[SPARK-55790][Geo][SQL] Build a complete SRS registry using PROJ 9.7.1 data#54571

Open
uros-db wants to merge 2 commits intoapache:masterfrom
uros-db:geo-proj
Open

[SPARK-55790][Geo][SQL] Build a complete SRS registry using PROJ 9.7.1 data#54571
uros-db wants to merge 2 commits intoapache:masterfrom
uros-db:geo-proj

Conversation

@uros-db
Copy link
Contributor

@uros-db uros-db commented Mar 2, 2026

What changes were proposed in this pull request?

Build a more complete Spatial Reference System (SRS) registry in Spark, introducing 10000+ entries sourced from the PROJ library's EPSG and ESRI databases, which will unlock substantially improving the breadth of geospatial type support.

Why are the changes needed?

This will enable Geometry and Geography types to support 10000+ additional SRID/CRS values, both in JVM and Python. Note that currently Geometry and Geography types offer only limited SRID support (a few hardcoded values).

Does this PR introduce any user-facing change?

No.

How was this patch tested?

The script and auto-generated golden files are self-contained.

Was this patch authored or co-authored using generative AI tooling?

Yes, Claude 4.6 Opus.

Copy link
Contributor Author

@uros-db uros-db left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@szehon-ho @cloud-fan Please review.

Copy link
Contributor Author

@uros-db uros-db left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docker integration failure seems unrelated to these changes.

Copy link
Member

@szehon-ho szehon-ho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. the pr has two generatedcsv which is very big. just wondering, is there no way to have one generated one, and copy it at build time?
  2. do we plan to run it just manually? I guess proj does not release that frequently that its worth to automate it?

@@ -0,0 +1,377 @@
#!/usr/bin/env python3
Copy link
Member

@szehon-ho szehon-ho Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we use hyphen delimiter for this script name, like other dev scripts?

url = PROJ_RAW_URL.format(version=version, filename=filename)
print(f" Downloading {url}")
try:
with urllib.request.urlopen(url) as response:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to add an overridable timeout, to not hang the script (if we ever call it from a build job, for example)

'geocentric', 'other' -> non-geographic

Returns a list of (srid, string_id, is_geographic) tuples,
excluding deprecated entries and entries with non-numeric codes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it right? I dont see the script filtering deprecated entries?

try:
with urllib.request.urlopen(url) as response:
return response.read().decode("utf-8")
except urllib.error.HTTPError as e:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we catch other error like, URLError?


print()

# Deduplicate: keep the first occurrence of each SRID.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this happen? should we comment which gives precedence (ESPG/ESRI)

if not match:
continue
fields = parse_sql_values(match.group(1))
auth_name = fields[0]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: add a check for fields length

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.

2 participants