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 2019/01/20 13:27:57 UTC

[GitHub] hvanhovell commented on a change in pull request #23596: [SPARK-26652] Use Proleptic Gregorian Calendar in Literal.fromString

hvanhovell commented on a change in pull request #23596: [SPARK-26652] Use Proleptic Gregorian Calendar in Literal.fromString
URL: https://github.com/apache/spark/pull/23596#discussion_r249279014
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/literals.scala
 ##########
 @@ -139,6 +141,11 @@ object Literal {
    * Constructs a Literal from a String
    */
   def fromString(str: String, dataType: DataType): Literal = {
+    def parse[T](f: UTF8String => Option[T]): T = {
+      f(UTF8String.fromString(str)).getOrElse {
+        throw new AnalysisException(s"Cannot parse the ${dataType.catalogString} value: $str")
 
 Review comment:
   Shouldn't we just throw a ParseException here?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

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