You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "abandy (via GitHub)" <gi...@apache.org> on 2025/01/17 02:23:05 UTC

Re: [PR] GH-44910: [Swift] Fix IPC stream reader and writer impl [arrow]

abandy commented on code in PR #45029:
URL: https://github.com/apache/arrow/pull/45029#discussion_r1919465645


##########
swift/Arrow/Sources/Arrow/ArrowReader.swift:
##########
@@ -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
+        _ fileData: Data,
+        useUnalignedBuffers: Bool = false
+    ) -> Result<ArrowReaderResult, ArrowError> {
+        let result = ArrowReaderResult()
+        var offset: Int = 0
+        var length = getUInt32(fileData, offset: offset)
+        var streamData = fileData
+        var schemaMessage: org_apache_arrow_flatbuf_Schema?
+        while length != 0 {
+            if length == CONTINUATIONMARKER {
+                offset += Int(MemoryLayout<Int32>.size)

Review Comment:
   I looked at the length var and it is already UInt32. From a couple of lines above: var length = getUInt32(fileData, offset: offset).  Please let me know if this matches what you are seeing.



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org