Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Sources/Arrow/Array/ArrowColumn.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,10 @@ public class ArrowColumn {
.runtimeError("Could not cast array holder to chunked array."))
}
}

/// Return the data as a chunked array, cast to the type.
/// - Returns: The chunked array or nil if the array cannot be cast to the inferred type.
public func array<T>() -> ChunkedArray<T>? {
self.dataHolder as? ChunkedArray<T>
}
}
28 changes: 14 additions & 14 deletions Sources/Arrow/ArrowField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,20 @@ extension ArrowField {
)
}

// /// Create a new `ArrowField` suitable for `ArrowType::Dictionary`.
// public init(
// dictWithName: String,
// key: ArrowType,
// value: ArrowType,
// isNullable: Bool
// ) {
// precondition(
// key.isDictionaryKeyType,
// "\(key) is not a valid dictionary key"
// )
// let dataType: ArrowType = .dictionary(key, value)
// self = Self(name: dictWithName, dataType: dataType, isNullable: isNullable)
// }
// /// Create a new `ArrowField` suitable for `ArrowType::Dictionary`.
// public init(
// dictWithName: String,
// key: ArrowType,
// value: ArrowType,
// isNullable: Bool
// ) {
// precondition(
// key.isDictionaryKeyType,
// "\(key) is not a valid dictionary key"
// )
// let dataType: ArrowType = .dictionary(key, value)
// self = Self(name: dictWithName, dataType: dataType, isNullable: isNullable)
// }

/// Create a new struct `ArrowField`.
///
Expand Down
5 changes: 4 additions & 1 deletion Sources/Arrow/ArrowType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,10 @@ extension ArrowType {
&& aField.type.equalsDataType(bField.type) && aSorted == bSorted

// Dictionary
case (.dictionary(_, _, let aKey, let aValue), .dictionary(_, _, let bKey, let bValue)):
case (
.dictionary(_, _, let aKey, let aValue),
.dictionary(_, _, let bKey, let bValue)
):
// Ignoring dictionary id here.
return aKey.equalsDataType(bKey) && aValue.equalsDataType(bValue)

Expand Down
2 changes: 1 addition & 1 deletion Tests/ArrowIPCTests/ArrowTestingGold.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ struct ArrowTestingGold {
"generated_union",
]

// @Test
// @Test
func readFile() throws {

let name = "generated_dictionary"
Expand Down