You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "kou (via GitHub)" <gi...@apache.org> on 2023/04/03 20:25:42 UTC

[GitHub] [arrow] kou commented on a diff in pull request #34842: GH-34858: [Swift] Initial reader impl

kou commented on code in PR #34842:
URL: https://github.com/apache/arrow/pull/34842#discussion_r1156400638


##########
swift/Arrow/Sources/Arrow/File_generated.swift:
##########


Review Comment:
   Should we add these generated files to this repository?
   Can we generate them in build time instead of adding them?



##########
swift/Arrow/Tests/ArrowTests/testdata.arrow:
##########


Review Comment:
   How did you create these test data?
   If you created them by using other Apache Arrow implementation such as C++ implementation, how about adding a program that generates them and generating them in test time instead of adding these test data?



##########
swift/Arrow/Sources/Arrow/ChunkedArray.swift:
##########
@@ -42,8 +45,32 @@ public class ChunkedArray<T> {
         self.nullCount = nullCount
     }
     
-    subscript(_ index: UInt) -> ArrowArray<T> {
-        return arrays[Int(index)]
+    public subscript(_ index: UInt) -> T? {
+        if arrays.count == 0 {
+            return nil
+        }
+        
+        var localIndex = index
+        var arrayIndex = 0;
+        var len: UInt = arrays[arrayIndex].length
+        while(localIndex > len) {

Review Comment:
   Is a space missing here?
   
   ```suggestion
           while (localIndex > len) {
   ```



##########
swift/Arrow/Sources/Arrow/ArrowReader.swift:
##########
@@ -0,0 +1,163 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+import FlatBuffers
+import Foundation
+
+public enum ArrowError: Error {
+    case runtimeError(String)
+}
+
+let FILEMARKER = "ARROW1"
+let CONTINUATIONMARKER = -1
+
+public class ArrowReader {

Review Comment:
   We have "streaming format" https://arrow.apache.org/docs/format/Columnar.html#ipc-streaming-format and "file format" https://arrow.apache.org/docs/format/Columnar.html#ipc-file-format .
   It seems that this is a reader for "file format".
   We may want to add "file" to this class name such as `ArrowFileReader`.



-- 
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