Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-22632

Fix the behavior of timestamp values for R's DataFrame to respect session timezone

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Incomplete
    • Affects Version/s: 2.3.0
    • Fix Version/s: None
    • Component/s: SparkR, SQL
    • Labels:
    • Target Version/s:

      Description

      Note: wording is borrowed from SPARK-22395. Symptom is similar and I think that JIRA is well descriptive.

      When converting R's DataFrame from/to Spark DataFrame using createDataFrame or collect, timestamp values behave to respect R system timezone instead of session timezone.

      For example, let's say we use "America/Los_Angeles" as session timezone and have a timestamp value "1970-01-01 00:00:01" in the timezone. Btw, I'm in South Korea so R timezone would be "KST".
      The timestamp value from current collect() will be the following:

      > sparkR.session(master = "local[*]", sparkConfig = list(spark.sql.session.timeZone = "America/Los_Angeles"))
      > collect(sql("SELECT cast(cast(28801 as timestamp) as string) as ts"))
                         ts
      1 1970-01-01 00:00:01
      > collect(sql("SELECT cast(28801 as timestamp) as ts"))
                         ts
      1 1970-01-01 17:00:01
      

      As you can see, the value becomes "1970-01-01 17:00:01" because it respects R system timezone.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                hyukjin.kwon Hyukjin Kwon
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: