Skip to content
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

Support spark.sql.datetime.java8API.enabled #1303

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

tom-s-powell
Copy link
Contributor

When spark.sql.datetime.java8API.enabled is true, Spark dates and timestamps will be returned as java.time.LocalDate/java.time.Instant rather than java.sql.Date/java.sql.Timestamp.

https://issues.apache.org/jira/browse/SPARK-38437 addressed this in https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala so perhaps this code path could leverage that?

Currently if this config is enabled you hit java.lang.ClassCastException.

@davidrabinowitz
Copy link
Member

Hi @tom-s-powell , thanks for the PR! It seems that the relevant methods are in org.apache.spark.sql.catalyst.util.SparkDateTimeUtils, can you please check?

@davidrabinowitz
Copy link
Member

Also, it seem to be available only in Spark 3.5, so we may need our own implementation instead of the Spark one to support older Spark versions.

@tom-s-powell
Copy link
Contributor Author

Ah yes looks like they moved in recent version. I've added the implementation directly rather than relying on the Spark one.

@davidrabinowitz
Copy link
Member

/gcbrun

@davidrabinowitz
Copy link
Member

/gcbrun

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants