-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-27008][SQL] Support java.time.LocalDate as an external type of DateType #23913
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
|
@HeartSaVioR I see, I will rebase. |
|
Yeah if your patch gets in first I'll apply the change too. Thanks! |
|
Test build #102835 has finished for PR 23913 at commit
|
|
@cloud-fan @HeartSaVioR Please, review the PR. |
sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
Outdated
Show resolved
Hide resolved
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/JavaTypeInference.scala
Outdated
Show resolved
Hide resolved
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/encoders/RowEncoder.scala
Outdated
Show resolved
Hide resolved
|
LGTM |
|
Test build #102862 has finished for PR 23913 at commit
|
|
Test build #102859 has finished for PR 23913 at commit
|
|
jenkins, retest this, please |
HeartSaVioR
left a comment
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.
LGTM
|
Test build #102870 has finished for PR 23913 at commit
|
|
thanks, merging to master! |
|
Nice, +1! |
## What changes were proposed in this pull request? In the PR, I propose to extend `Literal.apply` to support constructing literals of `TimestampType` and `DateType` from `java.time.Instant` and `java.time.LocalDate`. The java classes have been already supported as external types for `TimestampType` and `DateType` by the PRs #23811 and #23913. ## How was this patch tested? Added new tests to `LiteralExpressionSuite`. Closes #24161 from MaxGekk/literal-instant-localdate. Authored-by: Maxim Gekk <[email protected]> Signed-off-by: Wenchen Fan <[email protected]>
What changes were proposed in this pull request?
In the PR, I propose to add new Catalyst type converter for
DateType. It should be able to convertjava.time.LocalDateto/fromDateType.Main motivations for the changes:
java.sql.Date(hybrid calendar - Julian + Gregorian).By default, Spark converts values of
DateTypetojava.sql.Dateinstances but the SQL configspark.sql.datetime.java8API.enabledcan change the behavior. If it is set totrue, Spark usesjava.time.LocalDateas external type forDateType.How was this patch tested?
Added new testes to
CatalystTypeConvertersSuiteto check conversion ofDateTypeto/fromjava.time.LocalDate,JavaUDFSuite/UDFSuiteto test usage ofLocalDatetype in Scala/Java UDFs.