hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [05/15] incubator-hawq git commit: HAWQ-784. Add tests to hawq register for data types and NULL check.
Date Mon, 18 Jul 2016 10:12:29 GMT
HAWQ-784. Add tests to hawq register for data types and NULL check.


Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/7a36744e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/7a36744e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/7a36744e

Branch: refs/heads/2.0.0.0-incubating
Commit: 7a36744eb1aee9c284b204c6d879a2bb9831a782
Parents: cf7793f
Author: Yancheng Luo <yluo@pivotal.io>
Authored: Tue Jun 7 18:09:44 2016 +0800
Committer: rlei <rlei@pivotal.io>
Committed: Mon Jul 18 18:06:07 2016 +0800

----------------------------------------------------------------------
 .../ManagementTool/test_hawq_register.cpp       |  39 +++++++++++++++++++
 .../test_hawq_register_data_types.paq           | Bin 0 -> 1232 bytes
 .../ManagementTool/test_hawq_register_null.paq  | Bin 0 -> 926 bytes
 3 files changed, 39 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/7a36744e/src/test/feature/ManagementTool/test_hawq_register.cpp
----------------------------------------------------------------------
diff --git a/src/test/feature/ManagementTool/test_hawq_register.cpp b/src/test/feature/ManagementTool/test_hawq_register.cpp
index 2efbd84..c802642 100644
--- a/src/test/feature/ManagementTool/test_hawq_register.cpp
+++ b/src/test/feature/ManagementTool/test_hawq_register.cpp
@@ -54,6 +54,45 @@ TEST_F(TestHawqRegister, TestSingleHiveFile) {
 	util.execute("drop table hawqregister;");
 }
 
+TEST_F(TestHawqRegister, TestDataTypes) {
+	SQLUtility util;
+	string rootPath(util.getTestRootPath());
+	/* This parquet file is generate by HIVE, using the table created by */
+	/* 'create table parquet(a boolean, b tinyint, c smallint, d int, e bigint, f date, g float,
h double, i string, j binary, k char(10), l varchar(10)) stored as parquet;' */
+	string relativePath("/ManagementTool/test_hawq_register_data_types.paq");
+	string filePath = rootPath + relativePath;
+
+	EXPECT_EQ(0, Command::getCommandStatus("hadoop fs -put " + filePath + " hdfs://localhost:8020/hawq_register_data_types.paq"));
+
+	util.execute("create table hawqregister(a bool, b int2, c int2, d int4, e int8, f date,
g float4, h float8, i varchar, j bytea, k char, l varchar) with (appendonly=true, orientation=parquet);");
+	util.query("select * from hawqregister;", 0);
+
+	EXPECT_EQ(0, Command::getCommandStatus("hawq register postgres hawqregister hdfs://localhost:8020/hawq_register_data_types.paq"));
+
+	util.query("select * from hawqregister;", 1);
+	util.execute("drop table hawqregister;");
+}
+
+TEST_F(TestHawqRegister, TestAllNULL) {
+	SQLUtility util;
+	string rootPath(util.getTestRootPath());
+	/* This parquet file is generate by HIVE, using the table created by */
+	/* 'create table parquet(a boolean, b tinyint, c smallint, d int, e bigint, f date, g float,
h double, i string, j binary, k char(10), l varchar(10)) stored as parquet;' */
+	/* with all the values set to NULL */
+	string relativePath("/ManagementTool/test_hawq_register_null.paq");
+	string filePath = rootPath + relativePath;
+
+	EXPECT_EQ(0, Command::getCommandStatus("hadoop fs -put " + filePath + " hdfs://localhost:8020/hawq_register_data_types.paq"));
+
+	util.execute("create table hawqregister(a bool, b int2, c int2, d int4, e int8, f date,
g float4, h float8, i varchar, j bytea, k char, l varchar) with (appendonly=true, orientation=parquet);");
+	util.query("select * from hawqregister;", 0);
+
+	EXPECT_EQ(0, Command::getCommandStatus("hawq register postgres hawqregister hdfs://localhost:8020/hawq_register_data_types.paq"));
+
+	util.query("select * from hawqregister;", 1);
+	util.execute("drop table hawqregister;");
+}
+
 TEST_F(TestHawqRegister, TestFiles) {
 	SQLUtility util;
 	string rootPath(util.getTestRootPath());

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/7a36744e/src/test/feature/ManagementTool/test_hawq_register_data_types.paq
----------------------------------------------------------------------
diff --git a/src/test/feature/ManagementTool/test_hawq_register_data_types.paq b/src/test/feature/ManagementTool/test_hawq_register_data_types.paq
new file mode 100644
index 0000000..88c3c6b
Binary files /dev/null and b/src/test/feature/ManagementTool/test_hawq_register_data_types.paq
differ

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/7a36744e/src/test/feature/ManagementTool/test_hawq_register_null.paq
----------------------------------------------------------------------
diff --git a/src/test/feature/ManagementTool/test_hawq_register_null.paq b/src/test/feature/ManagementTool/test_hawq_register_null.paq
new file mode 100644
index 0000000..44a8915
Binary files /dev/null and b/src/test/feature/ManagementTool/test_hawq_register_null.paq differ


Mime
View raw message