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

wenchen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new f9eb3f3c13bf [SPARK-46575][SQL][FOLLOWUP] Add back 
`HiveThriftServer2.startWithContext(SQLContext)` method for compatibility
f9eb3f3c13bf is described below

commit f9eb3f3c13bfe8dd8253ac6abc63c14629104c76
Author: Saksham Garg <[email protected]>
AuthorDate: Wed Mar 27 14:35:39 2024 +0800

    [SPARK-46575][SQL][FOLLOWUP] Add back 
`HiveThriftServer2.startWithContext(SQLContext)` method for compatibility
    
    ### What changes were proposed in this pull request?
    https://github.com/apache/spark/pull/44575 added a default parameter to 
`HiveThriftServer2.startWithContext` API. Although this is source-compatible, 
this is not binary-compatible - for eg. a binary built with new code won't be 
able to run with the old code. In this PR, we maintain forward and backward 
compatibility by keeping the API same and introducing a separate API for the 
additional parameter.
    
    ### Why are the changes needed?
    See above
    
    ### Does this PR introduce _any_ user-facing change?
    only developer API change
    
    ### How was this patch tested?
    Existing tests
    
    ### Was this patch authored or co-authored using generative AI tooling?
    no
    
    Closes #45727 from dragqueen95/thriftserver-back-compat.
    
    Lead-authored-by: Saksham Garg 
<[email protected]>
    Co-authored-by: Wenchen Fan <[email protected]>
    Signed-off-by: Wenchen Fan <[email protected]>
---
 .../spark/sql/hive/thriftserver/HiveThriftServer2.scala | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git 
a/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/HiveThriftServer2.scala
 
b/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/HiveThriftServer2.scala
index afd6d45ed444..5c94dec6feb3 100644
--- 
a/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/HiveThriftServer2.scala
+++ 
b/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/HiveThriftServer2.scala
@@ -27,7 +27,7 @@ import 
org.apache.hive.service.cli.thrift.{ThriftBinaryCLIService, ThriftHttpCLI
 import org.apache.hive.service.server.HiveServer2
 
 import org.apache.spark.SparkContext
-import org.apache.spark.annotation.DeveloperApi
+import org.apache.spark.annotation.{DeveloperApi, Since}
 import org.apache.spark.internal.Logging
 import org.apache.spark.internal.config.UI.UI_ENABLED
 import org.apache.spark.sql.SQLContext
@@ -56,8 +56,9 @@ object HiveThriftServer2 extends Logging {
    *                    the call logs the error and exits the JVM with exit 
code -1. When false, the
    *                    call throws an exception instead.
    */
+  @Since("3.5.2")
   @DeveloperApi
-  def startWithContext(sqlContext: SQLContext, exitOnError: Boolean = true): 
HiveThriftServer2 = {
+  def startWithContext(sqlContext: SQLContext, exitOnError: Boolean): 
HiveThriftServer2 = {
     systemExitOnError.set(exitOnError)
 
     val executionHive = HiveUtils.newClientForExecution(
@@ -75,6 +76,18 @@ object HiveThriftServer2 extends Logging {
     server
   }
 
+  /**
+   * :: DeveloperApi ::
+   * Starts a new thrift server with the given context.
+   *
+   * @param sqlContext SQLContext to use for the server
+   */
+  @Since("2.0.0")
+  @DeveloperApi
+  def startWithContext(sqlContext: SQLContext): HiveThriftServer2 = {
+    startWithContext(sqlContext, exitOnError = true)
+  }
+
   private def createListenerAndUI(server: HiveThriftServer2, sc: 
SparkContext): Unit = {
     val kvStore = sc.statusStore.store.asInstanceOf[ElementTrackingStore]
     eventManager = new HiveThriftServer2EventManager(sc)


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to