Repository: tajo Updated Branches: refs/heads/master b1d08f896 -> 52161f834
TAJO-1814: Add some positive/negative tests for CREATE TABLE IF NOT EXISTS. Closes #725 Project: http://git-wip-us.apache.org/repos/asf/tajo/repo Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/52161f83 Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/52161f83 Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/52161f83 Branch: refs/heads/master Commit: 52161f8347ac3c94e2526cfac710691b32d97ab9 Parents: b1d08f8 Author: Hyunsik Choi <[email protected]> Authored: Tue Sep 8 11:09:47 2015 +0900 Committer: Hyunsik Choi <[email protected]> Committed: Tue Sep 8 11:09:47 2015 +0900 ---------------------------------------------------------------------- .../org/apache/tajo/engine/query/TestCreateTable.java | 6 +++++- .../negative/create_table_on_already_exist_tables.sql | 3 +++ .../positive/create_table_if_not_exists.sql | 11 +++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tajo/blob/52161f83/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestCreateTable.java ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestCreateTable.java b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestCreateTable.java index b7e0a48..ed1026e 100644 --- a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestCreateTable.java +++ b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestCreateTable.java @@ -35,10 +35,14 @@ import java.util.List; import static org.junit.Assert.*; -@Category(IntegrationTest.class) public class TestCreateTable extends QueryTestCaseBase { @Test + public final void testPositives() throws Exception { + runPositiveTests(); + } + + @Test public final void testNegatives() throws Exception { runNegativeTests(); } http://git-wip-us.apache.org/repos/asf/tajo/blob/52161f83/tajo-core-tests/src/test/resources/queries/TestCreateTable/negative/create_table_on_already_exist_tables.sql ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/queries/TestCreateTable/negative/create_table_on_already_exist_tables.sql b/tajo-core-tests/src/test/resources/queries/TestCreateTable/negative/create_table_on_already_exist_tables.sql new file mode 100644 index 0000000..38bfd3e --- /dev/null +++ b/tajo-core-tests/src/test/resources/queries/TestCreateTable/negative/create_table_on_already_exist_tables.sql @@ -0,0 +1,3 @@ +CREATE TABLE default.LINEITEM (XXX TEXT); +CREATE TABLE default.LINEITEM AS SELECT 1; +CREATE TABLE default.LINEITEM AS SELECT * FROM default.LINEITEM; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/52161f83/tajo-core-tests/src/test/resources/queries/TestCreateTable/positive/create_table_if_not_exists.sql ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/queries/TestCreateTable/positive/create_table_if_not_exists.sql b/tajo-core-tests/src/test/resources/queries/TestCreateTable/positive/create_table_if_not_exists.sql new file mode 100644 index 0000000..cde8a12 --- /dev/null +++ b/tajo-core-tests/src/test/resources/queries/TestCreateTable/positive/create_table_if_not_exists.sql @@ -0,0 +1,11 @@ +-- Against external table +CREATE TABLE IF NOT EXISTS default.LINEITEM (XXX TEXT); +CREATE TABLE IF NOT EXISTS default.LINEITEM AS SELECT 1; +CREATE TABLE IF NOT EXISTS default.LINEITEM AS SELECT * FROM default.LINEITEM; + +-- Against managed table +CREATE TABLE T1 (NUM BIGINT); +CREATE TABLE IF NOT EXISTS T1 (XXX TEXT); +CREATE TABLE IF NOT EXISTS T1 AS SELECT 1; +CREATE TABLE IF NOT EXISTS T1 AS SELECT L_ORDERKEY FROM default.LINEITEM; +DROP TABLE T1; \ No newline at end of file
