Skip to content

[SPARK-52522] Reapply swift format #200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
13 changes: 7 additions & 6 deletions Sources/SparkConnect/ArrowArray.swift
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,13 @@ public class Decimal128Array: FixedArray<Decimal> {
if self.arrowData.isNull(index) {
return nil
}
let scale: Int32 = switch self.arrowData.type.id {
case .decimal128(_, let scale):
scale
default:
18
}
let scale: Int32 =
switch self.arrowData.type.id {
case .decimal128(_, let scale):
scale
default:
18
}
let byteOffset = self.arrowData.stride * Int(index)
let value = self.arrowData.buffers[1].rawPointer.advanced(by: byteOffset).load(
as: UInt64.self)
Expand Down
3 changes: 2 additions & 1 deletion Sources/SparkConnect/ArrowArrayBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ public class Time64ArrayBuilder: ArrowArrayBuilder<FixedBufferBuilder<Time64>, T
}
}

public class Decimal128ArrayBuilder: ArrowArrayBuilder<FixedBufferBuilder<Decimal>, Decimal128Array> {
public class Decimal128ArrayBuilder: ArrowArrayBuilder<FixedBufferBuilder<Decimal>, Decimal128Array>
{
fileprivate convenience init(precision: Int32, scale: Int32) throws {
try self.init(ArrowTypeDecimal128(precision: precision, scale: scale))
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/SparkConnect/ArrowType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public class ArrowType {
case .double:
return MemoryLayout<Double>.stride
case .decimal128:
return 16 // Decimal 128 (= 16 * 8) bits
return 16 // Decimal 128 (= 16 * 8) bits
case .boolean:
return MemoryLayout<Bool>.stride
case .date32:
Expand Down Expand Up @@ -429,7 +429,7 @@ extension ArrowType.Info: Equatable {
case (.timeInfo(let lhsId), .timeInfo(let rhsId)):
return lhsId == rhsId
case (.complexInfo(let lhsId), .complexInfo(let rhsId)):
return lhsId == rhsId
return lhsId == rhsId
default:
return false
}
Expand Down
24 changes: 13 additions & 11 deletions Sources/SparkConnect/Catalog.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,13 @@ public struct SparkTable: Sendable, Equatable {
public var tableType: String
public var isTemporary: Bool
public var database: String? {
get {
guard let namespace else {
return nil
}
if namespace.count == 1 {
return namespace[0]
} else {
return nil
}
guard let namespace else {
return nil
}
if namespace.count == 1 {
return namespace[0]
} else {
return nil
}
}
}
Expand Down Expand Up @@ -173,7 +171,9 @@ public actor Catalog: Sendable {
return catalog
})
return try await df.collect().map {
try Database(name: $0[0] as! String, catalog: $0[1] as? String, description: $0[2] as? String, locationUri: $0[3] as! String)
try Database(
name: $0[0] as! String, catalog: $0[1] as? String, description: $0[2] as? String,
locationUri: $0[3] as! String)
}
}

Expand All @@ -189,7 +189,9 @@ public actor Catalog: Sendable {
return catalog
})
return try await df.collect().map {
try Database(name: $0[0] as! String, catalog: $0[1] as? String, description: $0[2] as? String, locationUri: $0[3] as! String)
try Database(
name: $0[0] as! String, catalog: $0[1] as? String, description: $0[2] as? String,
locationUri: $0[3] as! String)
}.first!
}

Expand Down
Loading
Loading