Repository: incubator-hawq Updated Branches: refs/heads/master 15323a501 -> 9c8b59e00
HAWQ-896. Add feature test for create table with new test framework Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/9c8b59e0 Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/9c8b59e0 Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/9c8b59e0 Branch: refs/heads/master Commit: 9c8b59e009d5b277e0b5ceaa86ef366f450df52b Parents: 15323a5 Author: YI JIN <[email protected]> Authored: Mon Jul 18 15:30:07 2016 +1000 Committer: YI JIN <[email protected]> Committed: Mon Jul 18 15:30:07 2016 +1000 ---------------------------------------------------------------------- src/test/feature/catalog/test_create_table.cpp | 159 +++++++++++++++++++ src/test/regress/expected/create_table_test.out | 112 ------------- src/test/regress/known_good_schedule | 1 - src/test/regress/sql/create_table_test.sql | 134 ---------------- 4 files changed, 159 insertions(+), 247 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/9c8b59e0/src/test/feature/catalog/test_create_table.cpp ---------------------------------------------------------------------- diff --git a/src/test/feature/catalog/test_create_table.cpp b/src/test/feature/catalog/test_create_table.cpp new file mode 100644 index 0000000..f72b2ec --- /dev/null +++ b/src/test/feature/catalog/test_create_table.cpp @@ -0,0 +1,159 @@ +#include <pwd.h> +#include <sys/types.h> +#include <unistd.h> +#include <vector> +#include <stdio.h> +#include <stdlib.h> +#include <errno.h> +#include <iostream> +#include <string> + +#include "lib/sql_util.h" + +#include "gtest/gtest.h" + +class TestCreateTable : public ::testing::Test { + public: + TestCreateTable() {} + ~TestCreateTable() {} +}; + + +TEST_F(TestCreateTable, TestCreateTable1) { + hawq::test::SQLUtility util; + // prepare + util.execute("DROP TABLE IF EXISTS aggtest"); + util.execute("DROP TABLE IF EXISTS tenk1"); + util.execute("DROP TABLE IF EXISTS slow_emp4000"); + util.execute("DROP TABLE IF EXISTS person"); + util.execute("DROP TABLE IF EXISTS onek"); + util.execute("DROP TABLE IF EXISTS emp"); + util.execute("DROP TABLE IF EXISTS student"); + util.execute("DROP TABLE IF EXISTS stud_emp"); + util.execute("DROP TABLE IF EXISTS real_city"); + util.execute("DROP TABLE IF EXISTS road"); + util.execute("DROP TABLE IF EXISTS hash_i4_heap"); + util.execute("DROP TABLE IF EXISTS hash_name_heap"); + util.execute("DROP TABLE IF EXISTS hash_txt_heap"); + util.execute("DROP TABLE IF EXISTS hash_f8_heap"); + util.execute("DROP TABLE IF EXISTS bt_i4_heap"); + util.execute("DROP TABLE IF EXISTS bt_name_heap"); + util.execute("DROP TABLE IF EXISTS bt_txt_heap"); + util.execute("DROP TABLE IF EXISTS bt_f8_heap"); + util.execute("DROP TABLE IF EXISTS array_op_test"); + util.execute("DROP TABLE IF EXISTS array_index_op_test"); + + // test + util.execute("CREATE TABLE aggtest (a int2, b float4)"); + + util.execute("CREATE TABLE tenk1 (unique1 int4," + "unique2 int4," + "two int4," + "four int4," + "ten int4," + "twenty int4," + "hundred int4," + "thousand int4," + "twothousand int4," + "fivethous int4," + "tenthous int4," + "odd int4," + "even int4," + "stringu1 name," + "stringu2 name," + "string4 name) WITH OIDS"); + + util.execute("CREATE TABLE slow_emp4000 (home_base box)"); + + util.execute("CREATE TABLE person (name text," + "age int4," + "location point)"); + + util.execute("CREATE TABLE onek (unique1 int4," + "unique2 int4," + "two int4," + "four int4," + "ten int4," + "twenty int4," + "hundred int4," + "thousand int4," + "twothousand int4," + "fivethous int4," + "tenthous int4," + "odd int4," + "even int4," + "stringu1 name," + "stringu2 name," + "string4 name)"); + + util.execute("CREATE TABLE emp (salary int4," + "manager name)" + " INHERITS (person) WITH OIDS"); + + util.execute("CREATE TABLE student (gpa float8) INHERITS (person)"); + + util.execute("CREATE TABLE stud_emp (percent int4) INHERITS (emp, student)"); + + util.execute("CREATE TABLE real_city (pop int4," + "cname text," + "outline path)"); + + util.execute("CREATE TABLE road (name text," + "thepath path)"); + + + util.execute("CREATE TABLE hash_i4_heap (seqno int4," + "random int4)"); + + util.execute("CREATE TABLE hash_name_heap (seqno int4," + "random name)"); + + util.execute("CREATE TABLE hash_txt_heap (seqno int4," + "random text)"); + + util.execute("CREATE TABLE hash_f8_heap (seqno int4," + "random float8)"); + + util.execute("CREATE TABLE bt_i4_heap (seqno int4," + "random int4)"); + + util.execute("CREATE TABLE bt_name_heap (seqno name," + "random int4)"); + + util.execute("CREATE TABLE bt_txt_heap (seqno text," + "random int4)"); + + util.execute("CREATE TABLE bt_f8_heap (seqno float8," + "random int4)"); + + util.execute("CREATE TABLE array_op_test (seqno int4," + "i int4[]," + "t text[])"); + + util.execute("CREATE TABLE array_index_op_test (seqno int4," + "i int4[]," + "t text[])"); + + // cleanup + util.execute("DROP TABLE array_index_op_test"); + util.execute("DROP TABLE array_op_test"); + util.execute("DROP TABLE bt_f8_heap"); + util.execute("DROP TABLE bt_txt_heap"); + util.execute("DROP TABLE bt_name_heap"); + util.execute("DROP TABLE bt_i4_heap"); + util.execute("DROP TABLE hash_f8_heap"); + util.execute("DROP TABLE hash_txt_heap"); + util.execute("DROP TABLE hash_name_heap"); + util.execute("DROP TABLE hash_i4_heap"); + util.execute("DROP TABLE road"); + util.execute("DROP TABLE real_city"); + util.execute("DROP TABLE stud_emp"); + util.execute("DROP TABLE student"); + util.execute("DROP TABLE emp"); + util.execute("DROP TABLE onek"); + util.execute("DROP TABLE person"); + util.execute("DROP TABLE slow_emp4000"); + util.execute("DROP TABLE tenk1"); + util.execute("DROP TABLE aggtest"); +} + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/9c8b59e0/src/test/regress/expected/create_table_test.out ---------------------------------------------------------------------- diff --git a/src/test/regress/expected/create_table_test.out b/src/test/regress/expected/create_table_test.out deleted file mode 100755 index d744410..0000000 --- a/src/test/regress/expected/create_table_test.out +++ /dev/null @@ -1,112 +0,0 @@ --- --- COPY --- -CREATE TABLE aggtest ( - a int2, - b float4 -); -CREATE TABLE tenk1 ( - unique1 int4, - unique2 int4, - two int4, - four int4, - ten int4, - twenty int4, - hundred int4, - thousand int4, - twothousand int4, - fivethous int4, - tenthous int4, - odd int4, - even int4, - stringu1 name, - stringu2 name, - string4 name -) WITH OIDS; -CREATE TABLE slow_emp4000 ( - home_base box -); -CREATE TABLE person ( - name text, - age int4, - location point -); -CREATE TABLE onek ( - unique1 int4, - unique2 int4, - two int4, - four int4, - ten int4, - twenty int4, - hundred int4, - thousand int4, - twothousand int4, - fivethous int4, - tenthous int4, - odd int4, - even int4, - stringu1 name, - stringu2 name, - string4 name -); -CREATE TABLE emp ( - salary int4, - manager name -) INHERITS (person) WITH OIDS; -CREATE TABLE student ( - gpa float8 -) INHERITS (person); -CREATE TABLE stud_emp ( - percent int4 -) INHERITS (emp, student); -CREATE TABLE real_city ( - pop int4, - cname text, - outline path -); -CREATE TABLE road ( - name text, - thepath path -); -CREATE TABLE hash_i4_heap ( - seqno int4, - random int4 -); -CREATE TABLE hash_name_heap ( - seqno int4, - random name -); -CREATE TABLE hash_txt_heap ( - seqno int4, - random text -); -CREATE TABLE hash_f8_heap ( - seqno int4, - random float8 -); -CREATE TABLE bt_i4_heap ( - seqno int4, - random int4 -); -CREATE TABLE bt_name_heap ( - seqno name, - random int4 -); -CREATE TABLE bt_txt_heap ( - seqno text, - random int4 -); -CREATE TABLE bt_f8_heap ( - seqno float8, - random int4 -); -CREATE TABLE array_op_test ( - seqno int4, - i int4[], - t text[] -); -CREATE TABLE array_index_op_test ( - seqno int4, - i int4[], - t text[] -); http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/9c8b59e0/src/test/regress/known_good_schedule ---------------------------------------------------------------------- diff --git a/src/test/regress/known_good_schedule b/src/test/regress/known_good_schedule index 71564b9..292573b 100755 --- a/src/test/regress/known_good_schedule +++ b/src/test/regress/known_good_schedule @@ -57,7 +57,6 @@ ignore: opr_sanity ignore: geometry ignore: horology ignore: create_type -test: create_table_test test: create_table_distribution ignore: create_function_2 test: copy http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/9c8b59e0/src/test/regress/sql/create_table_test.sql ---------------------------------------------------------------------- diff --git a/src/test/regress/sql/create_table_test.sql b/src/test/regress/sql/create_table_test.sql deleted file mode 100644 index 3c42b80..0000000 --- a/src/test/regress/sql/create_table_test.sql +++ /dev/null @@ -1,134 +0,0 @@ --- --- COPY --- - -CREATE TABLE aggtest ( - a int2, - b float4 -); - -CREATE TABLE tenk1 ( - unique1 int4, - unique2 int4, - two int4, - four int4, - ten int4, - twenty int4, - hundred int4, - thousand int4, - twothousand int4, - fivethous int4, - tenthous int4, - odd int4, - even int4, - stringu1 name, - stringu2 name, - string4 name -) WITH OIDS; - -CREATE TABLE slow_emp4000 ( - home_base box -); - -CREATE TABLE person ( - name text, - age int4, - location point -); - -CREATE TABLE onek ( - unique1 int4, - unique2 int4, - two int4, - four int4, - ten int4, - twenty int4, - hundred int4, - thousand int4, - twothousand int4, - fivethous int4, - tenthous int4, - odd int4, - even int4, - stringu1 name, - stringu2 name, - string4 name -); - -CREATE TABLE emp ( - salary int4, - manager name -) INHERITS (person) WITH OIDS; - - -CREATE TABLE student ( - gpa float8 -) INHERITS (person); - - -CREATE TABLE stud_emp ( - percent int4 -) INHERITS (emp, student); - -CREATE TABLE real_city ( - pop int4, - cname text, - outline path -); - -CREATE TABLE road ( - name text, - thepath path -); - -CREATE TABLE hash_i4_heap ( - seqno int4, - random int4 -); - -CREATE TABLE hash_name_heap ( - seqno int4, - random name -); - -CREATE TABLE hash_txt_heap ( - seqno int4, - random text -); - -CREATE TABLE hash_f8_heap ( - seqno int4, - random float8 -); - -CREATE TABLE bt_i4_heap ( - seqno int4, - random int4 -); - -CREATE TABLE bt_name_heap ( - seqno name, - random int4 -); - -CREATE TABLE bt_txt_heap ( - seqno text, - random int4 -); - -CREATE TABLE bt_f8_heap ( - seqno float8, - random int4 -); - -CREATE TABLE array_op_test ( - seqno int4, - i int4[], - t text[] -); - -CREATE TABLE array_index_op_test ( - seqno int4, - i int4[], - t text[] -);
