You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Waldemar (Jira)" <ji...@apache.org> on 2020/02/03 07:32:00 UTC
[jira] [Created] (SPARK-30706) TimeZone in writing pure date type
in CSV output
Waldemar created SPARK-30706:
--------------------------------
Summary: TimeZone in writing pure date type in CSV output
Key: SPARK-30706
URL: https://issues.apache.org/jira/browse/SPARK-30706
Project: Spark
Issue Type: Bug
Components: Spark Shell
Affects Versions: 2.4.3
Reporter: Waldemar
If I read string date from CSV file, then cast to date type and write into CSV file again on the west of Greenwich to csv file again it writes date of one day ago. This way making this operation in loop we can get unwillingly past date.
If the spark-shell work on the east of Greenwich all is OK.
Example of code:
{code:java}
//
val test_5_load = "hdfs://192.168.44.161:8020/db/wbiernacki/test_5_load.csv"
val test_5_save = "hdfs://192.168.44.161:8020/db/wbiernacki/test_5_save.csv"
val test_5 = spark.read.format("csv")
.option("header","true")
.load( test_5_load )
.withColumn("begin",to_date(col("begin" ),"yyyy-MM-dd"))
.withColumn("end" ,to_date(col("end" ),"yyyy-MM-dd"))
test_5.show()
test_5
.write.mode("overwrite")
.format("csv")
.option("header","true")
.save( test_5_save )
{code}
Please perform this few times.. The test_5_load.csv file looks like:
{code:java}
//
+--------+----------+----------+----+
| patient| begin| end| new|
+--------+----------+----------+----+
|waldemar|2015-09-22|2015-09-23|old1|
+--------+----------+----------+----+{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org