Skip to content

Commit ed6d553

Browse files
committed
[SPARK-52083] Update Spark Connect-generated Swift source code with 4.0.0-rc5
### What changes were proposed in this pull request? This PR aims to update `Spark Connect`-generated `Swift` source code with `Apache Spark 4.0.0-rc5`. ### Why are the changes needed? SPARK-51463 added this code with `Apache Spark 4.0.0-rc2`. - #5 There were some changes so far like the following. - apache/spark#50441 The following is the procedure. ``` $ git clone -b v4.0.0-rc5 https://github.com/apache/spark.git $ cd spark/sql/connect/common/src/main/protobuf/ $ protoc --swift_out=. spark/connect/*.proto $ protoc --grpc-swift_out=. spark/connect/*.proto // Remove empty GRPC files $ git grep 'This file contained no services' spark/connect/catalog.grpc.swift:// This file contained no services. spark/connect/commands.grpc.swift:// This file contained no services. spark/connect/common.grpc.swift:// This file contained no services. spark/connect/example_plugins.grpc.swift:// This file contained no services. spark/connect/expressions.grpc.swift:// This file contained no services. spark/connect/ml.grpc.swift:// This file contained no services. spark/connect/ml_common.grpc.swift:// This file contained no services. spark/connect/relations.grpc.swift:// This file contained no services. spark/connect/types.grpc.swift:// This file contained no services. ``` ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Pass the CIs. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #134 from dongjoon-hyun/SPARK-52083. Authored-by: Dongjoon Hyun <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
1 parent 8ba2806 commit ed6d553

File tree

2 files changed

+9
-21
lines changed

2 files changed

+9
-21
lines changed

Sources/SparkConnect/base.grpc.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
// DO NOT EDIT.
1818
// swift-format-ignore-file
19+
// swiftlint:disable all
1920
//
2021
// Generated by the gRPC Swift generator plugin for the protocol buffer compiler.
2122
// Source: spark/connect/base.proto

Sources/SparkConnect/ml.pb.swift

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -149,27 +149,18 @@ struct Spark_Connect_MlCommand: Sendable {
149149
fileprivate var _dataset: Spark_Connect_Relation? = nil
150150
}
151151

152-
/// Command to delete the cached object which could be a model
152+
/// Command to delete the cached objects which could be a model
153153
/// or summary evaluated by a model
154154
struct Delete: Sendable {
155155
// SwiftProtobuf.Message conformance is added in an extension below. See the
156156
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
157157
// methods supported on all messages.
158158

159-
var objRef: Spark_Connect_ObjectRef {
160-
get {return _objRef ?? Spark_Connect_ObjectRef()}
161-
set {_objRef = newValue}
162-
}
163-
/// Returns true if `objRef` has been explicitly set.
164-
var hasObjRef: Bool {return self._objRef != nil}
165-
/// Clears the value of `objRef`. Subsequent reads from it will return its default value.
166-
mutating func clearObjRef() {self._objRef = nil}
159+
var objRefs: [Spark_Connect_ObjectRef] = []
167160

168161
var unknownFields = SwiftProtobuf.UnknownStorage()
169162

170163
init() {}
171-
172-
fileprivate var _objRef: Spark_Connect_ObjectRef? = nil
173164
}
174165

175166
/// Command to write ML operator
@@ -626,7 +617,7 @@ extension Spark_Connect_MlCommand.Fit: SwiftProtobuf.Message, SwiftProtobuf._Mes
626617
extension Spark_Connect_MlCommand.Delete: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
627618
static let protoMessageName: String = Spark_Connect_MlCommand.protoMessageName + ".Delete"
628619
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
629-
1: .standard(proto: "obj_ref"),
620+
1: .standard(proto: "obj_refs"),
630621
]
631622

632623
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
@@ -635,25 +626,21 @@ extension Spark_Connect_MlCommand.Delete: SwiftProtobuf.Message, SwiftProtobuf._
635626
// allocates stack space for every case branch when no optimizations are
636627
// enabled. https://github.com/apple/swift-protobuf/issues/1034
637628
switch fieldNumber {
638-
case 1: try { try decoder.decodeSingularMessageField(value: &self._objRef) }()
629+
case 1: try { try decoder.decodeRepeatedMessageField(value: &self.objRefs) }()
639630
default: break
640631
}
641632
}
642633
}
643634

644635
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
645-
// The use of inline closures is to circumvent an issue where the compiler
646-
// allocates stack space for every if/case branch local when no optimizations
647-
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
648-
// https://github.com/apple/swift-protobuf/issues/1182
649-
try { if let v = self._objRef {
650-
try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
651-
} }()
636+
if !self.objRefs.isEmpty {
637+
try visitor.visitRepeatedMessageField(value: self.objRefs, fieldNumber: 1)
638+
}
652639
try unknownFields.traverse(visitor: &visitor)
653640
}
654641

655642
static func ==(lhs: Spark_Connect_MlCommand.Delete, rhs: Spark_Connect_MlCommand.Delete) -> Bool {
656-
if lhs._objRef != rhs._objRef {return false}
643+
if lhs.objRefs != rhs.objRefs {return false}
657644
if lhs.unknownFields != rhs.unknownFields {return false}
658645
return true
659646
}

0 commit comments

Comments
 (0)