You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Max Gekk (Jira)" <ji...@apache.org> on 2023/02/22 11:05:00 UTC

[jira] [Resolved] (SPARK-42516) Non-captured session time zone in view creation

     [ https://issues.apache.org/jira/browse/SPARK-42516?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Max Gekk resolved SPARK-42516.
------------------------------
    Fix Version/s: 3.3.3
                   3.4.0
       Resolution: Fixed

Issue resolved by pull request 40103
[https://github.com/apache/spark/pull/40103]

> Non-captured session time zone in view creation
> -----------------------------------------------
>
>                 Key: SPARK-42516
>                 URL: https://issues.apache.org/jira/browse/SPARK-42516
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 3.4.0, 3.3.3
>            Reporter: Max Gekk
>            Assignee: Max Gekk
>            Priority: Major
>             Fix For: 3.3.3, 3.4.0
>
>
> The session time zone config is captured only when it is set explicitly but if it is not the view is instantiated with the current settings. That's might confuse users since query results depends on explicit SQL config settings while creating a view.
> The example below portraits the issue:
> {code:java}
> val viewName = "v1_capture_test"
> withView(viewName) {
>   assert(get.sessionLocalTimeZone === "America/Los_Angeles")
>   createView(viewName,
>     """select hour(ts) as H from (
>       |  select cast('2022-01-01T00:00:00.000 America/Los_Angeles' as timestamp) as ts
>       |)""".stripMargin, Seq("H"))
>   withDefaultTimeZone(java.time.ZoneId.of("UTC-09:00")) {
>     withSQLConf(SESSION_LOCAL_TIMEZONE.key -> "UTC-10:00") {
>       sql(s"select H from $viewName").show(false)
>     }
>   }
> } {code}
> It is expected to output:
> {code:java}
> +---+
> |H  |
> +---+
> |0  |
> +---+ {code}
> but actual output is:
> {code:java}
> +---+
> |H  |
> +---+
> |8  |
> +---+ {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org