forked from apache/spark
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-49282][CONNECT][SQL] Create a shared SparkSessionBuilder inter…
…face ### What changes were proposed in this pull request? This PR adds a shared SparkSessionBuilder interface. It also adds a SparkSessionCompanion interface which is mean should be implemented by all SparkSession companions (a.k.a. `object SparkSession`. This is currently the entry point for session building, in the future we will also add the management of active/default sessions. Finally we add a companion for api.SparkSession. This will bind the implementation that is currently located in `org.apache.spark.sql`. This makes it possible to exclusively work with the interface, instead of selecting an implementation upfront. ### Why are the changes needed? We are creating a shared Scala SQL interface. Building a session is part of this interface. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Existing tests. I have added tests for the implementation binding. ### Was this patch authored or co-authored using generative AI tooling? No. Closes apache#48229 from hvanhovell/SPARK-49282. Authored-by: Herman van Hovell <[email protected]> Signed-off-by: Herman van Hovell <[email protected]>
- Loading branch information
1 parent
29ed272
commit 5fb0ff9
Showing
9 changed files
with
388 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...m/src/test/scala/org/apache/spark/sql/SparkSessionBuilderImplementationBindingSuite.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.spark.sql | ||
|
||
import org.apache.spark.sql.api.SparkSessionBuilder | ||
import org.apache.spark.sql.test.{ConnectFunSuite, RemoteSparkSession} | ||
|
||
/** | ||
* Make sure the api.SparkSessionBuilder binds to Connect implementation. | ||
*/ | ||
class SparkSessionBuilderImplementationBindingSuite | ||
extends ConnectFunSuite | ||
with api.SparkSessionBuilderImplementationBindingSuite | ||
with RemoteSparkSession { | ||
override protected def configure(builder: SparkSessionBuilder): builder.type = { | ||
// We need to set this configuration because the port used by the server is random. | ||
builder.remote(s"sc://localhost:$serverPort") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.