You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by do...@apache.org on 2025/05/12 14:45:28 UTC

(spark-connect-swift) branch main updated: [SPARK-52083] Update `Spark Connect`-generated `Swift` source code with 4.0.0-rc5

This is an automated email from the ASF dual-hosted git repository.

dongjoon pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/spark-connect-swift.git


The following commit(s) were added to refs/heads/main by this push:
     new ed6d553  [SPARK-52083] Update `Spark Connect`-generated `Swift` source code with 4.0.0-rc5
ed6d553 is described below

commit ed6d55304b7f7d0519727d1d2c202223641c3615
Author: Dongjoon Hyun <do...@apache.org>
AuthorDate: Mon May 12 07:45:14 2025 -0700

    [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`.
    - https://github.com/apache/spark-connect-swift/pull/5
    
    There were some changes so far like the following.
    - https://github.com/apache/spark/pull/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 <do...@apache.org>
    Signed-off-by: Dongjoon Hyun <do...@apache.org>
---
 Sources/SparkConnect/base.grpc.swift |  1 +
 Sources/SparkConnect/ml.pb.swift     | 29 ++++++++---------------------
 2 files changed, 9 insertions(+), 21 deletions(-)

diff --git a/Sources/SparkConnect/base.grpc.swift b/Sources/SparkConnect/base.grpc.swift
index 85e84c4..6c4d06d 100644
--- a/Sources/SparkConnect/base.grpc.swift
+++ b/Sources/SparkConnect/base.grpc.swift
@@ -16,6 +16,7 @@
 
 // DO NOT EDIT.
 // swift-format-ignore-file
+// swiftlint:disable all
 //
 // Generated by the gRPC Swift generator plugin for the protocol buffer compiler.
 // Source: spark/connect/base.proto
diff --git a/Sources/SparkConnect/ml.pb.swift b/Sources/SparkConnect/ml.pb.swift
index 6fd4b8a..6049cab 100644
--- a/Sources/SparkConnect/ml.pb.swift
+++ b/Sources/SparkConnect/ml.pb.swift
@@ -149,27 +149,18 @@ struct Spark_Connect_MlCommand: Sendable {
     fileprivate var _dataset: Spark_Connect_Relation? = nil
   }
 
-  /// Command to delete the cached object which could be a model
+  /// Command to delete the cached objects which could be a model
   /// or summary evaluated by a model
   struct Delete: Sendable {
     // SwiftProtobuf.Message conformance is added in an extension below. See the
     // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
     // methods supported on all messages.
 
-    var objRef: Spark_Connect_ObjectRef {
-      get {return _objRef ?? Spark_Connect_ObjectRef()}
-      set {_objRef = newValue}
-    }
-    /// Returns true if `objRef` has been explicitly set.
-    var hasObjRef: Bool {return self._objRef != nil}
-    /// Clears the value of `objRef`. Subsequent reads from it will return its default value.
-    mutating func clearObjRef() {self._objRef = nil}
+    var objRefs: [Spark_Connect_ObjectRef] = []
 
     var unknownFields = SwiftProtobuf.UnknownStorage()
 
     init() {}
-
-    fileprivate var _objRef: Spark_Connect_ObjectRef? = nil
   }
 
   /// Command to write ML operator
@@ -626,7 +617,7 @@ extension Spark_Connect_MlCommand.Fit: SwiftProtobuf.Message, SwiftProtobuf._Mes
 extension Spark_Connect_MlCommand.Delete: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
   static let protoMessageName: String = Spark_Connect_MlCommand.protoMessageName + ".Delete"
   static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
-    1: .standard(proto: "obj_ref"),
+    1: .standard(proto: "obj_refs"),
   ]
 
   mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
@@ -635,25 +626,21 @@ extension Spark_Connect_MlCommand.Delete: SwiftProtobuf.Message, SwiftProtobuf._
       // allocates stack space for every case branch when no optimizations are
       // enabled. https://github.com/apple/swift-protobuf/issues/1034
       switch fieldNumber {
-      case 1: try { try decoder.decodeSingularMessageField(value: &self._objRef) }()
+      case 1: try { try decoder.decodeRepeatedMessageField(value: &self.objRefs) }()
       default: break
       }
     }
   }
 
   func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
-    // The use of inline closures is to circumvent an issue where the compiler
-    // allocates stack space for every if/case branch local when no optimizations
-    // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
-    // https://github.com/apple/swift-protobuf/issues/1182
-    try { if let v = self._objRef {
-      try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
-    } }()
+    if !self.objRefs.isEmpty {
+      try visitor.visitRepeatedMessageField(value: self.objRefs, fieldNumber: 1)
+    }
     try unknownFields.traverse(visitor: &visitor)
   }
 
   static func ==(lhs: Spark_Connect_MlCommand.Delete, rhs: Spark_Connect_MlCommand.Delete) -> Bool {
-    if lhs._objRef != rhs._objRef {return false}
+    if lhs.objRefs != rhs.objRefs {return false}
     if lhs.unknownFields != rhs.unknownFields {return false}
     return true
   }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org