[SPARK-57207][SQL][FOLLOWUP] Fix StackOverflowError when setting timestampNanosTypes.enabled via SparkConf#56431
Closed
stevomitric wants to merge 7 commits into
Conversation
…enabled via SparkConf The checkValue of TIMESTAMP_NANOS_TYPES_ENABLED called SQLConf.get, which re-enters the session's sqlConf lazy val while mergeSparkConf is applying this very conf during session construction, so the first use of the session died with StackOverflowError. Enforce the Types Framework requirement in the effective getter instead. Co-authored-by: Isaac
…removed Co-authored-by: Isaac
Co-authored-by: Isaac
Co-authored-by: Isaac
Contributor
Author
|
cc @MaxGekk PTAL. |
Co-authored-by: Isaac
Co-authored-by: Isaac
MaxGekk
approved these changes
Jun 10, 2026
MaxGekk
left a comment
Member
There was a problem hiding this comment.
0 blocking, 0 non-blocking, 0 nits.
Clean fix — correct root cause analysis, right structural approach, and a regression test that would have caught the original bug.
Member
|
@stevomitric Could you replace |
Contributor
Author
Done. cc @MaxGekk |
Member
|
+1, LGTM. Merging to master/4.x. |
MaxGekk
pushed a commit
that referenced
this pull request
Jun 10, 2026
…stampNanosTypes.enabled via SparkConf
### What changes were proposed in this pull request?
This PR deletes that validator and moves the requirement into the getter: `SQLConf.timestampNanosTypesEnabled` now returns true only when `spark.sql.types.framework.enabled` is also true.
### Why are the changes needed?
Enabling the flag the normal way crashes Spark:
```scala
val spark = SparkSession.builder()
.master("local[1]")
.config("spark.sql.timestampNanosTypes.enabled", "true")
.getOrCreate() // fine — options are applied lazily
spark.sql("SELECT 1") // java.lang.StackOverflowError
```
The validator runs while the session conf is being built (during `mergeSparkConf`), and `SQLConf.get` asks for that same conf which starts building it again, forever.
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Tests in this PR.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Fable 5)
Closes #56431 from stevomitric/stevomitric/fix-nanos-conf-checkvalue-recursion.
Authored-by: Stevo Mitric <stevomitric2000@gmail.com>
Signed-off-by: Max Gekk <max.gekk@gmail.com>
(cherry picked from commit 0e8a75f)
Signed-off-by: Max Gekk <max.gekk@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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?
This PR deletes that validator and moves the requirement into the getter:
SQLConf.timestampNanosTypesEnablednow returns true only whenspark.sql.types.framework.enabledis also true.Why are the changes needed?
Enabling the flag the normal way crashes Spark:
The validator runs while the session conf is being built (during
mergeSparkConf), andSQLConf.getasks for that same conf which starts building it again, forever.Does this PR introduce any user-facing change?
No
How was this patch tested?
Tests in this PR.
Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Fable 5)