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

   ### What changes were proposed in this pull request?
   
   This PR makes `Row.getAsBool(_:)` throw `SparkConnectError.InvalidType` 
instead of
   trapping when the value is not a `Bool`, and adds a doc comment describing 
its
   throwing behavior.
   
   ### Why are the changes needed?
   
   `getAsBool(_:)` is a public API declared as `throws`, but a forced cast traps
   (crashes the process) rather than throwing when the value is not a `Bool`.
   Library users cannot catch a trap.
   
   This is reachable from server-controlled data: `Catalog` calls 
`getAsBool(0)` on
   the first column of a collected query result in `databaseExists`, 
`tableExists`,
   `functionExists`, `dropTempView`, `dropGlobalTempView`, `isCached`, and
   `clearCache`. If a server returns an unexpected column type, the client 
crashes
   instead of surfacing a catchable error.
   
   `SparkConnectError.InvalidType` already exists and is used for the same kind 
of
   type mismatch elsewhere (`DataType.swift`, `ConvertToArrow.swift`,
   `SparkSession.parseDDL`), so no new error case is introduced.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, this is a behavior change.
   
   `Row.getAsBool(_:)` previously crashed (trapped) on a type mismatch; it now
   throws `SparkConnectError.InvalidType`. Code that relied on the process
   terminating will now observe a thrown error instead. Since the function is
   already declared `throws`, no source-level signature change is required for
   callers. The success path is unchanged.
   
   ### How was this patch tested?
   
   Pass the CIs with a newly added test case in `RowTests`.
   
   ### 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