Skip to content

Commit 056c0cf

Browse files
committed
[SPARK-52522] Reapply swift format
### What changes were proposed in this pull request? This PR aims to re-apply `swift format` to all source codes. ### Why are the changes needed? To tidy up the source code. ### Does this PR introduce _any_ user-facing change? No behavior change. ### How was this patch tested? Pass the CIs. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #200 from dongjoon-hyun/SPARK-52522. Authored-by: Dongjoon Hyun <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
1 parent c18c448 commit 056c0cf

18 files changed

+1152
-1061
lines changed

Sources/SparkConnect/ArrowArray.swift

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -255,12 +255,13 @@ public class Decimal128Array: FixedArray<Decimal> {
255255
if self.arrowData.isNull(index) {
256256
return nil
257257
}
258-
let scale: Int32 = switch self.arrowData.type.id {
259-
case .decimal128(_, let scale):
260-
scale
261-
default:
262-
18
263-
}
258+
let scale: Int32 =
259+
switch self.arrowData.type.id {
260+
case .decimal128(_, let scale):
261+
scale
262+
default:
263+
18
264+
}
264265
let byteOffset = self.arrowData.stride * Int(index)
265266
let value = self.arrowData.buffers[1].rawPointer.advanced(by: byteOffset).load(
266267
as: UInt64.self)

Sources/SparkConnect/ArrowArrayBuilder.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ public class Time64ArrayBuilder: ArrowArrayBuilder<FixedBufferBuilder<Time64>, T
122122
}
123123
}
124124

125-
public class Decimal128ArrayBuilder: ArrowArrayBuilder<FixedBufferBuilder<Decimal>, Decimal128Array> {
125+
public class Decimal128ArrayBuilder: ArrowArrayBuilder<FixedBufferBuilder<Decimal>, Decimal128Array>
126+
{
126127
fileprivate convenience init(precision: Int32, scale: Int32) throws {
127128
try self.init(ArrowTypeDecimal128(precision: precision, scale: scale))
128129
}

Sources/SparkConnect/ArrowType.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ public class ArrowType {
294294
case .double:
295295
return MemoryLayout<Double>.stride
296296
case .decimal128:
297-
return 16 // Decimal 128 (= 16 * 8) bits
297+
return 16 // Decimal 128 (= 16 * 8) bits
298298
case .boolean:
299299
return MemoryLayout<Bool>.stride
300300
case .date32:
@@ -429,7 +429,7 @@ extension ArrowType.Info: Equatable {
429429
case (.timeInfo(let lhsId), .timeInfo(let rhsId)):
430430
return lhsId == rhsId
431431
case (.complexInfo(let lhsId), .complexInfo(let rhsId)):
432-
return lhsId == rhsId
432+
return lhsId == rhsId
433433
default:
434434
return false
435435
}

Sources/SparkConnect/Catalog.swift

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,13 @@ public struct SparkTable: Sendable, Equatable {
4040
public var tableType: String
4141
public var isTemporary: Bool
4242
public var database: String? {
43-
get {
44-
guard let namespace else {
45-
return nil
46-
}
47-
if namespace.count == 1 {
48-
return namespace[0]
49-
} else {
50-
return nil
51-
}
43+
guard let namespace else {
44+
return nil
45+
}
46+
if namespace.count == 1 {
47+
return namespace[0]
48+
} else {
49+
return nil
5250
}
5351
}
5452
}
@@ -173,7 +171,9 @@ public actor Catalog: Sendable {
173171
return catalog
174172
})
175173
return try await df.collect().map {
176-
try Database(name: $0[0] as! String, catalog: $0[1] as? String, description: $0[2] as? String, locationUri: $0[3] as! String)
174+
try Database(
175+
name: $0[0] as! String, catalog: $0[1] as? String, description: $0[2] as? String,
176+
locationUri: $0[3] as! String)
177177
}
178178
}
179179

@@ -189,7 +189,9 @@ public actor Catalog: Sendable {
189189
return catalog
190190
})
191191
return try await df.collect().map {
192-
try Database(name: $0[0] as! String, catalog: $0[1] as? String, description: $0[2] as? String, locationUri: $0[3] as! String)
192+
try Database(
193+
name: $0[0] as! String, catalog: $0[1] as? String, description: $0[2] as? String,
194+
locationUri: $0[3] as! String)
193195
}.first!
194196
}
195197

0 commit comments

Comments
 (0)