-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-54160][Geo][SQL] Implement the ST_SetSrid expression in SQL #52858
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uros-db
commented
Nov 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cloud-fan @mkaravel @szehon-ho Please review.
cloud-fan
reviewed
Nov 4, 2025
cloud-fan
reviewed
Nov 4, 2025
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/util/StUtilsSuite.java
Show resolved
Hide resolved
cloud-fan
approved these changes
Nov 4, 2025
szehon-ho
approved these changes
Nov 5, 2025
sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/util/Geography.java
Show resolved
Hide resolved
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryExecutionErrors.scala
Show resolved
Hide resolved
|
thanks, merging to master/4.1! |
cloud-fan
pushed a commit
that referenced
this pull request
Nov 5, 2025
### What changes were proposed in this pull request? Implement the `ST_SetSrid` expression in Catalyst, and add the corresponding `st_setsrid` SQL function. #### Description Returns a new `GEOGRAPHY` or `GEOMETRY` value whose `SRID` is the specified SRID value. #### Syntax ``` st_setsrid(geo, srid) ``` #### Arguments - `geo`: A `GEOGRAPHY` or `GEOMETRY` value. - `srid`: An `INTEGER` value. #### Returns - A value of type `GEOGRAPHY` or `GEOMETRY`. #### Notes - The function returns `NULL` if the input is `NULL`. - The function returns an `ST_INVALID_SRID_VALUE` error if the provided `srid` is not valid. #### Examples ``` > SELECT st_srid(st_setsrid(ST_GeogFromWKB(X'0101000000000000000000F03F0000000000000040'), 4326)); 4326 ``` ``` > SELECT st_srid(st_setsrid(ST_GeomFromWKB(X'0101000000000000000000F03F0000000000000040'), 3857)); 3857 ``` ### Why are the changes needed? ### Does this PR introduce _any_ user-facing change? Yes, a new SQL function is added: `st_setsrid`. ### How was this patch tested? New unit tests in Java/Scala suites: - `STExpressionsSuite.scala` - `StUtilsSuite.java` New end-to-end SQL tests: - `st-functions.sql` Finally, manually testing using Spark shell. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #52858 from uros-db/geo-ST_SetSrid. Authored-by: Uros Bojanic <[email protected]> Signed-off-by: Wenchen Fan <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Implement the
ST_SetSridexpression in Catalyst, and add the correspondingst_setsridSQL function.Description
Returns a new
GEOGRAPHYorGEOMETRYvalue whoseSRIDis the specified SRID value.Syntax
Arguments
geo: AGEOGRAPHYorGEOMETRYvalue.srid: AnINTEGERvalue.Returns
GEOGRAPHYorGEOMETRY.Notes
NULLif the input isNULL.ST_INVALID_SRID_VALUEerror if the providedsridis not valid.Examples
Why are the changes needed?
Does this PR introduce any user-facing change?
Yes, a new SQL function is added:
st_setsrid.How was this patch tested?
New unit tests in Java/Scala suites:
STExpressionsSuite.scalaStUtilsSuite.javaNew end-to-end SQL tests:
st-functions.sqlFinally, manually testing using Spark shell.
Was this patch authored or co-authored using generative AI tooling?
No.