-
Notifications
You must be signed in to change notification settings - Fork 28.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-49413][CONNECT][SQL] Create a shared RuntimeConfig interface
### What changes were proposed in this pull request? This PR introduces a shared RuntimeConfig interface. ### Why are the changes needed? We are creating a shared Scala Spark SQL interface for Classic and Connect. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Existing tests. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #47980 from hvanhovell/SPARK-49413. Authored-by: Herman van Hovell <[email protected]> Signed-off-by: Herman van Hovell <[email protected]>
- Loading branch information
1 parent
c38844c
commit 6fc176f
Showing
61 changed files
with
317 additions
and
322 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
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
105 changes: 105 additions & 0 deletions
105
sql/api/src/main/scala/org/apache/spark/sql/RuntimeConfig.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,105 @@ | ||
/* | ||
* 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.annotation.Stable | ||
|
||
/** | ||
* Runtime configuration interface for Spark. To access this, use `SparkSession.conf`. | ||
* | ||
* Options set here are automatically propagated to the Hadoop configuration during I/O. | ||
* | ||
* @since 2.0.0 | ||
*/ | ||
@Stable | ||
abstract class RuntimeConfig { | ||
|
||
/** | ||
* Sets the given Spark runtime configuration property. | ||
* | ||
* @since 2.0.0 | ||
*/ | ||
def set(key: String, value: String): Unit | ||
|
||
/** | ||
* Sets the given Spark runtime configuration property. | ||
* | ||
* @since 2.0.0 | ||
*/ | ||
def set(key: String, value: Boolean): Unit = { | ||
set(key, value.toString) | ||
} | ||
|
||
/** | ||
* Sets the given Spark runtime configuration property. | ||
* | ||
* @since 2.0.0 | ||
*/ | ||
def set(key: String, value: Long): Unit = { | ||
set(key, value.toString) | ||
} | ||
|
||
/** | ||
* Returns the value of Spark runtime configuration property for the given key. | ||
* | ||
* @throws java.util.NoSuchElementException | ||
* if the key is not set and does not have a default value | ||
* @since 2.0.0 | ||
*/ | ||
@throws[NoSuchElementException]("if the key is not set") | ||
def get(key: String): String | ||
|
||
/** | ||
* Returns the value of Spark runtime configuration property for the given key. | ||
* | ||
* @since 2.0.0 | ||
*/ | ||
def get(key: String, default: String): String | ||
|
||
/** | ||
* Returns all properties set in this conf. | ||
* | ||
* @since 2.0.0 | ||
*/ | ||
def getAll: Map[String, String] | ||
|
||
/** | ||
* Returns the value of Spark runtime configuration property for the given key. | ||
* | ||
* @since 2.0.0 | ||
*/ | ||
def getOption(key: String): Option[String] | ||
|
||
/** | ||
* Resets the configuration property for the given key. | ||
* | ||
* @since 2.0.0 | ||
*/ | ||
def unset(key: String): Unit | ||
|
||
/** | ||
* Indicates whether the configuration property with the given key is modifiable in the current | ||
* session. | ||
* | ||
* @return | ||
* `true` if the configuration property is modifiable. For static SQL, Spark Core, invalid | ||
* (not existing) and other non-modifiable configuration properties, the returned value is | ||
* `false`. | ||
* @since 2.4.0 | ||
*/ | ||
def isModifiable(key: String): Boolean | ||
} |
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
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
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
Oops, something went wrong.