aboutsummaryrefslogtreecommitdiff
path: root/sql/core/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'sql/core/src/test')
-rw-r--r--sql/core/src/test/scala/org/apache/spark/sql/sources/CreateTableAsSelectSuite.scala12
1 files changed, 12 insertions, 0 deletions
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/sources/CreateTableAsSelectSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/sources/CreateTableAsSelectSuite.scala
index 729c9fdda5..344d4aa6cf 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/sources/CreateTableAsSelectSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/sources/CreateTableAsSelectSuite.scala
@@ -236,4 +236,16 @@ class CreateTableAsSelectSuite
assert(e.contains("Expected positive number of buckets, but got `0`"))
}
}
+
+ test("CTAS of decimal calculation") {
+ withTable("tab2") {
+ withTempView("tab1") {
+ spark.range(99, 101).createOrReplaceTempView("tab1")
+ val sqlStmt =
+ "SELECT id, cast(id as long) * cast('1.0' as decimal(38, 18)) as num FROM tab1"
+ sql(s"CREATE TABLE tab2 USING PARQUET AS $sqlStmt")
+ checkAnswer(spark.table("tab2"), sql(sqlStmt))
+ }
+ }
+ }
}