Commit 00e5690
committed
[SPARK-42516][SQL] Always capture the session time zone config while creating views
### What changes were proposed in this pull request?
In the PR, I propose to capture the session time zone config (`spark.sql.session.timeZone`) as a view property, and use it while re-parsing/analysing the view. If the SQL config is not set while creating a view, use the default value of the config.
### Why are the changes needed?
To improve user experience with Spark SQL. The current behaviour might confuse users because query results depends on whether or not the session time zone was set explicitly while creating a view.
### Does this PR introduce _any_ user-facing change?
Yes. Before the changes, the current value of the session time zone is used in view analysis but this behaviour can be restored via another SQL config `spark.sql.legacy.useCurrentConfigsForView`.
### How was this patch tested?
By running the new test via:
```
$ build/sbt "test:testOnly *.PersistedViewTestSuite"
```
Closes apache#40103 from MaxGekk/view-tz-conf.
Authored-by: Max Gekk <[email protected]>
Signed-off-by: Max Gekk <[email protected]>1 parent a6098be commit 00e5690
File tree
2 files changed
+25
-1
lines changed- sql/core/src
- main/scala/org/apache/spark/sql/execution/command
- test/scala/org/apache/spark/sql/execution
2 files changed
+25
-1
lines changedLines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
398 | 398 | | |
399 | 399 | | |
400 | 400 | | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
401 | 408 | | |
402 | | - | |
| 409 | + | |
403 | 410 | | |
404 | 411 | | |
405 | 412 | | |
| |||
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
714 | 715 | | |
715 | 716 | | |
716 | 717 | | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
717 | 734 | | |
718 | 735 | | |
719 | 736 | | |
| |||
0 commit comments