Skip to content

Commit

Permalink
apacheGH-41804:Update ArrowData for Nested Types (allow children)
Browse files Browse the repository at this point in the history
  • Loading branch information
abandy committed Jun 28, 2024
1 parent e615a30 commit be5b82c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions swift/Arrow/Sources/Arrow/ArrowData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,18 @@ import Foundation
public class ArrowData {
public let type: ArrowType
public let buffers: [ArrowBuffer]
public let children: [ArrowData]
public let nullCount: UInt
public let length: UInt
public let stride: Int

init(_ arrowType: ArrowType, buffers: [ArrowBuffer], nullCount: UInt) throws {
convenience init(_ arrowType: ArrowType, buffers: [ArrowBuffer], nullCount: UInt) throws {
try self.init(arrowType, buffers: buffers,
children: [ArrowData](), nullCount: nullCount,
length: buffers[1].length)
}

init(_ arrowType: ArrowType, buffers: [ArrowBuffer], children: [ArrowData], nullCount: UInt, length: UInt) throws {
let infoType = arrowType.info
switch infoType {
case let .primitiveInfo(typeId):
Expand All @@ -47,8 +54,9 @@ public class ArrowData {

self.type = arrowType
self.buffers = buffers
self.children = children
self.nullCount = nullCount
self.length = buffers[1].length
self.length = length
self.stride = arrowType.getStride()
}

Expand Down

0 comments on commit be5b82c

Please sign in to comment.