Github user cloud-fan commented on the pull request: https://github.com/apache/spark/pull/2816#issuecomment-59304268 Hi, @sarutak , nice catch for this problem! And I have some small suggestion for the code: protected lazy val positiveNumericLiteral: Parser[Literal] = "+".? ~> numericLit ^^ { case i if i.toLong > Int.MaxValue => Literal(i.toLong) case i => Literal(i.toInt) } protected lazy val negativeNumericLiteral: Parser[Literal] = "-" ~> numericLit ^^ { case i if s"-$i".toLong < Int.MinValue => Literal(s"-$i".toLong) case i => Literal(s"-$i".toInt) } Then we can rewrite `literal` as: protected lazy val literal: Parser[Literal] = ( positiveNumericLiteral | negativeNumericLiteral | NULL ^^^ Literal(null, NullType) | floatLit ^^ {case f => Literal(f.toDouble) } | stringLit ^^ {case s => Literal(s, StringType) } ) Finally, add `"-" ~> expression ^^ UnaryMinus` and `"+" ~> expression` to `baseExpression`.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org