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
5 changes: 5 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ let package = Package(
.testTarget(
name: "ArrowTests",
dependencies: ["Arrow", "ArrowC"],
resources: [
.process("Resources/testdata_double.arrow"),
.process("Resources/testdata_bool.arrow"),
.process("Resources/testdata_struct.arrow"),
],
swiftSettings: [
// build: .unsafeFlags(["-warnings-as-errors"])
]
Expand Down
25 changes: 17 additions & 8 deletions Tests/ArrowTests/IPCTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,9 @@ final class IPCStreamReaderTests: XCTestCase {

final class IPCFileReaderTests: XCTestCase { // swiftlint:disable:this type_body_length
func testFileReader_double() throws {
let fileURL = currentDirectory().appendingPathComponent("../testdata_double.arrow")
let fileURL = Bundle.module.url(forResource: "testdata_double", withExtension: "arrow", subdirectory: nil)
let arrowReader = ArrowReader()
let result = arrowReader.fromFile(fileURL)
let result = arrowReader.fromFile(fileURL!)
let recordBatches: [RecordBatch]
switch result {
case .success(let result):
Expand Down Expand Up @@ -298,14 +298,14 @@ final class IPCFileReaderTests: XCTestCase { // swiftlint:disable:this type_body
}

func testFileReader_bool() throws {
let fileURL = currentDirectory().appendingPathComponent("../testdata_bool.arrow")
let fileURL = Bundle.module.url(forResource: "testdata_bool", withExtension: "arrow", subdirectory: nil)!
let arrowReader = ArrowReader()
try checkBoolRecordBatch(arrowReader.fromFile(fileURL))
}

func testFileWriter_bool() throws {
// read existing file
let fileURL = currentDirectory().appendingPathComponent("../testdata_bool.arrow")
let fileURL = Bundle.module.url(forResource: "testdata_bool", withExtension: "arrow", subdirectory: nil)!
let arrowReader = ArrowReader()
let fileRBs = try checkBoolRecordBatch(arrowReader.fromFile(fileURL))
let arrowWriter = ArrowWriter()
Expand All @@ -319,7 +319,11 @@ final class IPCFileReaderTests: XCTestCase { // swiftlint:disable:this type_body
throw error
}
// write file record batches to another file
let outputUrl = currentDirectory().appendingPathComponent("../testfilewriter_bool.arrow")
// write file record batches to another file
let tempDir = FileManager.default.temporaryDirectory
let outputUrl = tempDir.appendingPathComponent(UUID().uuidString)
.appendingPathExtension("arrow")
defer { try? FileManager.default.removeItem(at: outputUrl) }
switch arrowWriter.toFile(outputUrl, info: writerInfo) {
case .success:
try checkBoolRecordBatch(arrowReader.fromFile(outputUrl))
Expand All @@ -329,14 +333,14 @@ final class IPCFileReaderTests: XCTestCase { // swiftlint:disable:this type_body
}

func testFileReader_struct() throws {
let fileURL = currentDirectory().appendingPathComponent("../testdata_struct.arrow")
let fileURL = Bundle.module.url(forResource: "testdata_struct", withExtension: "arrow", subdirectory: nil)!
let arrowReader = ArrowReader()
try checkStructRecordBatch(arrowReader.fromFile(fileURL))
}

func testFileWriter_struct() throws {
// read existing file
let fileURL = currentDirectory().appendingPathComponent("../testdata_struct.arrow")
let fileURL = Bundle.module.url(forResource: "testdata_struct", withExtension: "arrow", subdirectory: nil)!
let arrowReader = ArrowReader()
let fileRBs = try checkStructRecordBatch(arrowReader.fromFile(fileURL))
let arrowWriter = ArrowWriter()
Expand All @@ -350,13 +354,18 @@ final class IPCFileReaderTests: XCTestCase { // swiftlint:disable:this type_body
throw error
}
// write file record batches to another file
let outputUrl = currentDirectory().appendingPathComponent("../testfilewriter_struct.arrow")
let tempDir = FileManager.default.temporaryDirectory
let outputUrl = tempDir.appendingPathComponent(UUID().uuidString)
.appendingPathExtension("arrow")
defer { try? FileManager.default.removeItem(at: outputUrl) }
switch arrowWriter.toFile(outputUrl, info: writerInfo) {
case .success:
defer { try? FileManager.default.removeItem(at: outputUrl) } // cleanup
try checkStructRecordBatch(arrowReader.fromFile(outputUrl))
case .failure(let error):
throw error
}

}

func testRBInMemoryToFromStream() throws {
Expand Down
Binary file added Tests/ArrowTests/Resources/testdata_bool.arrow
Binary file not shown.
Binary file added Tests/ArrowTests/Resources/testdata_double.arrow
Binary file not shown.
Binary file added Tests/ArrowTests/Resources/testdata_struct.arrow
Binary file not shown.
14 changes: 0 additions & 14 deletions ci/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,6 @@ if [ -d /cache ]; then
fi
github_actions_group_end

github_actions_group_begin "Generate data"
data_gen_dir="${build_dir}/source/data-generator/swift-datagen"
if [ -d /cache ]; then
export GOCACHE="/cache/go-build"
export GOMODCACHE="/cache/go-mod"
fi
export GOPATH="${build_dir}"
pushd "${data_gen_dir}"
go get -d ./...
go run .
cp *.arrow ../Arrow
popd
github_actions_group_end

github_actions_group_begin "Use -warnings-as-errors"
for package in . Arrow ArrowFlight; do
pushd "${build_dir}/source/${package}"
Expand Down