hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject incubator-hawq git commit: HAWQ-784. Add tests to hawq register for data types and NULL check.
Date Mon, 11 Jul 2016 05:04:24 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/master fadfb8aa8 -> e3ea4896b


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/e3ea4896
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/e3ea4896
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/e3ea4896

Branch: refs/heads/master
Commit: e3ea4896b0052f5d4fc3e52fc04cc5eccb4f4a8b
Parents: fadfb8a
Author: Yancheng Luo <yluo@pivotal.io>
Authored: Tue Jun 7 18:09:44 2016 +0800
Committer: xunzhang <xunzhangthu@gmail.com>
Committed: Mon Jul 11 11:20:21 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/e3ea4896/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/e3ea4896/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/e3ea4896/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