Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-44910: [Swift] Fix IPC stream reader and writer impl #45029

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

abandy
Copy link
Contributor

@abandy abandy commented Dec 14, 2024

Rationale for this change

Fixes IPC incorrect stream format issue.

Changes have been tested with:

  1. directions from GH-40488: [Swift] Add simple get swift example arrow-experiments#41 (comment)
  2. generated file using generate.py from https://github.com/apache/arrow-experiments/tree/main/data/rand-many-types (removed currently unsupported Swift types)

This PR includes breaking changes to public APIs.
Writer and reader APIs have changed:
Reader:
fromStream -> fromFileStream
Writer:
toStream -> toFileStream

@abandy abandy requested a review from kou as a code owner December 14, 2024 19:09
Copy link

⚠️ GitHub issue #44910 has been automatically assigned in GitHub to PR creator.

@kou kou changed the title GH-44910: [Swift] fix ipc stream reader and writer impl GH-44910: [Swift] Fix IPC stream reader and writer impl Dec 15, 2024
@@ -216,7 +216,67 @@ public class ArrowReader { // swiftlint:disable:this type_body_length
return .success(RecordBatch(arrowSchema, columns: columns))
}

public func fromStream( // swiftlint:disable:this function_body_length
public func fromMemoryStream( // swiftlint:disable:this function_body_length
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment that explains the difference between fromMemoryStream and fromFileStream?

var schemaMessage: org_apache_arrow_flatbuf_Schema?
while length != 0 {
if length == CONTINUATIONMARKER {
offset += Int(MemoryLayout<Int32>.size)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the size of length data?
How about using UInt32 not Int32 because length data is UInt32 not Int32?

@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting review Awaiting review labels Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants