Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion python/pyspark/sql/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class RuntimeConfig(object):
"""User-facing configuration API, accessible through `SparkSession.conf`.

Options set here are automatically propagated to the Hadoop configuration during I/O.
This a thin wrapper around its Scala implementation org.apache.spark.sql.RuntimeConfig.
"""
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not documentation relevant to the end user.

cc @dongjoon-hyun

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this actually. Let's remove it.


def __init__(self, jconf):
Expand Down
3 changes: 0 additions & 3 deletions python/pyspark/sql/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ class SparkSession(object):
.config("spark.some.config.option", "some-value") \
.getOrCreate()

:param sparkContext: The :class:`SparkContext` backing this SparkSession.
:param jsparkSession: An optional JVM Scala SparkSession. If set, we do not instantiate a new
SparkSession in the JVM, instead we make all calls to this object.
"""
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be a private ctor

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, right.


class Builder(object):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,16 @@ class RuntimeConfig private[sql](sqlConf: SQLConf = new SQLConf) {
*
* @since 2.0.0
*/
def set(key: String, value: String): RuntimeConfig = {
def set(key: String, value: String): Unit = {
sqlConf.setConfString(key, value)
this
}

/**
* Sets the given Spark runtime configuration property.
*
* @since 2.0.0
*/
def set(key: String, value: Boolean): RuntimeConfig = {
def set(key: String, value: Boolean): Unit = {
set(key, value.toString)
}

Expand All @@ -54,7 +53,7 @@ class RuntimeConfig private[sql](sqlConf: SQLConf = new SQLConf) {
*
* @since 2.0.0
*/
def set(key: String, value: Long): RuntimeConfig = {
def set(key: String, value: Long): Unit = {
set(key, value.toString)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,19 @@
* limitations under the License.
*/

package org.apache.spark.sql.internal
package org.apache.spark.sql

import org.apache.spark.SparkFunSuite
import org.apache.spark.sql.RuntimeConfig

class RuntimeConfigSuite extends SparkFunSuite {

private def newConf(): RuntimeConfig = new RuntimeConfig

test("set and get") {
val conf = newConf()
conf
.set("k1", "v1")
.set("k2", 2)
.set("k3", value = false)
conf.set("k1", "v1")
conf.set("k2", 2)
conf.set("k3", value = false)

assert(conf.get("k1") == "v1")
assert(conf.get("k2") == "2")
Expand All @@ -41,13 +39,15 @@ class RuntimeConfigSuite extends SparkFunSuite {
}

test("getOption") {
val conf = newConf().set("k1", "v1")
val conf = newConf()
conf.set("k1", "v1")
assert(conf.getOption("k1") == Some("v1"))
assert(conf.getOption("notset") == None)
}

test("unset") {
val conf = newConf().set("k1", "v1")
val conf = newConf()
conf.set("k1", "v1")
assert(conf.get("k1") == "v1")
conf.unset("k1")
intercept[NoSuchElementException] {
Expand Down