You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/01/26 14:16:20 UTC
[GitHub] [spark] HyukjinKwon commented on a change in pull request #31148: [SPARK-33867][SQL] Instant and LocalDate values aren't handled when generating SQL queries
HyukjinKwon commented on a change in pull request #31148:
URL: https://github.com/apache/spark/pull/31148#discussion_r564542156
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala
##########
@@ -175,7 +179,12 @@ abstract class JdbcDialect extends Serializable with Logging{
def compileValue(value: Any): Any = value match {
case stringValue: String => s"'${escapeSql(stringValue)}'"
case timestampValue: Timestamp => "'" + timestampValue + "'"
+ case timestampValue: Instant =>
+ val timestampFormatter = TimestampFormatter.getFractionFormatter(
+ DateTimeUtils.getZoneId(SQLConf.get.sessionLocalTimeZone))
+ "'" + timestampFormatter.format(timestampValue) + "'"
case dateValue: Date => "'" + dateValue + "'"
+ case dateValue: LocalDate => "'" + dateValue + "'"
Review comment:
@MaxGekk, is it the correct way to use the string representation of date/timestamps?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org