-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-30688][SQL] Week based dates not being parsed with TimestampFormatter #27498
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
Conversation
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeFormatterHelper.scala
Outdated
Show resolved
Hide resolved
|
cc @MaxGekk since you're touching the codes around here. |
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeFormatterHelper.scala
Outdated
Show resolved
Hide resolved
|
Can one of the admins verify this patch? |
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateFormatter.scala
Outdated
Show resolved
Hide resolved
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateFormatter.scala
Outdated
Show resolved
Hide resolved
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeFormatterHelper.scala
Outdated
Show resolved
Hide resolved
|
ping @MaxGekk @HyukjinKwon :) |
| } else { | ||
| Seq( | ||
| (ChronoField.MONTH_OF_YEAR, 1), | ||
| (ChronoField.DAY_OF_MONTH, 1)) |
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 found these default values are very fragile to be set here, so I remove them all in #28576 . Can you check if it fixes your problem?
|
We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable. |
What changes were proposed in this pull request?
When executing the following query using a week based pattern the result is null.
You can replicate this behavior with:
The date is parsed, but not resolved.
This is caused by the default temporal fields that are conflicting with the week based values:
To avoid this conflict, I propose to check if the pattern is a week/year based and change the defaults as follows:
Note:
Additonally in JDK8 there is know issue for patterns
(YYYYww/YYww)https://bugs.openjdk.java.net/browse/JDK-8145633 which fails to parse contiguos patterns without separation, this has been fixed in version 9. To avoid parsing issues add a separator like this(YYYY-ww/YYYY ww)Why are the changes needed?
Week/Year based dates should be supported since it is part of ISO8601. Also, as seen in SPARK-30688, this issue is failing silently.
Does this PR introduce any user-facing change?
How was this patch tested?
DateExpressionsSuite.scala