-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-31910][SQL] Enable Java 8 time API in Thrift server #28729
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
[SPARK-31910][SQL] Enable Java 8 time API in Thrift server #28729
Conversation
| case None => | ||
| } | ||
|
|
||
| sqlContext.sparkContext.setLocalProperty(SQLConf.DATETIME_JAVA8API_ENABLED.key, "true") |
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 think this needs to be set in sqlContext.sparkSession.conf, not as sqlContext.sparkContext.setLocalProperty.
...
actually, an even better place to set it would be here in openSession, to just set it once per session. https://github.com/apache/spark/blob/master/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLSessionManager.scala#L65
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.
shall we forbid users setting the java 8 time config back?
|
Could you add a test that fails before and is fixed after this change to HiveThriftServerBinarySuite (for JDBC) and CLISuite? I think it could be similar to the test for SPARK-31861? |
|
Test build #123540 has finished for PR 28729 at commit
|
|
Test build #123544 has finished for PR 28729 at commit
|
|
retest this please |
|
Test build #123551 has finished for PR 28729 at commit
|
…8-time-api-in-thrift-server
|
Test build #123554 has finished for PR 28729 at commit
|
juliuszsompolski
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.
Please change "2. SparkOperation. withLocalProperties()" in PR description to "SparkSQLSessionManager.openSession()".
|
Does it still work if the user sets the java 8 time config to false manually? |
It should work because we still have cases for the legacy types in toHiveString, right? |
|
It should "work" as in not crash/throw errors, but revert to the inconsistencies it had before this PR, correct @MaxGekk ? I'd say that it's the user conscious choice if they do that and that's fine. |
|
Test build #123563 has finished for PR 28729 at commit
|
|
thanks, merging to master! |
|
Late LGTM too |
What changes were proposed in this pull request?
Set
spark.sql.datetime.java8API.enabledtotruein:SparkSQLEnv.init()of Thrift server, andSparkSQLSessionManager.openSession()Why are the changes needed?
java.sql.Date/java.sql.Timestamp, and the value of such types didn't respect the configspark.sql.session.timeZone. To have consistent view, users had to keep JVM time zone and Spark's session time zone in sync.Does this PR introduce any user-facing change?
Yes. Before:
After:
How was this patch tested?
Manually via
bin/spark-sql.