You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by do...@apache.org on 2019/07/28 00:04:55 UTC

[spark] branch master updated: [SPARK-28460][SQL][TEST][test-hadoop3.2] Port test from HIVE-11835

This is an automated email from the ASF dual-hosted git repository.

dongjoon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new 8255bd2  [SPARK-28460][SQL][TEST][test-hadoop3.2] Port test from HIVE-11835
8255bd2 is described below

commit 8255bd293784f10b12ef045f350c88bc02ffe256
Author: Yuming Wang <yu...@ebay.com>
AuthorDate: Sat Jul 27 17:04:27 2019 -0700

    [SPARK-28460][SQL][TEST][test-hadoop3.2] Port test from HIVE-11835
    
    ## What changes were proposed in this pull request?
    
    [HIVE-11835](https://issues.apache.org/jira/browse/HIVE-11835) fixed type `decimal(1,1)` reads 0.0, 0.00, etc from text file as NULL. We fixed this issue after upgrade the build-in Hive to 2.3.5. This PR port the test from [HIVE-11835](https://issues.apache.org/jira/browse/HIVE-11835).
    
    Hive test result:
    https://github.com/apache/hive/blob/release-2.3.5-rc0/ql/src/test/results/clientpositive/decimal_1_1.q.out#L67-L96
    
    ## How was this patch tested?
    
    N/A
    
    Closes #25212 from wangyum/SPARK-28460.
    
    Authored-by: Yuming Wang <yu...@ebay.com>
    Signed-off-by: Dongjoon Hyun <dh...@apple.com>
---
 .../hive/execution/HiveCompatibilitySuite.scala    | 18 +++++++++----
 .../src/test/resources/data/files/decimal_1_1.txt  | 30 ++++++++++++++++++++++
 .../decimal_1_1-0-3a2dd6fbf1d1bd84d4ca3db49522c79b |  0
 .../decimal_1_1-1-b53cdd539a5e5982b6b931a3730c54d3 |  0
 .../decimal_1_1-2-61bc0cebc625919a8fa3bec657b32a8a |  0
 .../decimal_1_1-3-ac24b36077314acab595ada14e598e   | 30 ++++++++++++++++++++++
 .../decimal_1_1-4-128804f8dfe7dbb23be0498b91647ba3 | 30 ++++++++++++++++++++++
 .../decimal_1_1-5-8568f0a7b466fba7247cf5c195884579 |  0
 .../src/test/queries/clientpositive/decimal_1_1.q  |  9 +++++++
 9 files changed, 112 insertions(+), 5 deletions(-)

diff --git a/sql/hive/compatibility/src/test/scala/org/apache/spark/sql/hive/execution/HiveCompatibilitySuite.scala b/sql/hive/compatibility/src/test/scala/org/apache/spark/sql/hive/execution/HiveCompatibilitySuite.scala
index cebaad5..12ac706 100644
--- a/sql/hive/compatibility/src/test/scala/org/apache/spark/sql/hive/execution/HiveCompatibilitySuite.scala
+++ b/sql/hive/compatibility/src/test/scala/org/apache/spark/sql/hive/execution/HiveCompatibilitySuite.scala
@@ -600,11 +600,7 @@ class HiveCompatibilitySuite extends HiveQueryFileTest with BeforeAndAfter {
     "udf_hash"
   )
 
-  /**
-   * The set of tests that are believed to be working in catalyst. Tests not on whiteList or
-   * blacklist are implicitly marked as ignored.
-   */
-  override def whiteList: Seq[String] = Seq(
+  private def commonWhiteList = Seq(
     "add_part_exist",
     "add_part_multiple",
     "add_partition_no_whitelist",
@@ -1141,4 +1137,16 @@ class HiveCompatibilitySuite extends HiveQueryFileTest with BeforeAndAfter {
     "view_cast",
     "view_inputs"
   )
+
+  /**
+   * The set of tests that are believed to be working in catalyst. Tests not on whiteList or
+   * blacklist are implicitly marked as ignored.
+   */
+  override def whiteList: Seq[String] = if (HiveUtils.isHive23) {
+    commonWhiteList ++ Seq(
+      "decimal_1_1"
+    )
+  } else {
+    commonWhiteList
+  }
 }
diff --git a/sql/hive/src/test/resources/data/files/decimal_1_1.txt b/sql/hive/src/test/resources/data/files/decimal_1_1.txt
new file mode 100644
index 0000000..ec16804
--- /dev/null
+++ b/sql/hive/src/test/resources/data/files/decimal_1_1.txt
@@ -0,0 +1,30 @@
+0.0
+0.0000
+.0
+0.1
+0.15
+0.9
+0.94
+0.99
+0.345
+1.0
+1
+0
+00
+22
+1E-9
+-0.0
+-0.0000
+-.0
+-0.1
+-0.15
+-0.9
+-0.94
+-0.99
+-0.345
+-1.0
+-1
+-0
+-00
+-22
+-1E-9
diff --git a/sql/hive/src/test/resources/golden/decimal_1_1-0-3a2dd6fbf1d1bd84d4ca3db49522c79b b/sql/hive/src/test/resources/golden/decimal_1_1-0-3a2dd6fbf1d1bd84d4ca3db49522c79b
new file mode 100644
index 0000000..e69de29
diff --git a/sql/hive/src/test/resources/golden/decimal_1_1-1-b53cdd539a5e5982b6b931a3730c54d3 b/sql/hive/src/test/resources/golden/decimal_1_1-1-b53cdd539a5e5982b6b931a3730c54d3
new file mode 100644
index 0000000..e69de29
diff --git a/sql/hive/src/test/resources/golden/decimal_1_1-2-61bc0cebc625919a8fa3bec657b32a8a b/sql/hive/src/test/resources/golden/decimal_1_1-2-61bc0cebc625919a8fa3bec657b32a8a
new file mode 100644
index 0000000..e69de29
diff --git a/sql/hive/src/test/resources/golden/decimal_1_1-3-ac24b36077314acab595ada14e598e b/sql/hive/src/test/resources/golden/decimal_1_1-3-ac24b36077314acab595ada14e598e
new file mode 100644
index 0000000..6944273
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/decimal_1_1-3-ac24b36077314acab595ada14e598e
@@ -0,0 +1,30 @@
+-0.1
+-0.2
+-0.3
+-0.9
+-0.9
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0.1
+0.2
+0.3
+0.9
+0.9
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
diff --git a/sql/hive/src/test/resources/golden/decimal_1_1-4-128804f8dfe7dbb23be0498b91647ba3 b/sql/hive/src/test/resources/golden/decimal_1_1-4-128804f8dfe7dbb23be0498b91647ba3
new file mode 100644
index 0000000..f4bf144
--- /dev/null
+++ b/sql/hive/src/test/resources/golden/decimal_1_1-4-128804f8dfe7dbb23be0498b91647ba3
@@ -0,0 +1,30 @@
+0.9
+0.9
+0.3
+0.2
+0.1
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+-0.1
+-0.2
+-0.3
+-0.9
+-0.9
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
diff --git a/sql/hive/src/test/resources/golden/decimal_1_1-5-8568f0a7b466fba7247cf5c195884579 b/sql/hive/src/test/resources/golden/decimal_1_1-5-8568f0a7b466fba7247cf5c195884579
new file mode 100644
index 0000000..e69de29
diff --git a/sql/hive/src/test/resources/ql/src/test/queries/clientpositive/decimal_1_1.q b/sql/hive/src/test/resources/ql/src/test/queries/clientpositive/decimal_1_1.q
new file mode 100644
index 0000000..79769a9
--- /dev/null
+++ b/sql/hive/src/test/resources/ql/src/test/queries/clientpositive/decimal_1_1.q
@@ -0,0 +1,9 @@
+drop table if exists decimal_1_1;
+
+create table decimal_1_1 (d decimal(1,1)) stored as textfile;
+load data local inpath '../../data/files/decimal_1_1.txt' into table decimal_1_1;
+select * from decimal_1_1;
+
+select d from decimal_1_1 order by d desc;
+
+drop table decimal_1_1;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org