MaxGekk 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_r345040291
 
 

 ##########
 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:
   ```suggestion
       val isNegative = ctx.negativeSign != null && ctx.negativeSign.getText == 
"-"
   ```

----------------------------------------------------------------
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