dongjoon-hyun opened a new pull request, #487:
URL: https://github.com/apache/spark-connect-swift/pull/487
### What changes were proposed in this pull request?
This PR adds public schema model types — `DataType`, `StructType`, and
`StructField` — and changes `DataFrame.schema` to return a `StructType` instead
of a JSON string.
- `DataType` is an `indirect enum` covering all Spark Connect type kinds,
with `simpleString` for Spark SQL-style representations like `decimal(10,2)`
and `array<string>`.
- `StructType` holds an ordered list of `StructField`s
(`name`/`dataType`/`nullable`/`metadata`) and supports subscripts and
iteration. All types are `Sendable` and `Equatable`.
```swift
let schema = try await df.schema
for field in schema {
print("\(field.name): \(field.dataType.simpleString)
(nullable=\(field.nullable))")
}
```
### Why are the changes needed?
For feature parity with Scala/PySpark where `df.schema` returns a
traversable `StructType` instead of a raw JSON string.
### Does this PR introduce _any_ user-facing change?
Yes. `DataFrame.schema` now returns a `StructType` instead of a JSON
`String`.
### How was this patch tested?
Pass the CIs with newly added `DataTypeTests` and `StructTypeTests` suites
and the revised `DataFrameTests`.
### 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]