diff --git a/swift/Arrow/Sources/Arrow/ArrowArrayBuilder.swift b/swift/Arrow/Sources/Arrow/ArrowArrayBuilder.swift index 38e6e457f4610..dc80f52f8ebd2 100644 --- a/swift/Arrow/Sources/Arrow/ArrowArrayBuilder.swift +++ b/swift/Arrow/Sources/Arrow/ArrowArrayBuilder.swift @@ -152,8 +152,7 @@ public class ArrowArrayBuilders { } } - public static func isValidBuilderType(_: T) -> Bool { - let type = T.self + public static func isValidBuilderType(_ type: T.Type) -> Bool { return type == Int8?.self || type == Int16?.self || type == Int32?.self || type == Int64?.self || type == UInt8?.self || type == UInt16?.self || diff --git a/swift/Arrow/Tests/ArrowTests/ArrayBuilderTest.swift b/swift/Arrow/Tests/ArrowTests/ArrayBuilderTest.swift index 965e4ed278a39..42e167f01fcc9 100644 --- a/swift/Arrow/Tests/ArrowTests/ArrayBuilderTest.swift +++ b/swift/Arrow/Tests/ArrowTests/ArrayBuilderTest.swift @@ -20,35 +20,35 @@ import XCTest final class ArrayBuilderTests: XCTestCase { func testIsValidTypeForBuilder() throws { - XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(Int8(0))) - XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(Int16(0))) - XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(Int32(0))) - XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(Int64(0))) - XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(UInt8(0))) - XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(UInt16(0))) - XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(UInt32(0))) - XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(UInt64(0))) - XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(Float(0))) - XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(Double(0))) - XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(Date.now)) - XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(true)) - XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(Int8?(0))) - XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(Int16?(0))) - XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(Int32?(0))) - XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(Int64?(0))) - XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(UInt8?(0))) - XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(UInt16?(0))) - XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(UInt32?(0))) - XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(UInt64?(0))) - XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(Float?(0))) - XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(Double?(0))) - XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(Date?(Date.now))) - XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(Bool?(true))) + XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(UInt8.self)) + XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(Int16.self)) + XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(Int32.self)) + XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(Int64.self)) + XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(UInt8.self)) + XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(UInt16.self)) + XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(UInt32.self)) + XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(UInt64.self)) + XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(Float.self)) + XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(Double.self)) + XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(Date.self)) + XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(Bool.self)) + XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(Int8?.self)) + XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(Int16?.self)) + XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(Int32?.self)) + XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(Int64?.self)) + XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(UInt8?.self)) + XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(UInt16?.self)) + XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(UInt32?.self)) + XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(UInt64?.self)) + XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(Float?.self)) + XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(Double?.self)) + XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(Date?.self)) + XCTAssertTrue(ArrowArrayBuilders.isValidBuilderType(Bool?.self)) - XCTAssertFalse(ArrowArrayBuilders.isValidBuilderType(Int(0))) - XCTAssertFalse(ArrowArrayBuilders.isValidBuilderType(UInt(0))) - XCTAssertFalse(ArrowArrayBuilders.isValidBuilderType(Int?(0))) - XCTAssertFalse(ArrowArrayBuilders.isValidBuilderType(UInt?(0))) + XCTAssertFalse(ArrowArrayBuilders.isValidBuilderType(Int.self)) + XCTAssertFalse(ArrowArrayBuilders.isValidBuilderType(UInt.self)) + XCTAssertFalse(ArrowArrayBuilders.isValidBuilderType(Int?.self)) + XCTAssertFalse(ArrowArrayBuilders.isValidBuilderType(UInt?.self)) } func testLoadArrayBuilders() throws {