-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-31221][SQL] Rebase any date-times in conversions to/from Java types #27980
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 9 commits
821ffb5
0b2dd01
5e2148d
b466cac
dd25238
577303f
0d4bc10
a6420f2
db89c92
6e8dba0
46b6613
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -88,13 +88,9 @@ class DateTimeUtilsSuite extends SparkFunSuite with Matchers with SQLHelper { | |
| } | ||
|
|
||
| test("SPARK-6785: java date conversion before and after epoch") { | ||
| def format(d: Date): String = { | ||
| TimestampFormatter("yyyy-MM-dd", defaultTimeZone().toZoneId) | ||
| .format(millisToMicros(d.getTime)) | ||
| } | ||
| def checkFromToJavaDate(d1: Date): Unit = { | ||
| val d2 = toJavaDate(fromJavaDate(d1)) | ||
| assert(format(d2) === format(d1)) | ||
| assert(d2.toString === d1.toString) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here, I restored the code of Spark 2.4: https://github.com/apache/spark/blob/branch-2.4/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/util/DateTimeUtilsSuite.scala#L88 |
||
| } | ||
|
|
||
| val df1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US) | ||
|
|
@@ -508,8 +504,8 @@ class DateTimeUtilsSuite extends SparkFunSuite with Matchers with SQLHelper { | |
| test("2016-03-13 03:00:00", "PST", "2016-03-13 10:00:00.0") | ||
| test("2016-11-06 00:59:59", "PST", "2016-11-06 07:59:59.0") | ||
| // 2016-11-06 01:00:00 PST could be 2016-11-06 08:00:00 UTC or 2016-11-06 09:00:00 UTC | ||
| test("2016-11-06 01:00:00", "PST", "2016-11-06 09:00:00.0") | ||
| test("2016-11-06 01:59:59", "PST", "2016-11-06 09:59:59.0") | ||
| test("2016-11-06 01:00:00", "PST", "2016-11-06 08:00:00.0") | ||
|
||
| test("2016-11-06 01:59:59", "PST", "2016-11-06 08:59:59.0") | ||
| test("2016-11-06 02:00:00", "PST", "2016-11-06 10:00:00.0") | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to change the test because of the 2 lines. I wasn't able to build 2 timestamps via
Timestamp.valueOfafter rebasing.Timestampclass does normalization underneath, and replaces milliseconds since the epoch, and as a consequence of that checking of the results fails. Even textual representation, andyear,month, ...nanosare the same.