Repository: incubator-hawq
Updated Branches:
  refs/heads/master 52fb7ab5a -> 83adc06ab


HAWQ-899. Add feature test for nested null case 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/83adc06a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/83adc06a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/83adc06a

Branch: refs/heads/master
Commit: 83adc06abe5055a3edecf082d48b75a64659b87e
Parents: 52fb7ab
Author: YI JIN <[email protected]>
Authored: Tue Aug 2 10:37:29 2016 +1000
Committer: YI JIN <[email protected]>
Committed: Tue Aug 2 10:37:29 2016 +1000

----------------------------------------------------------------------
 .../feature/query/test_nested_case_null.cpp     | 37 ++++++++++++++++++++
 src/test/regress/expected/nested_case_null.out  | 25 -------------
 src/test/regress/known_good_schedule            |  1 -
 src/test/regress/sql/nested_case_null.sql       | 24 -------------
 4 files changed, 37 insertions(+), 50 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/83adc06a/src/test/feature/query/test_nested_case_null.cpp
----------------------------------------------------------------------
diff --git a/src/test/feature/query/test_nested_case_null.cpp 
b/src/test/feature/query/test_nested_case_null.cpp
new file mode 100644
index 0000000..3d5894f
--- /dev/null
+++ b/src/test/feature/query/test_nested_case_null.cpp
@@ -0,0 +1,37 @@
+#include <pwd.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <vector>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <iostream>
+
+#include "lib/command.h"
+#include "lib/data_gen.h"
+#include "lib/hawq_config.h"
+#include "lib/sql_util.h"
+
+#include "gtest/gtest.h"
+
+class TestQueryNestedCaseNull : public ::testing::Test {
+ public:
+  TestQueryNestedCaseNull() {}
+  ~TestQueryNestedCaseNull() {}
+};
+
+TEST_F(TestQueryNestedCaseNull, Test1) {
+  hawq::test::SQLUtility util;
+
+  // prepare
+  util.execute("DROP TABLE IF EXISTS t CASCADE");
+
+  // test
+  util.execute("CREATE TABLE t(pid INT, wid INT, state CHARACTER 
VARYING(30))");
+  util.execute("INSERT INTO t VALUES(1,1)");
+  util.query("SELECT DECODE(DECODE(state, '', NULL, state), '-', NULL, state) 
AS state FROM t",
+             "|\n");
+
+  // cleanup
+  util.execute("DROP TABLE t");
+}

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/83adc06a/src/test/regress/expected/nested_case_null.out
----------------------------------------------------------------------
diff --git a/src/test/regress/expected/nested_case_null.out 
b/src/test/regress/expected/nested_case_null.out
deleted file mode 100644
index 2374549..0000000
--- a/src/test/regress/expected/nested_case_null.out
+++ /dev/null
@@ -1,25 +0,0 @@
----
---- Drop existing table
----
-DROP TABLE IF EXISTS t;
----
---- Create new table t
----
-CREATE TABLE t(pid INT, wid INT, state CHARACTER VARYING(30));
----
---- Insert a row and keep state as empty
----
-INSERT INTO t VALUES(1, 1);
----
---- use nested decode
----
-SELECT DECODE(DECODE(state, '', NULL, state), '-', NULL, state) AS state FROM 
t;
- state 
--------
- 
-(1 row)
-
----
---- Drop table
----
-DROP TABLE t;

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/83adc06a/src/test/regress/known_good_schedule
----------------------------------------------------------------------
diff --git a/src/test/regress/known_good_schedule 
b/src/test/regress/known_good_schedule
index 8c9091f..51c1a6d 100755
--- a/src/test/regress/known_good_schedule
+++ b/src/test/regress/known_good_schedule
@@ -52,7 +52,6 @@ ignore: create_misc
 test: create_aggregate
 test: aggregate_with_groupingsets
 test: aggregates_null
-test: nested_case_null
 ignore: create_operator
 ignore: create_index
 ignore: drop_if_exists

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/83adc06a/src/test/regress/sql/nested_case_null.sql
----------------------------------------------------------------------
diff --git a/src/test/regress/sql/nested_case_null.sql 
b/src/test/regress/sql/nested_case_null.sql
deleted file mode 100644
index e3f1d24..0000000
--- a/src/test/regress/sql/nested_case_null.sql
+++ /dev/null
@@ -1,24 +0,0 @@
----
---- Drop existing table
----
-DROP TABLE IF EXISTS t;
-
----
---- Create new table t
----
-CREATE TABLE t(pid INT, wid INT, state CHARACTER VARYING(30));
-
----
---- Insert a row and keep state as empty
----
-INSERT INTO t VALUES(1, 1);
-
----
---- use nested decode
----
-SELECT DECODE(DECODE(state, '', NULL, state), '-', NULL, state) AS state FROM 
t;
-
----
---- Drop table
----
-DROP TABLE t;
\ No newline at end of file

Reply via email to