aboutsummaryrefslogtreecommitdiff
path: root/sql/catalyst/src/test
diff options
context:
space:
mode:
authorDavies Liu <davies@databricks.com>2015-07-28 22:51:08 -0700
committerReynold Xin <rxin@databricks.com>2015-07-28 22:51:08 -0700
commit15667a0afa5fb17f4cc6fbf32b2ddb573630f20a (patch)
tree660096b33ec70e315fc9e6fdee5f5eb6e1f39c5c /sql/catalyst/src/test
parent6309b93467b06f27cd76d4662b51b47de100c677 (diff)
downloadspark-15667a0afa5fb17f4cc6fbf32b2ddb573630f20a.tar.gz
spark-15667a0afa5fb17f4cc6fbf32b2ddb573630f20a.tar.bz2
spark-15667a0afa5fb17f4cc6fbf32b2ddb573630f20a.zip
[SPARK-9281] [SQL] use decimal or double when parsing SQL
Right now, we use double to parse all the float number in SQL. When it's used in expression together with DecimalType, it will turn the decimal into double as well. Also it will loss some precision when using double. This PR change to parse float number to decimal or double, based on it's using scientific notation or not, see https://msdn.microsoft.com/en-us/library/ms179899.aspx This is a break change, should we doc it somewhere? Author: Davies Liu <davies@databricks.com> Closes #7642 from davies/parse_decimal and squashes the following commits: 1f576d9 [Davies Liu] Merge branch 'master' of github.com:apache/spark into parse_decimal 5e142b6 [Davies Liu] fix scala style eca99de [Davies Liu] fix tests 2afe702 [Davies Liu] Merge branch 'master' of github.com:apache/spark into parse_decimal f4a320b [Davies Liu] Update SqlParser.scala 1c48e34 [Davies Liu] use decimal or double when parsing SQL
Diffstat (limited to 'sql/catalyst/src/test')
-rw-r--r--sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalysisSuite.scala4
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalysisSuite.scala b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalysisSuite.scala
index 4589facb49..221b4e92f0 100644
--- a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalysisSuite.scala
+++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalysisSuite.scala
@@ -145,11 +145,11 @@ class AnalysisSuite extends AnalysisTest {
'e / 'e as 'div5))
val pl = plan.asInstanceOf[Project].projectList
- // StringType will be promoted into Double
assert(pl(0).dataType == DoubleType)
assert(pl(1).dataType == DoubleType)
assert(pl(2).dataType == DoubleType)
- assert(pl(3).dataType == DoubleType)
+ // StringType will be promoted into Decimal(38, 18)
+ assert(pl(3).dataType == DecimalType(38, 29))
assert(pl(4).dataType == DoubleType)
}