SQLConf
is an internal key-value configuration store for parameters and hints used in Spark SQL.
SQLConf
offers methods to get, set, unset or clear values of configuration properties, but has also the accessor methods to read the current value of a configuration property or hint.
You can access a session-specific SQLConf
using SessionState.
scala> spark.version
res0: String = 2.3.0
scala> :type spark
org.apache.spark.sql.SparkSession
scala> :type spark.sessionState.conf
org.apache.spark.sql.internal.SQLConf
scala> println(spark.sessionState.conf.offHeapColumnVectorEnabled)
false
import spark.sessionState.conf
// accessing properties through accessor methods
scala> conf.numShufflePartitions
res1: Int = 200
// setting properties using aliases
import org.apache.spark.sql.internal.SQLConf.SHUFFLE_PARTITIONS
conf.setConf(SHUFFLE_PARTITIONS, 2)
scala> conf.numShufflePartitions
res2: Int = 2
// unset aka reset properties to the default value
conf.unsetConf(SHUFFLE_PARTITIONS)
scala> conf.numShufflePartitions
res3: Int = 200
// You could also access the internal SQLConf using get
import org.apache.spark.sql.internal.SQLConf
val cc = SQLConf.get
scala> cc == conf
res4: Boolean = true
Note
|
Spark SQL configuration is available through the user-facing interface scala> spark.version
res0: String = 2.3.0
scala> :type spark
org.apache.spark.sql.SparkSession
scala> :type spark.conf
org.apache.spark.sql.RuntimeConfig |
Name | Parameter | Description | ||
---|---|---|---|---|
|
Used exclusively when |
|||
|
Used exclusively in JoinSelection execution planning strategy |
|||
|
|
|||
|
Used exclusively in BroadcastExchangeExec (for broadcasting a table to executors). |
|||
|
Used when |
|||
|
Used exclusively when |
|||
|
||||
|
|
|||
|
||||
|
Used exclusively in pivot operator. |
|||
|
Used exclusively in RelationalGroupedDataset when creating the result |
|||
|
|
|||
|
Used when ReuseSubquery and ReuseExchange physical optimizations are executed
|
|||
|
Used exclusively when |
|||
|
Used exclusively when |
|||
|
Used exclusively when |
|||
|
Used exclusively when |
|||
|
|
|||
|
Used exclusively when |
|||
|
Used exclusively when |
|||
|
||||
|
||||
|
|
|||
|
Used exclusively when |
|||
|
Used exclusively in CostBasedJoinReorder logical plan optimization |
|||
|
Used exclusively when a physical operator is requested the first n rows as an array. |
|||
|
|
|||
|
Used exclusively when |
|||
|
Used exclusively when |
|||
|
Used exclusively when |
|||
|
|
|||
|
Used exclusively in JoinSelection execution planning strategy to prefer sort merge join over shuffle hash join. |
|||
|
|
|||
|
||||
|
Used exclusively in ReorderJoin logical plan optimization (and indirectly in |
|||
|
|
|||
|
Used exclusively when |
|||
|
|
|||
|
||||
|
|
|||
|
Used exclusively when |
|||
|
|
|||
|
Used exclusively when |
|||
|
Used exclusively when |
|||
|
Used exclusively when |
|||
|
Used exclusively in |
You can get the current parameters and hints using the following family of get
methods.
getConfString(key: String): String
getConf[T](entry: ConfigEntry[T], defaultValue: T): T
getConf[T](entry: ConfigEntry[T]): T
getConf[T](entry: OptionalConfigEntry[T]): Option[T]
getConfString(key: String, defaultValue: String): String
getAllConfs: immutable.Map[String, String]
getAllDefinedConfs: Seq[(String, String, String)]
You can set parameters and hints using the following family of set
methods.
setConf(props: Properties): Unit
setConfString(key: String, value: String): Unit
setConf[T](entry: ConfigEntry[T], value: T): Unit
You can unset parameters and hints using the following family of unset
methods.
unsetConf(key: String): Unit
unsetConf(entry: ConfigEntry[_]): Unit
clear(): Unit
You can use clear
to remove all the parameters and hints in SQLConf
.
redactOptions(options: Map[String, String]): Map[String, String]
redactOptions
takes the values of the spark.sql.redaction.options.regex and spark.redaction.regex
configuration properties.
For every regular expression (in the order), redactOptions
redacts sensitive information, i.e. finds the first match of a regular expression pattern in every option key or value and if either matches replaces the value with ***(redacted)
.
Note
|
redactOptions is used exclusively when SaveIntoDataSourceCommand logical command is requested for the simple description.
|