Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-50557][CONNECT][SQL] Support RuntimeConfig.contains(..) in Scala SQL Interface #49836

Closed
wants to merge 1 commit into from
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
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ abstract class RuntimeConfig {
*/
private[sql] def get[T](entry: ConfigEntry[T], default: T): T

/**
* Returns whether a particular key is set.
Copy link
Member

Choose a reason for hiding this comment

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

I think we should probably write a little bit more, e.g., if the configurations are known with default values, it will return true.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am pretty sure it does not.

*/
private[sql] def contains(key: String): Boolean

/**
* Returns all properties set in this conf.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1046,6 +1046,9 @@ class ClientE2ETestSuite
assert(spark.conf.get(entryWithDefault.key) === "12")
assert(spark.conf.get(entryWithDefault) === 12)
assert(spark.conf.get(entryWithDefault, 11) === 12)

assert(spark.conf.contains(entryWithDefault.key))
assert(!spark.conf.contains("nope"))
}

test("SparkVersion") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ class RuntimeConfig private[sql] (client: SparkConnectClient)
Option(get(entry.key, null)).map(entry.valueConverter).getOrElse(default)
}

/** @inheritdoc */
override private[sql] def contains(key: String): Boolean = {
get(key, null) != null
}

/** @inheritdoc */
def getAll: Map[String, String] = {
val response = executeConfigRequest { builder =>
Expand Down