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

   ### What changes were proposed in this pull request?
   
   This PR aims to support the `DECIMAL` type in `createDataFrame` with 
`[[Sendable?]]` rows and a DDL schema string.
   
   - Add a `.decimal` case to `ConvertToArrow.toArrowColumn`, which uses the 
precision and scale of the schema.
   - Accept `Decimal` and integer values. Other values throw 
`SparkConnectError.InvalidType`.
   - Like `createDataFrame` with `Encodable` types, values are rounded 
`HALF_UP` to the scale, and values which do not fit in the precision throw an 
error.
   
   ### Why are the changes needed?
   
   Currently, `createDataFrame` throws `SparkConnectError.InvalidType` for 
`DECIMAL` columns.
   
   ```swift
   try await spark.createDataFrame([[Decimal(1)]], "id DECIMAL(10, 2)")
   ```
   
   ### Does this PR introduce _any_ user-facing change?
   
   No behavior change because previous it wasn't supported.
   
   `createDataFrame` now works with `DECIMAL(p, s)` columns. The results match 
Apache Spark 4.2.0 `createDataFrame(rows, schema)` in ANSI mode, which is the 
default.
   
   ### 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 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]

Reply via email to