You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "dongjoon-hyun (via GitHub)" <gi...@apache.org> on 2026/08/07 18:22:29 UTC

[PR] [SPARK-58648] Support StructType in schema, createDataFrame, and to APIs [spark-connect-swift]

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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-58648] Support StructType in schema, createDataFrame, and to APIs [spark-connect-swift]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #488:
URL: https://github.com/apache/spark-connect-swift/pull/488#issuecomment-5221022863

   Thank you, @viirya , always!


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-58648] Support StructType in schema, createDataFrame, and to APIs [spark-connect-swift]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #488:
URL: https://github.com/apache/spark-connect-swift/pull/488#issuecomment-5221029768

   Merged to main


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-58648] Support StructType in schema, createDataFrame, and to APIs [spark-connect-swift]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun closed pull request #488: [SPARK-58648] Support StructType in schema, createDataFrame, and to APIs
URL: https://github.com/apache/spark-connect-swift/pull/488


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org