yaooqinn commented on a change in pull request #26479: [SPARK-29855][SQL] typed 
literals with negative sign with proper result or exception
URL: https://github.com/apache/spark/pull/26479#discussion_r345061603
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
 ##########
 @@ -1860,16 +1860,19 @@ class AstBuilder(conf: SQLConf) extends 
SqlBaseBaseVisitor[AnyRef] with Logging
   override def visitTypeConstructor(ctx: TypeConstructorContext): Literal = 
withOrigin(ctx) {
     val value = string(ctx.STRING)
     val valueType = ctx.identifier.getText.toUpperCase(Locale.ROOT)
+    val negativeSign = Option(ctx.negativeSign).map(_.getText).getOrElse("")
+    val isNegative = if (negativeSign == "-") true else false
 
 Review comment:
   `negativeSign` is used in error message, but I think @cloud-fan 's point is 
right, we need not to check `ctx.negativeSign.getText`. I'd do some tests to 
verify this.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to