-
- Downloads
[SPARK-12848][SQL] Change parsed decimal literal datatype from Double to Decimal
The current parser turns a decimal literal, for example ```12.1```, into a Double. The problem with this approach is that we convert an exact literal into a non-exact ```Double```. The PR changes this behavior, a Decimal literal is now converted into an extact ```BigDecimal```. The behavior for scientific decimals, for example ```12.1e01```, is unchanged. This will be converted into a Double. This PR replaces the ```BigDecimal``` literal by a ```Double``` literal, because the ```BigDecimal``` is the default now. You can use the double literal by appending a 'D' to the value, for instance: ```3.141527D``` cc davies rxin Author: Herman van Hovell <hvanhovell@questtec.nl> Closes #10796 from hvanhovell/SPARK-12848.
Showing
- R/pkg/inst/tests/testthat/test_sparkSQL.R 1 addition, 1 deletionR/pkg/inst/tests/testthat/test_sparkSQL.R
- sql/catalyst/src/main/antlr3/org/apache/spark/sql/catalyst/parser/ExpressionParser.g 1 addition, 1 deletion...3/org/apache/spark/sql/catalyst/parser/ExpressionParser.g
- sql/catalyst/src/main/antlr3/org/apache/spark/sql/catalyst/parser/SparkSqlLexer.g 2 additions, 2 deletions...tlr3/org/apache/spark/sql/catalyst/parser/SparkSqlLexer.g
- sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/CatalystQl.scala 6 additions, 2 deletions...main/scala/org/apache/spark/sql/catalyst/CatalystQl.scala
- sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/HiveTypeCoercion.scala 1 addition, 2 deletions...apache/spark/sql/catalyst/analysis/HiveTypeCoercion.scala
- sql/core/src/test/scala/org/apache/spark/sql/MathExpressionsSuite.scala 11 additions, 1 deletion...est/scala/org/apache/spark/sql/MathExpressionsSuite.scala
- sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala 25 additions, 25 deletions...e/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala
- sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/json/JsonSuite.scala 2 additions, 2 deletions...ache/spark/sql/execution/datasources/json/JsonSuite.scala
- sql/hive/compatibility/src/test/scala/org/apache/spark/sql/hive/execution/HiveCompatibilitySuite.scala 8 additions, 5 deletions...che/spark/sql/hive/execution/HiveCompatibilitySuite.scala
- sql/hive/compatibility/src/test/scala/org/apache/spark/sql/hive/execution/HiveWindowFunctionQuerySuite.scala 1 addition, 1 deletion...ark/sql/hive/execution/HiveWindowFunctionQuerySuite.scala
- sql/hive/src/test/resources/golden/'1' + 1.0-0-404b0ea20c125c9648b7919a8f41add3 0 additions, 0 deletions...urces/golden/'1' + 1.0-0-404b0ea20c125c9648b7919a8f41add3
- sql/hive/src/test/resources/golden/1 + 1.0-0-77ca48f121bd2ef41efb9ee3bc28418 0 additions, 0 deletions...esources/golden/1 + 1.0-0-77ca48f121bd2ef41efb9ee3bc28418
- sql/hive/src/test/resources/golden/1.0 + '1'-0-6beb1ef5178117a9fd641008ed5ebb80 0 additions, 0 deletions...urces/golden/1.0 + '1'-0-6beb1ef5178117a9fd641008ed5ebb80
- sql/hive/src/test/resources/golden/1.0 + 1-0-bec2842d2b009973b4d4b8f10b5554f8 0 additions, 0 deletions...sources/golden/1.0 + 1-0-bec2842d2b009973b4d4b8f10b5554f8
- sql/hive/src/test/resources/golden/1.0 + 1.0-0-eafdfdbb14980ee517c388dc117d91a8 0 additions, 0 deletions...urces/golden/1.0 + 1.0-0-eafdfdbb14980ee517c388dc117d91a8
- sql/hive/src/test/resources/golden/1.0 + 1L-0-ef273f05968cd0e91af8c76949c73798 0 additions, 0 deletions...ources/golden/1.0 + 1L-0-ef273f05968cd0e91af8c76949c73798
- sql/hive/src/test/resources/golden/1.0 + 1S-0-9f93538c38920d52b322bfc40cc2f31a 0 additions, 0 deletions...ources/golden/1.0 + 1S-0-9f93538c38920d52b322bfc40cc2f31a
- sql/hive/src/test/resources/golden/1.0 + 1Y-0-9e354e022b1b423f366bf79ed7522f2a 0 additions, 0 deletions...ources/golden/1.0 + 1Y-0-9e354e022b1b423f366bf79ed7522f2a
- sql/hive/src/test/resources/golden/1L + 1.0-0-9b0510d0bb3e9ee6a7698369b008a280 0 additions, 0 deletions...ources/golden/1L + 1.0-0-9b0510d0bb3e9ee6a7698369b008a280
- sql/hive/src/test/resources/golden/1S + 1.0-0-c3d54e5b6034b7796ed16896a434d1ba 0 additions, 0 deletions...ources/golden/1S + 1.0-0-c3d54e5b6034b7796ed16896a434d1ba
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
Please register or sign in to comment