Repository: incubator-impala
Updated Branches:
  refs/heads/master 1495b2007 -> 9b80224f9


Additional functional testing for default values on Kudu tables

This commit also fixes an issue where an error is thrown if a default
value is set for a boolean column on a Kudu table.

Change-Id: I25b66275d29d1cf21df14e78ab58f625a83b0725
Reviewed-on: http://gerrit.cloudera.org:8080/5337
Reviewed-by: Matthew Jacobs <[email protected]>
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/867b2434
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/867b2434
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/867b2434

Branch: refs/heads/master
Commit: 867b2434ca678a66e8d7bdbd228c86a7d5d032cb
Parents: 1495b20
Author: Dimitris Tsirogiannis <[email protected]>
Authored: Fri Dec 2 16:33:31 2016 -0800
Committer: Impala Public Jenkins <[email protected]>
Committed: Tue Dec 6 00:04:43 2016 +0000

----------------------------------------------------------------------
 .../java/org/apache/impala/util/KuduUtil.java   |  3 +
 .../queries/QueryTest/kudu_insert.test          | 71 ++++++++++++++++++++
 2 files changed, 74 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/867b2434/fe/src/main/java/org/apache/impala/util/KuduUtil.java
----------------------------------------------------------------------
diff --git a/fe/src/main/java/org/apache/impala/util/KuduUtil.java 
b/fe/src/main/java/org/apache/impala/util/KuduUtil.java
index 559c4a5..edd331b 100644
--- a/fe/src/main/java/org/apache/impala/util/KuduUtil.java
+++ b/fe/src/main/java/org/apache/impala/util/KuduUtil.java
@@ -178,6 +178,9 @@ public class KuduUtil {
       case STRING:
         checkCorrectType(literal.isSetString_literal(), type, colName, 
literal);
         return literal.getString_literal().getValue();
+      case BOOL:
+        checkCorrectType(literal.isSetBool_literal(), type, colName, literal);
+        return literal.getBool_literal().isValue();
       default:
         throw new ImpalaRuntimeException("Unsupported value for column type: " 
+
             type.toString());

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/867b2434/testdata/workloads/functional-query/queries/QueryTest/kudu_insert.test
----------------------------------------------------------------------
diff --git 
a/testdata/workloads/functional-query/queries/QueryTest/kudu_insert.test 
b/testdata/workloads/functional-query/queries/QueryTest/kudu_insert.test
index 759dc5e..e282567 100644
--- a/testdata/workloads/functional-query/queries/QueryTest/kudu_insert.test
+++ b/testdata/workloads/functional-query/queries/QueryTest/kudu_insert.test
@@ -331,3 +331,74 @@ insert into allkeytypes select cast(id as tinyint), 
smallint_col, int_col,
 NumModifiedRows: 3
 NumRowErrors: 6
 ====
+---- QUERY
+# Table with default values
+create table tbl_with_defaults (a int primary key, b int null default 10,
+  c int not null default 100, d int default 1000, e int null, f int not null,
+  g string default 'test', h boolean default true) distribute by hash (a) into 
3
+  buckets stored as kudu
+---- RESULTS
+====
+---- QUERY
+insert into tbl_with_defaults (a, f) values (1, 1), (2, 2), (3, 3), (4, 4)
+---- RUNTIME_PROFILE
+NumModifiedRows: 4
+NumRowErrors: 0
+---- LABELS
+A, B, C, D, E, F, G, H
+---- DML_RESULTS: tbl_with_defaults
+1,10,100,1000,NULL,1,'test',true
+2,10,100,1000,NULL,2,'test',true
+3,10,100,1000,NULL,3,'test',true
+4,10,100,1000,NULL,4,'test',true
+---- TYPES
+INT,INT,INT,INT,INT,INT,STRING,BOOLEAN
+====
+---- QUERY
+insert into tbl_with_defaults values (5, 5, 5, 5, 5, 5, 'row', false)
+---- RUNTIME_PROFILE
+NumModifiedRows: 1
+NumRowErrors: 0
+---- LABELS
+A, B, C, D, E, F, G, H
+---- DML_RESULTS: tbl_with_defaults
+1,10,100,1000,NULL,1,'test',true
+2,10,100,1000,NULL,2,'test',true
+3,10,100,1000,NULL,3,'test',true
+4,10,100,1000,NULL,4,'test',true
+5,5,5,5,5,5,'row',false
+---- TYPES
+INT,INT,INT,INT,INT,INT,STRING,BOOLEAN
+====
+---- QUERY
+alter table tbl_with_defaults add columns (i int null, j int not null default 
10000)
+---- RESULTS
+====
+---- QUERY
+select * from tbl_with_defaults
+---- RESULTS
+1,10,100,1000,NULL,1,'test',true,NULL,10000
+2,10,100,1000,NULL,2,'test',true,NULL,10000
+3,10,100,1000,NULL,3,'test',true,NULL,10000
+4,10,100,1000,NULL,4,'test',true,NULL,10000
+5,5,5,5,5,5,'row',false,NULL,10000
+---- TYPES
+INT,INT,INT,INT,INT,INT,STRING,BOOLEAN,INT,INT
+====
+---- QUERY
+insert into tbl_with_defaults values (6,6,6,6,6,6,'another row',false,6,6)
+---- RUNTIME_PROFILE
+NumModifiedRows: 1
+NumRowErrors: 0
+---- LABELS
+A, B, C, D, E, F, G, H, I, J
+---- DML_RESULTS: tbl_with_defaults
+1,10,100,1000,NULL,1,'test',true,NULL,10000
+2,10,100,1000,NULL,2,'test',true,NULL,10000
+3,10,100,1000,NULL,3,'test',true,NULL,10000
+4,10,100,1000,NULL,4,'test',true,NULL,10000
+5,5,5,5,5,5,'row',false,NULL,10000
+6,6,6,6,6,6,'another row',false,6,6
+---- TYPES
+INT,INT,INT,INT,INT,INT,STRING,BOOLEAN,INT,INT
+====

Reply via email to