-
Notifications
You must be signed in to change notification settings - Fork 29.3k
[SPARK-30808][SQL] Enable Java 8 time API in Thrift server #27552
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 6 commits
916838a
d98cdbc
580dd09
deaef58
804e709
80f4c89
d3131a5
e68e622
e491f96
95597a7
2086bbf
69f63b2
cdb322d
5ac5e77
ce77628
f9112b7
2129f30
902f9d8
880b1de
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 |
|---|---|---|
|
|
@@ -378,7 +378,6 @@ class SQLQueryTestSuite extends QueryTest with SharedSparkSession { | |
| localSparkSession.conf.set(SQLConf.ANSI_ENABLED.key, true) | ||
| case _ => | ||
| } | ||
| localSparkSession.conf.set(SQLConf.DATETIME_JAVA8API_ENABLED.key, true) | ||
|
|
||
| if (configSet.nonEmpty) { | ||
| // Execute the list of set operation in order to add the desired configs | ||
|
|
@@ -512,7 +511,7 @@ class SQLQueryTestSuite extends QueryTest with SharedSparkSession { | |
| val schema = df.schema.catalogString | ||
| // Get answer, but also get rid of the #1234 expression ids that show up in explain plans | ||
| val answer = SQLExecution.withNewExecutionId(df.queryExecution, Some(sql)) { | ||
| hiveResultString(df.queryExecution.executedPlan).map(replaceNotIncludedMsg) | ||
| hiveResultString(df).map(replaceNotIncludedMsg) | ||
|
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. in We should follow pgsql and return java 8 datetime when the config is enabled. https://jdbc.postgresql.org/documentation/head/8-date-time.html |
||
| } | ||
|
|
||
| // If the output is not pre-sorted, sort it. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,7 @@ package org.apache.spark.sql.hive.thriftserver | |
|
|
||
| import java.security.PrivilegedExceptionAction | ||
| import java.sql.{Date, Timestamp} | ||
| import java.time.{Instant, LocalDate} | ||
| import java.util.{Arrays, Map => JMap, UUID} | ||
| import java.util.concurrent.RejectedExecutionException | ||
|
|
||
|
|
@@ -178,7 +179,12 @@ private[hive] class SparkExecuteStatementOperation( | |
| } | ||
| curCol += 1 | ||
| } | ||
| resultRowSet.addRow(row.toArray.asInstanceOf[Array[Object]]) | ||
| val resultRow = row.map { | ||
|
cloud-fan marked this conversation as resolved.
|
||
| case i: Instant => Timestamp.from(i) | ||
|
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. There seems no java8 datetime values to be add to the
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 you help fix it? I think we should output java8 datetime values if the config is enabled.
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. We are limited by |
||
| case ld: LocalDate => Date.valueOf(ld) | ||
| case other => other | ||
| }.toArray.asInstanceOf[Array[Object]] | ||
| resultRowSet.addRow(resultRow) | ||
| curRow += 1 | ||
| resultOffset += 1 | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.