-
Notifications
You must be signed in to change notification settings - Fork 29.2k
[SPARK-30760][SQL] Port millisToDays and daysToMillis on Java 8 time API
#27494
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 all commits
1211f32
9a2b7be
cc4c07d
1890589
6a64946
cb37fe3
e17762f
e5d463f
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 |
|---|---|---|
|
|
@@ -800,15 +800,15 @@ SELECT DATE_TRUNC('MILLENNIUM', TIMESTAMP '1970-03-20 04:30:00.00000') | |
| -- !query schema | ||
| struct<date_trunc(MILLENNIUM, TIMESTAMP '1970-03-20 04:30:00'):timestamp> | ||
| -- !query output | ||
| 1001-01-01 00:07:02 | ||
| 1001-01-01 00:00:00 | ||
|
|
||
|
|
||
| -- !query | ||
| SELECT DATE_TRUNC('MILLENNIUM', DATE '1970-03-20') | ||
| -- !query schema | ||
| struct<date_trunc(MILLENNIUM, CAST(DATE '1970-03-20' AS TIMESTAMP)):timestamp> | ||
| -- !query output | ||
| 1001-01-01 00:07:02 | ||
| 1001-01-01 00:00:00 | ||
|
|
||
|
|
||
| -- !query | ||
|
|
@@ -840,15 +840,15 @@ SELECT DATE_TRUNC('CENTURY', DATE '0002-02-04') | |
| -- !query schema | ||
| struct<date_trunc(CENTURY, CAST(DATE '0002-02-04' AS TIMESTAMP)):timestamp> | ||
| -- !query output | ||
| 0001-01-01 00:07:02 | ||
| 0001-01-01 00:00:00 | ||
|
|
||
|
|
||
| -- !query | ||
| SELECT DATE_TRUNC('CENTURY', TO_DATE('0055-08-10 BC', 'yyyy-MM-dd G')) | ||
| -- !query schema | ||
| struct<date_trunc(CENTURY, CAST(to_date('0055-08-10 BC', 'yyyy-MM-dd G') AS TIMESTAMP)):timestamp> | ||
| -- !query output | ||
| -0099-01-01 00:07:02 | ||
| -0099-01-01 00:00:00 | ||
|
|
||
|
|
||
| -- !query | ||
|
|
@@ -864,15 +864,15 @@ SELECT DATE_TRUNC('DECADE', DATE '0004-12-25') | |
| -- !query schema | ||
| struct<date_trunc(DECADE, CAST(DATE '0004-12-25' AS TIMESTAMP)):timestamp> | ||
| -- !query output | ||
| 0000-01-01 00:07:02 | ||
| 0000-01-01 00:00:00 | ||
|
|
||
|
|
||
| -- !query | ||
| SELECT DATE_TRUNC('DECADE', TO_DATE('0002-12-31 BC', 'yyyy-MM-dd G')) | ||
| -- !query schema | ||
| struct<date_trunc(DECADE, CAST(to_date('0002-12-31 BC', 'yyyy-MM-dd G') AS TIMESTAMP)):timestamp> | ||
| -- !query output | ||
| -0010-01-01 00:07:02 | ||
| -0010-01-01 00:00:00 | ||
|
Member
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. I was going to ask if there are any behavior changes. This is one, but it looks like it was wrong before? Are there any others that we know of? Given recent discussions I'm extra cautious about introducing behavior changes I suppose.
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. This had been already described in the SQL migration guide. The numbers are different because internally we use Proleptic Gregorian calendar in By settings
Contributor
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. This is caused by https://github.com/apache/spark/pull/27494/files#diff-432455394ca50800d5de508861984ca5R340 , not the fix itself, right? Do we have any known behavior changes caused by this fix?
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. Yes, the change in this particular line is caused by
Contributor
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. Do you think it's helpful to do #27494 (comment) first and then we can know what gets changed exactly by this fix? |
||
|
|
||
|
|
||
| -- !query | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -337,6 +337,7 @@ class SQLQueryTestSuite extends QueryTest with SharedSparkSession { | |
| localSparkSession.conf.set(SQLConf.ANSI_ENABLED.key, true) | ||
| case _ => | ||
| } | ||
| localSparkSession.conf.set(SQLConf.DATETIME_JAVA8API_ENABLED.key, true) | ||
|
Contributor
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. I think this is a bug in When we produce string result, we must stick with the Proleptic Gregorian calendar and call
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. HiveResult is used in
Contributor
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. Can we open a new PR to do it? I believe we need to do this after switching to Proleptic Gregorian calendar. We should avoid using different calendars inconsistently.
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. Sure, I will do that after this PR will be merged because I will need the changes, most likely. |
||
|
|
||
| if (configSet.nonEmpty) { | ||
| // Execute the list of set operation in order to add the desired configs | ||
|
|
||
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 use the formatter to avoid calendar problems -
Date.toStringformats slightly differently thanDateTimeFormatter, I guess because of different year lengths in calendars.