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

   ### What changes were proposed in this pull request?
   
   This PR aims to respect `spark.sql.caseSensitive` when resolving column 
names in `DataFrame.collect(as:)`, like Scala `Dataset.as[T]`. If more than one 
column matches a property, it throws an `ArrowError` instead of silently taking 
the last column.
   
   | `spark.sql.caseSensitive` | Query | Scala `as[Person]` | Swift 
`collect(as: Person.self)` |
   |---|---|---|---|
   | `false` | `SELECT 'Alice' AS NAME, 30 AS AGE` | `Person(Alice,30)` | 
`Person(name: "Alice", age: 30)` |
   | `false` | `SELECT 'a' AS name, 'b' AS NAME, 30 AS age` | 
`AMBIGUOUS_REFERENCE` | `Column for key "name" is ambiguous, ...` |
   | `true` | `SELECT 'Alice' AS NAME, 30 AS AGE` | `UNRESOLVED_COLUMN` | 
`Column for key "name" not found` |
   | `true` | `SELECT 'a' AS name, 'b' AS NAME, 30 AS age` | `Person(a,30)` | 
`Person(name: "a", age: 30)` |
   
   ### Why are the changes needed?
   
   Previously, `collect(as:)` matched columns by exact name only. A column 
differing only in case threw `Column for key "name" not found`, or silently 
decoded to `nil` for Optional properties. Scala returns the value because 
`spark.sql.caseSensitive` is `false` by default.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No, `DataFrame.collect(as:)` is not released yet.
   
   ### 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