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/10/19 18:13:46 UTC
[PR] [SPARK-60353] Fix `Catalog` APIs to not crash on null values returned by the server [spark-connect-swift]
dongjoon-hyun opened a new pull request, #603:
URL: https://github.com/apache/spark-connect-swift/pull/603
### What changes were proposed in this pull request?
This PR aims to fix `Catalog` APIs to not crash on `null` values returned by the server, by removing all 24 force casts (`as!`) in `Catalog.swift`.
- `tableType` of `SparkTable` (`listTables`, `getTable`, `listViews`, `getView`, etc.) falls back to an empty string, like `Catalog.listFunctions`/`listDatabases` already do after SPARK-60063.
- The other required values (`name`, `isTemporary`, `partition`, table property keys, and the single-value results of `currentCatalog`, `currentDatabase`, `getCreateTableString`, `databaseExists`, etc.) now use the existing `Row.getAsString`/`Row.getAsBool`, which throw `SparkConnectError.InvalidType` instead of crashing the process.
### Why are the changes needed?
Previously, these APIs force-cast the server results with `as! String`/`as! Bool`, which crashes the client process when the server returns `null`.
```
Could not cast value of type 'Swift.Optional<Any>' to 'Swift.String'.
```
For example, Apache Spark's `Catalog.listTables` returns a `Table` with `tableType = null` when it fails to resolve a table or view, in order to return partial results (see `classic/Catalog.scala`). Third-party catalogs may also return `null` for other fields.
### Does this PR introduce _any_ user-facing change?
Yes. `SparkTable.tableType` is now an empty string instead of crashing when the server returns `null`. Other `null` required values now throw `SparkConnectError.InvalidType` instead of crashing. There is no API change because the field types of the public structs (`SparkTable`, `Database`, `Function`, `CatalogMetadata`, `TablePartition`) remain the same.
### How was this patch tested?
Pass the CIs.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Sonnet 5.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-60353] Fix `Catalog` APIs to not crash on null values returned by the server [spark-connect-swift]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun closed pull request #603: [SPARK-60353] Fix `Catalog` APIs to not crash on null values returned by the server
URL: https://github.com/apache/spark-connect-swift/pull/603
--
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-60353] Fix `Catalog` APIs to not crash on null values returned by the server [spark-connect-swift]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #603:
URL: https://github.com/apache/spark-connect-swift/pull/603#issuecomment-6275037793
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-60353] Fix `Catalog` APIs to not crash on null values returned by the server [spark-connect-swift]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #603:
URL: https://github.com/apache/spark-connect-swift/pull/603#issuecomment-6275029483
Thank you always, @viirya !
--
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