[SPARK-22779][SQL] Fallback config defaults should behave like scalar defaults #22174
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
The value returned by a call to
spark.conf.get(key)may be specified in one of 3 different ways:keyvia e.g.spark.conf.set(key, value)spark.conf.get(key, clientDefault)SQLConf.buildConf(key).createWithDefault(builderDefault)Currently, the order of precedence among these different sources of value is:
There is currently one exception to this rule: if the builder happened to be declared with a default that is another ConfigBuilder (via e.g.
SQLConf.buildConf(key).fallbackConf(parentConfigBuilder)), then we check the builder default first (in this case the parent conf and potentially the parent's parent and so on) and then only use the client default if none of the fallback confs had explicit values defined.From a user perspective, this means that the client default may or may not be used depending on whether the config in question was declared with a scalar default or a fallback conf default, which is usually not obvious. In the case of a fallback conf default, the value returned by
spark.conf.getmay depend on an arbitrary number of parent confs, which seems like it will lead to particularly difficult to diagnose errors.This PR removes that exception and adds a test to guarantee that the precedence order listed above is applied to all conf types. Note that this is an explicit change from the previous implementation in #19974
How was this patch tested?
Unit test to verify the precedence order for confs with both scalar and fallback conf defaults.