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/08/01 22:20:20 UTC

[PR] [SPARK-58496] Support field-name-based access in `Row` [spark-connect-swift]

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

   ### What changes were proposed in this pull request?
   
   This PR aims to support field-name-based access in `Row` like Scala's `GenericRowWithSchema`.
   
   - A new `RowSchema` class holds the field names and a name-to-index dictionary, shared by reference across all `Row`s of the same batch.
   - `Row` gains `fieldIndex(_:)`, `get(_ name:)`, `subscript(name:)`, and `asDict()`. For duplicate field names, the last one wins like Scala.
   - `DataFrame.collect()` attaches a `RowSchema` created from the Arrow schema to every `Row`.
   
   ### Why are the changes needed?
   
   Previously, `Row` only supported position-based access. This provides the equivalent of PySpark's `row["name"]`/`asDict()` and Scala's `fieldIndex(name)`.
   
   ```swift
   let rows = try await spark.sql("SELECT * FROM VALUES (1, 'abc') T(id, name)").collect()
   let id = try rows[0].get("id") as! Int32
   let name = try rows[0]["name"] as! String
   ```
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, this adds new public APIs. All existing APIs and behaviors are unchanged.
   
   ### How was this patch tested?
   
   Pass the CIs with newly added test cases.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Fable 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-58496] Support field-name-based access in `Row` [spark-connect-swift]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #467:
URL: https://github.com/apache/spark-connect-swift/pull/467#issuecomment-5153866010

   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-58496] Support field-name-based access in `Row` [spark-connect-swift]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun closed pull request #467: [SPARK-58496] Support field-name-based access in `Row`
URL: https://github.com/apache/spark-connect-swift/pull/467


-- 
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-58496] Support field-name-based access in `Row` [spark-connect-swift]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #467:
URL: https://github.com/apache/spark-connect-swift/pull/467#issuecomment-5153861483

   Thank you, @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