[GitHub] hvanhovell commented on a change in pull request #23541: [SPARK-26618][SQL] Make typed Timestamp/Date literals consistent to casting

2019-01-17 Thread GitBox
hvanhovell commented on a change in pull request #23541: [SPARK-26618][SQL] 
Make typed Timestamp/Date literals consistent to casting
URL: https://github.com/apache/spark/pull/23541#discussion_r248756218
 
 

 ##
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
 ##
 @@ -1555,9 +1554,25 @@ class AstBuilder(conf: SQLConf) extends 
SqlBaseBaseVisitor[AnyRef] with Logging
 try {
   valueType match {
 case "DATE" =>
-  Literal(Date.valueOf(value))
+  val castedValue = Cast(
 
 Review comment:
   Move this into a helper function.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] hvanhovell commented on a change in pull request #23541: [SPARK-26618][SQL] Make typed Timestamp/Date literals consistent to casting

2019-01-17 Thread GitBox
hvanhovell commented on a change in pull request #23541: [SPARK-26618][SQL] 
Make typed Timestamp/Date literals consistent to casting
URL: https://github.com/apache/spark/pull/23541#discussion_r248756349
 
 

 ##
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
 ##
 @@ -1555,9 +1554,25 @@ class AstBuilder(conf: SQLConf) extends 
SqlBaseBaseVisitor[AnyRef] with Logging
 try {
   valueType match {
 case "DATE" =>
-  Literal(Date.valueOf(value))
+  val castedValue = Cast(
+Literal(value),
+DateType,
+Some(SQLConf.get.sessionLocalTimeZone)).eval()
 
 Review comment:
   Please use `Option(SQLConf.get.sessionLocalTimeZone)`.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org