diff options
author | petermaxlee <petermaxlee@gmail.com> | 2016-08-11 23:56:55 -0700 |
---|---|---|
committer | Reynold Xin <rxin@databricks.com> | 2016-08-11 23:56:55 -0700 |
commit | 00e103a6edd1a1f001a94d41dd1f7acc40a1e30f (patch) | |
tree | f20e1036827e7fceb8b512278ad7b1af1f807eb1 /sql/catalyst/src/main/scala/org | |
parent | abff92bfdc7d4c9d2308794f0350561fe0ceb4dd (diff) | |
download | spark-00e103a6edd1a1f001a94d41dd1f7acc40a1e30f.tar.gz spark-00e103a6edd1a1f001a94d41dd1f7acc40a1e30f.tar.bz2 spark-00e103a6edd1a1f001a94d41dd1f7acc40a1e30f.zip |
[SPARK-17013][SQL] Parse negative numeric literals
## What changes were proposed in this pull request?
This patch updates the SQL parser to parse negative numeric literals as numeric literals, instead of unary minus of positive literals.
This allows the parser to parse the minimal value for each data type, e.g. "-32768S".
## How was this patch tested?
Updated test cases.
Author: petermaxlee <petermaxlee@gmail.com>
Closes #14608 from petermaxlee/SPARK-17013.
Diffstat (limited to 'sql/catalyst/src/main/scala/org')
-rw-r--r-- | sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala index 4aebef92b9..13e539a223 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala @@ -58,7 +58,7 @@ case class UnaryMinus(child: Expression) extends UnaryExpression } } - override def sql: String = s"(-${child.sql})" + override def sql: String = s"(- ${child.sql})" } @ExpressionDescription( @@ -76,7 +76,7 @@ case class UnaryPositive(child: Expression) protected override def nullSafeEval(input: Any): Any = input - override def sql: String = s"(+${child.sql})" + override def sql: String = s"(+ ${child.sql})" } /** |