dongjoon-hyun opened a new pull request, #506: URL: https://github.com/apache/spark-connect-swift/pull/506
### What changes were proposed in this pull request? This PR removes the force casts (`as!`) from `DataFrame.collect()` and `DataFrame.show(_:_:_:)`. - Per-value casts (`int64`, `date32`) use `as?`, like their sibling branches. - Per-column casts (`ArrowTypeTime64`, `ArrowTypeTimestamp`, `AsString` for `binary`/`struct`) throw `SparkConnectError.invalidArrowData`. - `show(_:_:_:)` folds the `String` cast into its existing `guard`. ### Why are the changes needed? A force cast traps and kills the process. Since these casts apply to Arrow data received from a server, unexpected data crashes the host application. Both methods already `throws`, so callers can handle the error instead. ### Does this PR introduce _any_ user-facing change? Yes, only where it previously crashed: `int64`/`date32` cells become `nil`, and the other cases throw `SparkConnectError.invalidArrowData`. No change for valid Arrow data. ### How was this patch tested? Pass the CIs and manual tests with `apache/spark:4.2.0` Spark Connect server. ``` swift build -c release swift test --no-parallel -c release --filter "DataFrameTests|RowTests|CreateDataFrameTests|DataTypeTests" ``` ### 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]
