You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by ta...@apache.org on 2017/03/03 02:01:11 UTC
[3/4] incubator-impala git commit: IMPALA-4810: add DECIMAL test case
to strict_mode tests
IMPALA-4810: add DECIMAL test case to strict_mode tests
The string parsing code already errors if the decimal column either
overflows or underflows (i.e. loses scale). Let's just add a test
case.
Change-Id: Idd66c0fb5a4d201919d39f73dea08b87339d6469
Reviewed-on: http://gerrit.cloudera.org:8080/6150
Reviewed-by: Dan Hecht <dh...@cloudera.com>
Tested-by: Impala Public Jenkins
Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/bf2e8972
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/bf2e8972
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/bf2e8972
Branch: refs/heads/master
Commit: bf2e897209f1672073380665f84a4209be04b349
Parents: 3a2a380
Author: Dan Hecht <dh...@cloudera.com>
Authored: Fri Feb 24 14:54:32 2017 -0800
Committer: Impala Public Jenkins <im...@gerrit.cloudera.org>
Committed: Fri Mar 3 01:43:42 2017 +0000
----------------------------------------------------------------------
testdata/data/overflow.txt | 6 +++---
.../functional/functional_schema_template.sql | 3 +++
.../functional-query/queries/QueryTest/overflow.test | 6 ++++--
.../queries/QueryTest/strict-mode-abort.test | 15 +++++++++++++++
.../queries/QueryTest/strict-mode.test | 14 ++++++++++----
5 files changed, 35 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/bf2e8972/testdata/data/overflow.txt
----------------------------------------------------------------------
diff --git a/testdata/data/overflow.txt b/testdata/data/overflow.txt
index ded5d49..5186f2c 100644
--- a/testdata/data/overflow.txt
+++ b/testdata/data/overflow.txt
@@ -1,3 +1,3 @@
-1,2,3,4,5.5,6.6
-1000,100000,10000000000000000,10000000000000000000,1e1000000,1e10000
--1000,-100000,-10000000000000000,-10000000000000000000,-1e1000000,-1e10000
+1,2,3,4,5.5,6.6,123456789.1234,99999999999999999999999999999999999999,0.00000000000000000000000000000000000001
+1000,100000,10000000000000000,10000000000000000000,1e1000000,1e10000,1234567890.1234,100000000000000000000000000000000000000,0.000000000000000000000000000000000000009
+-1000,-100000,-10000000000000000,-10000000000000000000,-1e1000000,-1e10000,-123456789.12341,-100000000000000000000000000000000000000,-0.000000000000000000000000000000000000009
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/bf2e8972/testdata/datasets/functional/functional_schema_template.sql
----------------------------------------------------------------------
diff --git a/testdata/datasets/functional/functional_schema_template.sql b/testdata/datasets/functional/functional_schema_template.sql
index 97b40f4..1aacf43 100644
--- a/testdata/datasets/functional/functional_schema_template.sql
+++ b/testdata/datasets/functional/functional_schema_template.sql
@@ -1078,6 +1078,9 @@ int_col int
bigint_col bigint
float_col float
double_col double
+decimal0_col DECIMAL(13,4)
+decimal1_col DECIMAL(38,0)
+decimal2_col DECIMAL(38,38)
---- ROW_FORMAT
delimited fields terminated by ',' escaped by '\\'
---- LOAD
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/bf2e8972/testdata/workloads/functional-query/queries/QueryTest/overflow.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/functional-query/queries/QueryTest/overflow.test b/testdata/workloads/functional-query/queries/QueryTest/overflow.test
index 075a4f6..0ce1157 100644
--- a/testdata/workloads/functional-query/queries/QueryTest/overflow.test
+++ b/testdata/workloads/functional-query/queries/QueryTest/overflow.test
@@ -1,7 +1,9 @@
====
---- QUERY
-# Tests overflow
-select * from Overflow
+# Tests overflow. Note that decimal columns produce error on overflow
+# even without --strict_mode, so we don't select the decimal columns in
+# this test case.
+select tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col from Overflow
---- TYPES
tinyint, smallint, int, bigint, float, double
---- RESULTS
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/bf2e8972/testdata/workloads/functional-query/queries/QueryTest/strict-mode-abort.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/functional-query/queries/QueryTest/strict-mode-abort.test b/testdata/workloads/functional-query/queries/QueryTest/strict-mode-abort.test
index 808346f..eb5e82e 100644
--- a/testdata/workloads/functional-query/queries/QueryTest/strict-mode-abort.test
+++ b/testdata/workloads/functional-query/queries/QueryTest/strict-mode-abort.test
@@ -29,3 +29,18 @@ select double_col from overflow
---- CATCH
Error converting column: 5 to DOUBLE
====
+---- QUERY
+select decimal0_col from overflow
+---- CATCH
+Error converting column: 6 to DECIMAL
+====
+---- QUERY
+select decimal1_col from overflow
+---- CATCH
+Error converting column: 7 to DECIMAL
+====
+---- QUERY
+select decimal2_col from overflow
+---- CATCH
+Error converting column: 8 to DECIMAL
+====
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/bf2e8972/testdata/workloads/functional-query/queries/QueryTest/strict-mode.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/functional-query/queries/QueryTest/strict-mode.test b/testdata/workloads/functional-query/queries/QueryTest/strict-mode.test
index b70c272..27f6fc3 100644
--- a/testdata/workloads/functional-query/queries/QueryTest/strict-mode.test
+++ b/testdata/workloads/functional-query/queries/QueryTest/strict-mode.test
@@ -8,6 +8,9 @@ Error converting column: 2 to INT
Error converting column: 3 to BIGINT
Error converting column: 4 to FLOAT
Error converting column: 5 to DOUBLE
+Error converting column: 6 to DECIMAL(13,4)
+Error converting column: 7 to DECIMAL(38,0)
+Error converting column: 8 to DECIMAL(38,38)
row_regex: .*Error parsing row: file: $NAMENODE/.* before offset: \d+
Error converting column: 0 to TINYINT
Error converting column: 1 to SMALLINT
@@ -15,11 +18,14 @@ Error converting column: 2 to INT
Error converting column: 3 to BIGINT
Error converting column: 4 to FLOAT
Error converting column: 5 to DOUBLE
+Error converting column: 6 to DECIMAL(13,4)
+Error converting column: 7 to DECIMAL(38,0)
+Error converting column: 8 to DECIMAL(38,38)
row_regex: .*Error parsing row: file: $NAMENODE/.* before offset: \d+
---- RESULTS
-1,2,3,4,5.5,6.6
-NULL,NULL,NULL,NULL,NULL,NULL
-NULL,NULL,NULL,NULL,NULL,NULL
+1,2,3,4,5.5,6.6,123456789.1234,99999999999999999999999999999999999999,0.00000000000000000000000000000000000001
+NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL
+NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL
---- TYPES
-tinyint, smallint, int, bigint, float, double
+tinyint, smallint, int, bigint, float, double, decimal, decimal, decimal
====