-
- Downloads
[SPARK-17246][SQL] Add BigDecimal literal
## What changes were proposed in this pull request? This PR adds parser support for `BigDecimal` literals. If you append the suffix `BD` to a valid number then this will be interpreted as a `BigDecimal`, for example `12.0E10BD` will interpreted into a BigDecimal with scale -9 and precision 3. This is useful in situations where you need exact values. ## How was this patch tested? Added tests to `ExpressionParserSuite`, `ExpressionSQLBuilderSuite` and `SQLQueryTestSuite`. Author: Herman van Hovell <hvanhovell@databricks.com> Closes #14819 from hvanhovell/SPARK-17246.
Showing
- sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4 6 additions, 0 deletions...in/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4
- sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/literals.scala 1 addition, 1 deletion.../org/apache/spark/sql/catalyst/expressions/literals.scala
- sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala 15 additions, 1 deletion...ala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
- sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/parser/ExpressionParserSuite.scala 7 additions, 0 deletions...che/spark/sql/catalyst/parser/ExpressionParserSuite.scala
- sql/core/src/test/resources/sql-tests/inputs/literals.sql 6 additions, 0 deletionssql/core/src/test/resources/sql-tests/inputs/literals.sql
- sql/core/src/test/resources/sql-tests/results/literals.sql.out 23 additions, 1 deletion...ore/src/test/resources/sql-tests/results/literals.sql.out
- sql/hive/src/test/scala/org/apache/spark/sql/catalyst/ExpressionSQLBuilderSuite.scala 1 addition, 0 deletions...apache/spark/sql/catalyst/ExpressionSQLBuilderSuite.scala
Loading
Please register or sign in to comment