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

   ### What changes were proposed in this pull request?
   
   This PR adds `StructType` overloads to the four schema-taking APIs which 
previously accepted only DDL strings, as a follow-up of #487 ([SPARK-58647]).
   
   - `DataFrameReader.schema(_ schema: StructType)`
   - `DataStreamReader.schema(_ schema: StructType)`
   - `SparkSession.createDataFrame(_ data: [[Sendable?]], _ schema: StructType)`
   - `DataFrame.to(_ schema: StructType)`
   
   Following the Scala client implementation, the reader and `createDataFrame` 
overloads convert the schema via the newly added public 
`StructType.toDDL`/`StructField.toDDL` (Catalyst `toDDL` format with 
backtick-quoting and `NOT NULL`) and reuse the existing DDL-string paths, while 
`DataFrame.to` converts the model directly to the protobuf `DataType` (like 
`DataTypeProtoConverter.toConnectProtoType`) and requires no server round-trip.
   
   ```swift
   let schema = StructType(fields: [
     StructField(name: "id", dataType: .integer, nullable: false),
     StructField(name: "name", dataType: .string),
   ])
   let df = try await spark.createDataFrame([[1, "Alice"], [2, nil]], schema)
   ```
   
   ### Why are the changes needed?
   
   For feature parity with the Scala/PySpark clients where all schema-taking 
APIs accept a `StructType` object, so users can build and pass schemas 
programmatically instead of assembling DDL strings by hand.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. This adds new APIs (`StructType` overloads and `toDDL`) without changing 
existing behavior.
   
   ### How was this patch tested?
   
   Pass the CIs with the newly added test cases.
   
   ### 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