dongjoon-hyun opened a new pull request, #528:
URL: https://github.com/apache/spark-connect-swift/pull/528
### What changes were proposed in this pull request?
This PR aims to support 5 geospatial ST functions (10 overloads).
| Function | Since | Signature |
| --- | --- | --- |
| `st_asbinary` | 4.1.0 | `(Column)` |
| `st_asbinary` | 4.2.0 | `(Column, String \| Column)` |
| `st_geogfromwkb` | 4.1.0 | `(Column)` |
| `st_geomfromwkb` | 4.1.0 | `(Column)` |
| `st_geomfromwkb` | 4.2.0 | `(Column, Int32 \| Column)` |
| `st_setsrid` | 4.1.0 | `(Column, Int32 \| Column)` |
| `st_srid` | 4.1.0 | `(Column)` |
The functions live in a new `GeospatialFunctions.swift`.
Where the upstream argument is `Union[Column, int]` or `Union[Column, str]`,
both a Swift
primitive and a `Column` overload are provided, following the existing
`regexp_extract`
precedent. `srid` is taken as `Int32` because `lit(Int)` produces a `long`
literal in this
client, while the ST functions expect an `INTEGER`.
Note that the optional arguments of `st_asbinary` and `st_geomfromwkb` were
added later than
the functions themselves:
- `st_asbinary(geo, endianness)` is `@since 4.2.0` (SPARK-56682).
- `st_geomfromwkb(wkb, srid)` is `@since 4.2.0` (SPARK-55295). The PySpark
docstring is
missing the corresponding `versionchanged:: 4.2.0` note, but the commit is
only contained
in `v4.2.0` and later tags.
### Why are the changes needed?
To improve API coverage. `DataType` already models `.geometry(srid:)` and
`.geography(srid:)`,
and `DataFrameTests.dtypesGeospatial` already exercises the server behavior
through raw SQL
strings, but no ST function was available in this client.
### Does this PR introduce _any_ user-facing change?
No, this is a new addition to the API.
### How was this patch tested?
Pass the CIs with the newly added test suite, `GeospatialFunctionsTests`.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Opus 5
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]