hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sp...@apache.org
Subject hive git commit: HIVE-16415: Add tests covering single inserts of zero rows (Thomas Poepping, reviewed by Sergio Pena, Ashutosh Chauhan)
Date Fri, 14 Apr 2017 18:56:31 GMT
Repository: hive
Updated Branches:
  refs/heads/branch-2.2 f3fada1a0 -> f13de0bf2


HIVE-16415: Add tests covering single inserts of zero rows (Thomas Poepping, reviewed by Sergio
Pena, Ashutosh Chauhan)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/f13de0bf
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/f13de0bf
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/f13de0bf

Branch: refs/heads/branch-2.2
Commit: f13de0bf26305ed73b35af29303e899795f9d807
Parents: f3fada1
Author: Thomas Poepping <poeppt@amazon.com>
Authored: Fri Apr 14 13:10:59 2017 -0500
Committer: Sergio Pena <sergio.pena@cloudera.com>
Committed: Fri Apr 14 13:30:19 2017 -0500

----------------------------------------------------------------------
 .../clientpositive/zero_rows_blobstore.q        |  19 ++++
 .../queries/clientpositive/zero_rows_hdfs.q     |  18 +++
 .../clientpositive/zero_rows_blobstore.q.out    |  91 +++++++++++++++
 .../results/clientpositive/zero_rows_hdfs.q.out |  89 +++++++++++++++
 .../clientpositive/zero_rows_single_insert.q    |  17 +++
 .../zero_rows_single_insert.q.out               | 113 +++++++++++++++++++
 6 files changed, 347 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/f13de0bf/itests/hive-blobstore/src/test/queries/clientpositive/zero_rows_blobstore.q
----------------------------------------------------------------------
diff --git a/itests/hive-blobstore/src/test/queries/clientpositive/zero_rows_blobstore.q b/itests/hive-blobstore/src/test/queries/clientpositive/zero_rows_blobstore.q
new file mode 100644
index 0000000..1f663ef
--- /dev/null
+++ b/itests/hive-blobstore/src/test/queries/clientpositive/zero_rows_blobstore.q
@@ -0,0 +1,19 @@
+-- Insert overwrite into blobstore when WHERE clause returns zero rows
+DROP TABLE blobstore_source;
+CREATE TABLE blobstore_source (
+    key int
+) 
+LOCATION '${hiveconf:test.blobstore.path.unique}/zero_rows_blobstore/blobstore_source/';
+LOAD DATA LOCAL INPATH '../../data/files/kv6.txt' INTO TABLE blobstore_source;
+
+DROP TABLE blobstore_target;
+CREATE TABLE blobstore_target (
+    key int
+) 
+LOCATION '${hiveconf:test.blobstore.path.unique}/zero_rows_blobstore/blobstore_target';
+
+SELECT COUNT(*) FROM blobstore_target;
+INSERT OVERWRITE TABLE blobstore_target SELECT key FROM blobstore_source;
+SELECT COUNT(*) FROM blobstore_target;
+INSERT OVERWRITE TABLE blobstore_target SELECT key FROM blobstore_source WHERE FALSE;
+SELECT COUNT(*) FROM blobstore_target;

http://git-wip-us.apache.org/repos/asf/hive/blob/f13de0bf/itests/hive-blobstore/src/test/queries/clientpositive/zero_rows_hdfs.q
----------------------------------------------------------------------
diff --git a/itests/hive-blobstore/src/test/queries/clientpositive/zero_rows_hdfs.q b/itests/hive-blobstore/src/test/queries/clientpositive/zero_rows_hdfs.q
new file mode 100644
index 0000000..ef3b71d
--- /dev/null
+++ b/itests/hive-blobstore/src/test/queries/clientpositive/zero_rows_hdfs.q
@@ -0,0 +1,18 @@
+-- Insert overwrite into hdfs from blobstore when WHERE clause returns zero rows
+DROP TABLE blobstore_source;
+CREATE TABLE blobstore_source (
+    key int
+)
+LOCATION '${hiveconf:test.blobstore.path.unique}/zero_rows_hdfs/blobstore_source/';
+LOAD DATA LOCAL INPATH '../../data/files/kv6.txt' INTO TABLE blobstore_source;
+
+DROP TABLE hdfs_target;
+CREATE TABLE hdfs_target (
+    key int
+);
+
+SELECT COUNT(*) FROM hdfs_target;
+INSERT OVERWRITE TABLE hdfs_target SELECT key FROM blobstore_source;
+SELECT COUNT(*) FROM hdfs_target;
+INSERT OVERWRITE TABLE hdfs_target SELECT key FROM blobstore_source WHERE FALSE;
+SELECT COUNT(*) FROM hdfs_target;

http://git-wip-us.apache.org/repos/asf/hive/blob/f13de0bf/itests/hive-blobstore/src/test/results/clientpositive/zero_rows_blobstore.q.out
----------------------------------------------------------------------
diff --git a/itests/hive-blobstore/src/test/results/clientpositive/zero_rows_blobstore.q.out
b/itests/hive-blobstore/src/test/results/clientpositive/zero_rows_blobstore.q.out
new file mode 100644
index 0000000..590f947
--- /dev/null
+++ b/itests/hive-blobstore/src/test/results/clientpositive/zero_rows_blobstore.q.out
@@ -0,0 +1,91 @@
+PREHOOK: query: DROP TABLE blobstore_source
+PREHOOK: type: DROPTABLE
+POSTHOOK: query: DROP TABLE blobstore_source
+POSTHOOK: type: DROPTABLE
+PREHOOK: query: CREATE TABLE blobstore_source (
+    key int
+) 
+#### A masked pattern was here ####
+PREHOOK: type: CREATETABLE
+PREHOOK: Input: ### test.blobstore.path ###/zero_rows_blobstore/blobstore_source
+PREHOOK: Output: database:default
+PREHOOK: Output: default@blobstore_source
+POSTHOOK: query: CREATE TABLE blobstore_source (
+    key int
+) 
+#### A masked pattern was here ####
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Input: ### test.blobstore.path ###/zero_rows_blobstore/blobstore_source
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@blobstore_source
+PREHOOK: query: LOAD DATA LOCAL INPATH '../../data/files/kv6.txt' INTO TABLE blobstore_source
+PREHOOK: type: LOAD
+#### A masked pattern was here ####
+PREHOOK: Output: default@blobstore_source
+POSTHOOK: query: LOAD DATA LOCAL INPATH '../../data/files/kv6.txt' INTO TABLE blobstore_source
+POSTHOOK: type: LOAD
+#### A masked pattern was here ####
+POSTHOOK: Output: default@blobstore_source
+PREHOOK: query: DROP TABLE blobstore_target
+PREHOOK: type: DROPTABLE
+POSTHOOK: query: DROP TABLE blobstore_target
+POSTHOOK: type: DROPTABLE
+PREHOOK: query: CREATE TABLE blobstore_target (
+    key int
+) 
+#### A masked pattern was here ####
+PREHOOK: type: CREATETABLE
+PREHOOK: Input: ### test.blobstore.path ###/zero_rows_blobstore/blobstore_target
+PREHOOK: Output: database:default
+PREHOOK: Output: default@blobstore_target
+POSTHOOK: query: CREATE TABLE blobstore_target (
+    key int
+) 
+#### A masked pattern was here ####
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Input: ### test.blobstore.path ###/zero_rows_blobstore/blobstore_target
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@blobstore_target
+PREHOOK: query: SELECT COUNT(*) FROM blobstore_target
+PREHOOK: type: QUERY
+PREHOOK: Input: default@blobstore_target
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT COUNT(*) FROM blobstore_target
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@blobstore_target
+#### A masked pattern was here ####
+0
+PREHOOK: query: INSERT OVERWRITE TABLE blobstore_target SELECT key FROM blobstore_source
+PREHOOK: type: QUERY
+PREHOOK: Input: default@blobstore_source
+PREHOOK: Output: default@blobstore_target
+POSTHOOK: query: INSERT OVERWRITE TABLE blobstore_target SELECT key FROM blobstore_source
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@blobstore_source
+POSTHOOK: Output: default@blobstore_target
+PREHOOK: query: SELECT COUNT(*) FROM blobstore_target
+PREHOOK: type: QUERY
+PREHOOK: Input: default@blobstore_target
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT COUNT(*) FROM blobstore_target
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@blobstore_target
+#### A masked pattern was here ####
+100
+PREHOOK: query: INSERT OVERWRITE TABLE blobstore_target SELECT key FROM blobstore_source
WHERE FALSE
+PREHOOK: type: QUERY
+PREHOOK: Input: default@blobstore_source
+PREHOOK: Output: default@blobstore_target
+POSTHOOK: query: INSERT OVERWRITE TABLE blobstore_target SELECT key FROM blobstore_source
WHERE FALSE
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@blobstore_source
+POSTHOOK: Output: default@blobstore_target
+PREHOOK: query: SELECT COUNT(*) FROM blobstore_target
+PREHOOK: type: QUERY
+PREHOOK: Input: default@blobstore_target
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT COUNT(*) FROM blobstore_target
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@blobstore_target
+#### A masked pattern was here ####
+0

http://git-wip-us.apache.org/repos/asf/hive/blob/f13de0bf/itests/hive-blobstore/src/test/results/clientpositive/zero_rows_hdfs.q.out
----------------------------------------------------------------------
diff --git a/itests/hive-blobstore/src/test/results/clientpositive/zero_rows_hdfs.q.out b/itests/hive-blobstore/src/test/results/clientpositive/zero_rows_hdfs.q.out
new file mode 100644
index 0000000..92cf51f
--- /dev/null
+++ b/itests/hive-blobstore/src/test/results/clientpositive/zero_rows_hdfs.q.out
@@ -0,0 +1,89 @@
+PREHOOK: query: DROP TABLE blobstore_source
+PREHOOK: type: DROPTABLE
+POSTHOOK: query: DROP TABLE blobstore_source
+POSTHOOK: type: DROPTABLE
+PREHOOK: query: CREATE TABLE blobstore_source (
+    key int
+)
+#### A masked pattern was here ####
+PREHOOK: type: CREATETABLE
+PREHOOK: Input: ### test.blobstore.path ###/zero_rows_hdfs/blobstore_source
+PREHOOK: Output: database:default
+PREHOOK: Output: default@blobstore_source
+POSTHOOK: query: CREATE TABLE blobstore_source (
+    key int
+)
+#### A masked pattern was here ####
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Input: ### test.blobstore.path ###/zero_rows_hdfs/blobstore_source
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@blobstore_source
+PREHOOK: query: LOAD DATA LOCAL INPATH '../../data/files/kv6.txt' INTO TABLE blobstore_source
+PREHOOK: type: LOAD
+#### A masked pattern was here ####
+PREHOOK: Output: default@blobstore_source
+POSTHOOK: query: LOAD DATA LOCAL INPATH '../../data/files/kv6.txt' INTO TABLE blobstore_source
+POSTHOOK: type: LOAD
+#### A masked pattern was here ####
+POSTHOOK: Output: default@blobstore_source
+PREHOOK: query: DROP TABLE hdfs_target
+PREHOOK: type: DROPTABLE
+POSTHOOK: query: DROP TABLE hdfs_target
+POSTHOOK: type: DROPTABLE
+PREHOOK: query: CREATE TABLE hdfs_target (
+    key int
+)
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@hdfs_target
+POSTHOOK: query: CREATE TABLE hdfs_target (
+    key int
+)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@hdfs_target
+PREHOOK: query: SELECT COUNT(*) FROM hdfs_target
+PREHOOK: type: QUERY
+PREHOOK: Input: default@hdfs_target
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT COUNT(*) FROM hdfs_target
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@hdfs_target
+#### A masked pattern was here ####
+0
+PREHOOK: query: INSERT OVERWRITE TABLE hdfs_target SELECT key FROM blobstore_source
+PREHOOK: type: QUERY
+PREHOOK: Input: default@blobstore_source
+PREHOOK: Output: default@hdfs_target
+POSTHOOK: query: INSERT OVERWRITE TABLE hdfs_target SELECT key FROM blobstore_source
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@blobstore_source
+POSTHOOK: Output: default@hdfs_target
+POSTHOOK: Lineage: hdfs_target.key SIMPLE [(blobstore_source)blobstore_source.FieldSchema(name:key,
type:int, comment:null), ]
+PREHOOK: query: SELECT COUNT(*) FROM hdfs_target
+PREHOOK: type: QUERY
+PREHOOK: Input: default@hdfs_target
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT COUNT(*) FROM hdfs_target
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@hdfs_target
+#### A masked pattern was here ####
+100
+PREHOOK: query: INSERT OVERWRITE TABLE hdfs_target SELECT key FROM blobstore_source WHERE
FALSE
+PREHOOK: type: QUERY
+PREHOOK: Input: default@blobstore_source
+PREHOOK: Output: default@hdfs_target
+POSTHOOK: query: INSERT OVERWRITE TABLE hdfs_target SELECT key FROM blobstore_source WHERE
FALSE
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@blobstore_source
+POSTHOOK: Output: default@hdfs_target
+POSTHOOK: Lineage: hdfs_target.key SIMPLE [(blobstore_source)blobstore_source.FieldSchema(name:key,
type:int, comment:null), ]
+PREHOOK: query: SELECT COUNT(*) FROM hdfs_target
+PREHOOK: type: QUERY
+PREHOOK: Input: default@hdfs_target
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT COUNT(*) FROM hdfs_target
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@hdfs_target
+#### A masked pattern was here ####
+0

http://git-wip-us.apache.org/repos/asf/hive/blob/f13de0bf/ql/src/test/queries/clientpositive/zero_rows_single_insert.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/zero_rows_single_insert.q b/ql/src/test/queries/clientpositive/zero_rows_single_insert.q
new file mode 100644
index 0000000..eff4634
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/zero_rows_single_insert.q
@@ -0,0 +1,17 @@
+-- Insert overwrite into when WHERE clause returns zero rows
+DROP TABLE src_table;
+CREATE TABLE src_table (key int);
+LOAD DATA LOCAL INPATH '../../data/files/kv6.txt' INTO TABLE src_table;
+
+DROP TABLE target_table;
+CREATE TABLE target_table (key int);
+
+SELECT COUNT(*) FROM target_table;
+INSERT OVERWRITE TABLE target_table SELECT key FROM src_table;
+SELECT COUNT(*) FROM target_table;
+INSERT OVERWRITE TABLE target_table SELECT key FROM src_table WHERE FALSE;
+SELECT COUNT(*) FROM target_table;
+INSERT INTO TABLE target_table SELECT key FROM src_table;
+SELECT COUNT(*) FROM target_table;
+INSERT INTO TABLE target_table SELECT key FROM src_table WHERE FALSE;
+SELECT COUNT(*) FROM target_table;

http://git-wip-us.apache.org/repos/asf/hive/blob/f13de0bf/ql/src/test/results/clientpositive/zero_rows_single_insert.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/zero_rows_single_insert.q.out b/ql/src/test/results/clientpositive/zero_rows_single_insert.q.out
new file mode 100644
index 0000000..5ce86a7
--- /dev/null
+++ b/ql/src/test/results/clientpositive/zero_rows_single_insert.q.out
@@ -0,0 +1,113 @@
+PREHOOK: query: DROP TABLE src_table
+PREHOOK: type: DROPTABLE
+POSTHOOK: query: DROP TABLE src_table
+POSTHOOK: type: DROPTABLE
+PREHOOK: query: CREATE TABLE src_table (key int)
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@src_table
+POSTHOOK: query: CREATE TABLE src_table (key int)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@src_table
+PREHOOK: query: LOAD DATA LOCAL INPATH '../../data/files/kv6.txt' INTO TABLE src_table
+PREHOOK: type: LOAD
+#### A masked pattern was here ####
+PREHOOK: Output: default@src_table
+POSTHOOK: query: LOAD DATA LOCAL INPATH '../../data/files/kv6.txt' INTO TABLE src_table
+POSTHOOK: type: LOAD
+#### A masked pattern was here ####
+POSTHOOK: Output: default@src_table
+PREHOOK: query: DROP TABLE target_table
+PREHOOK: type: DROPTABLE
+POSTHOOK: query: DROP TABLE target_table
+POSTHOOK: type: DROPTABLE
+PREHOOK: query: CREATE TABLE target_table (key int)
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@target_table
+POSTHOOK: query: CREATE TABLE target_table (key int)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@target_table
+PREHOOK: query: SELECT COUNT(*) FROM target_table
+PREHOOK: type: QUERY
+PREHOOK: Input: default@target_table
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT COUNT(*) FROM target_table
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@target_table
+#### A masked pattern was here ####
+0
+PREHOOK: query: INSERT OVERWRITE TABLE target_table SELECT key FROM src_table
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src_table
+PREHOOK: Output: default@target_table
+POSTHOOK: query: INSERT OVERWRITE TABLE target_table SELECT key FROM src_table
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src_table
+POSTHOOK: Output: default@target_table
+POSTHOOK: Lineage: target_table.key SIMPLE [(src_table)src_table.FieldSchema(name:key, type:int,
comment:null), ]
+PREHOOK: query: SELECT COUNT(*) FROM target_table
+PREHOOK: type: QUERY
+PREHOOK: Input: default@target_table
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT COUNT(*) FROM target_table
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@target_table
+#### A masked pattern was here ####
+100
+PREHOOK: query: INSERT OVERWRITE TABLE target_table SELECT key FROM src_table WHERE FALSE
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src_table
+PREHOOK: Output: default@target_table
+POSTHOOK: query: INSERT OVERWRITE TABLE target_table SELECT key FROM src_table WHERE FALSE
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src_table
+POSTHOOK: Output: default@target_table
+POSTHOOK: Lineage: target_table.key SIMPLE [(src_table)src_table.FieldSchema(name:key, type:int,
comment:null), ]
+PREHOOK: query: SELECT COUNT(*) FROM target_table
+PREHOOK: type: QUERY
+PREHOOK: Input: default@target_table
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT COUNT(*) FROM target_table
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@target_table
+#### A masked pattern was here ####
+0
+PREHOOK: query: INSERT INTO TABLE target_table SELECT key FROM src_table
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src_table
+PREHOOK: Output: default@target_table
+POSTHOOK: query: INSERT INTO TABLE target_table SELECT key FROM src_table
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src_table
+POSTHOOK: Output: default@target_table
+POSTHOOK: Lineage: target_table.key SIMPLE [(src_table)src_table.FieldSchema(name:key, type:int,
comment:null), ]
+PREHOOK: query: SELECT COUNT(*) FROM target_table
+PREHOOK: type: QUERY
+PREHOOK: Input: default@target_table
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT COUNT(*) FROM target_table
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@target_table
+#### A masked pattern was here ####
+100
+PREHOOK: query: INSERT INTO TABLE target_table SELECT key FROM src_table WHERE FALSE
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src_table
+PREHOOK: Output: default@target_table
+POSTHOOK: query: INSERT INTO TABLE target_table SELECT key FROM src_table WHERE FALSE
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src_table
+POSTHOOK: Output: default@target_table
+POSTHOOK: Lineage: target_table.key SIMPLE [(src_table)src_table.FieldSchema(name:key, type:int,
comment:null), ]
+PREHOOK: query: SELECT COUNT(*) FROM target_table
+PREHOOK: type: QUERY
+PREHOOK: Input: default@target_table
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT COUNT(*) FROM target_table
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@target_table
+#### A masked pattern was here ####
+100


Mime
View raw message