dongjoon-hyun opened a new pull request, #469:
URL: https://github.com/apache/spark-connect-swift/pull/469

   ### What changes were proposed in this pull request?
   
   This PR aims to support `GEOMETRY` and `GEOGRAPHY` types (added in Apache 
Spark 4.1) in
   `DataType.simpleString` so that `DataFrame.dtypes` works on geospatial 
columns.
   
   Following Apache Spark's `GeometryType`/`GeographyType.typeName` convention, 
the mapping uses
   `geometry(<srid>)`/`geography(<srid>)` for fixed-SRID types and 
`geometry(any)`/`geography(any)`
   for the mixed-SRID case (`srid == -1`).
   
   ### Why are the changes needed?
   
   `Spark_Connect_DataType`'s `geometry` and `geography` kinds fell through to 
the `default:` branch
   of `DataType.simpleString` and threw `SparkConnectError.InvalidType`. As a 
result,
   `DataFrame.dtypes` failed entirely on any DataFrame containing a geospatial 
column.
   
   ```swift
   let df = try await spark.sql("SELECT 
st_geomfromwkb(X'0101000000000000000000F03F0000000000000040')")
   try await df.dtypes  // Before: throws SparkConnectError.InvalidType
                        // After: [("st_geomfromwkb(...)", "geometry(0)")]
   ```
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, `DataFrame.dtypes` no longer throws on geospatial columns and returns 
Spark-style type
   strings instead. This is a bug fix from the unreleased perspective.
   
   ### How was this patch tested?
   
   Pass the CIs with a newly added test case, `dtypesGeospatial`, which 
verifies `geometry(0)`,
   `geometry(4326)`, and `geography(4326)` against Apache Spark 4.2.0 (guarded 
for `4.2+` servers).
   Manually verified against a local `apache/spark:4.2.0` Spark Connect server.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Fable 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]

Reply via email to