-
Notifications
You must be signed in to change notification settings - Fork 29.3k
[SPARK-31949][SQL] Add spark.default.parallelism in SQLConf for isolated across session #28778
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -371,6 +371,14 @@ object SQLConf { | |
| .booleanConf | ||
| .createWithDefault(true) | ||
|
|
||
| val DEFAULT_PARALLELISM = buildConf("spark.sql.default.parallelism") | ||
| .doc("This config behavior is same as spark.default.parallelism, and this value can be " + | ||
| "isolated across sessions. Note: always use sc.defaultParallelism as default number.") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about this? |
||
| .version("3.1.0") | ||
| .intConf | ||
| .checkValue(_ > 0, "The value of spark.sql.default.parallelism must be positive") | ||
| .createOptional | ||
|
|
||
| val SHUFFLE_PARTITIONS = buildConf("spark.sql.shuffle.partitions") | ||
| .doc("The default number of partitions to use when shuffling data for joins or aggregations. " + | ||
| "Note: For structured streaming, this configuration cannot be changed between query " + | ||
|
|
@@ -2784,6 +2792,8 @@ class SQLConf extends Serializable with Logging { | |
|
|
||
| def cacheVectorizedReaderEnabled: Boolean = getConf(CACHE_VECTORIZED_READER_ENABLED) | ||
|
|
||
| def defaultParallelism: Option[Int] = getConf(DEFAULT_PARALLELISM) | ||
|
|
||
| def defaultNumShufflePartitions: Int = getConf(SHUFFLE_PARTITIONS) | ||
|
|
||
| def numShufflePartitions: Int = { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -180,6 +180,15 @@ class SparkSession private( | |
| */ | ||
| @transient lazy val conf: RuntimeConfig = new RuntimeConfig(sessionState.conf) | ||
|
|
||
| /** | ||
| * Same as `spark.default.parallelism`, can be isolated across sessions. | ||
| * | ||
| * @since 3.1.0 | ||
| */ | ||
| def defaultParallelism: Int = { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd like to not have this API, as |
||
| sessionState.conf.defaultParallelism.getOrElse(sparkContext.defaultParallelism) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so we add a config, whose only usage is to let users get the config value?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As I said above. If add this config, I will move the exists
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just do this in this pr ?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please do, otherwise it's a useless config |
||
| } | ||
|
|
||
| /** | ||
| * An interface to register custom [[org.apache.spark.sql.util.QueryExecutionListener]]s | ||
| * that listen for execution metrics. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spark.sql.default.parallelism->spark.sql.sessionLocalDefaultParallelism?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Em.. is it better to keep similar with
spark.default.parallelism? so we can set this config easy.sessionLocalDefaultParallelismseems complex.