You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tajo.apache.org by hy...@apache.org on 2014/01/07 03:23:18 UTC

[1/5] TAJO-476: Add a test development kit for unit tests based on executions of queries.

Updated Branches:
  refs/heads/master f825dcebc -> eaf0a5854


http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testSelect3.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testSelect3.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testSelect3.result
new file mode 100644
index 0000000..1530637
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testSelect3.result
@@ -0,0 +1,7 @@
+plus
+-------------------------------
+2
+2
+4
+5
+6
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testSelectAsterik.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testSelectAsterik.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testSelectAsterik.result
new file mode 100644
index 0000000..ec6b911
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testSelectAsterik.result
@@ -0,0 +1,7 @@
+l_orderkey,l_partkey,l_suppkey,l_linenumber,l_quantity,l_extendedprice,l_discount,l_tax,l_returnflag,l_linestatus,l_shipdate,l_commitdate,l_receiptdate,l_shipinstruct,l_shipmode,l_comment
+-------------------------------
+1,1,7706,1,17.0,21168.23,0.04,0.02,N,O,1996-03-13,1996-02-12,1996-03-22,DELIVER IN PERSON,TRUCK,egular courts above the
+1,1,7311,2,36.0,45983.16,0.09,0.06,N,O,1996-04-12,1996-02-28,1996-04-20,TAKE BACK RETURN,MAIL,ly final dependencies: slyly bold 
+2,2,1191,1,38.0,44694.46,0.0,0.05,N,O,1997-01-28,1997-01-14,1997-02-02,TAKE BACK RETURN,RAIL,ven requests. deposits breach a
+3,2,1798,1,45.0,54058.05,0.06,0.0,R,F,1994-02-02,1994-01-04,1994-02-23,NONE,AIR,ongside of the furiously brave acco
+3,3,6540,2,49.0,46796.47,0.1,0.0,R,F,1993-11-09,1993-12-20,1993-11-24,TAKE BACK RETURN,RAIL, unusual accounts. eve
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testSelectDistinct.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testSelectDistinct.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testSelectDistinct.result
new file mode 100644
index 0000000..75e7d72
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testSelectDistinct.result
@@ -0,0 +1,7 @@
+l_orderkey,l_linenumber
+-------------------------------
+1,1
+1,2
+2,1
+3,1
+3,2
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testStringCompare.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testStringCompare.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testStringCompare.result
new file mode 100644
index 0000000..040ac19
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testStringCompare.result
@@ -0,0 +1,5 @@
+l_orderkey
+-------------------------------
+1
+3
+3
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testUnion1.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testUnion1.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testUnion1.result
new file mode 100644
index 0000000..3b4dcf4
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testUnion1.result
@@ -0,0 +1,10 @@
+num
+-------------------------------
+1
+2
+3
+4
+5
+36901
+78002
+123314
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testUnion2.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testUnion2.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testUnion2.result
new file mode 100644
index 0000000..d269baa
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testUnion2.result
@@ -0,0 +1,12 @@
+l_orderkey
+-------------------------------
+1
+1
+1
+1
+2
+2
+3
+3
+3
+3
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testWhereCond1.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testWhereCond1.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testWhereCond1.result
new file mode 100644
index 0000000..ecbb913
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testWhereCond1.result
@@ -0,0 +1,3 @@
+plus
+-------------------------------
+4
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testWhereCondWithAlias1.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testWhereCondWithAlias1.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testWhereCondWithAlias1.result
new file mode 100644
index 0000000..058546f
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testWhereCondWithAlias1.result
@@ -0,0 +1,4 @@
+orderkey,l_partkey
+-------------------------------
+1,1
+1,1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testWhereCondWithAlias2.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testWhereCondWithAlias2.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testWhereCondWithAlias2.result
new file mode 100644
index 0000000..74ccd20
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testWhereCondWithAlias2.result
@@ -0,0 +1,4 @@
+orderkey
+-------------------------------
+1
+1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestSortQuery/testSort.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestSortQuery/testSort.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestSortQuery/testSort.result
new file mode 100644
index 0000000..a5e9af3
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestSortQuery/testSort.result
@@ -0,0 +1,7 @@
+l_linenumber,l_orderkey
+-------------------------------
+1,1
+2,1
+1,2
+1,3
+2,3
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestSortQuery/testSortAfterGroupby.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestSortQuery/testSortAfterGroupby.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestSortQuery/testSortAfterGroupby.result
new file mode 100644
index 0000000..bf94765
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestSortQuery/testSortAfterGroupby.result
@@ -0,0 +1,5 @@
+?max,l_orderkey
+-------------------------------
+36.0,1
+38.0,2
+49.0,3
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestSortQuery/testSortAfterGroupbyWithAlias.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestSortQuery/testSortAfterGroupbyWithAlias.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestSortQuery/testSortAfterGroupbyWithAlias.result
new file mode 100644
index 0000000..bc0bf1b
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestSortQuery/testSortAfterGroupbyWithAlias.result
@@ -0,0 +1,5 @@
+max_quantity,l_orderkey
+-------------------------------
+36.0,1
+38.0,2
+49.0,3
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestSortQuery/testSortDesc.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestSortQuery/testSortDesc.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestSortQuery/testSortDesc.result
new file mode 100644
index 0000000..6450adf
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestSortQuery/testSortDesc.result
@@ -0,0 +1,7 @@
+l_linenumber,l_orderkey
+-------------------------------
+1,3
+2,3
+1,2
+1,1
+2,1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestSortQuery/testSortWithAliasButOriginalName.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestSortQuery/testSortWithAliasButOriginalName.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestSortQuery/testSortWithAliasButOriginalName.result
new file mode 100644
index 0000000..81bb293
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestSortQuery/testSortWithAliasButOriginalName.result
@@ -0,0 +1,7 @@
+l_linenumber,sortkey
+-------------------------------
+1,1
+2,1
+1,2
+1,3
+2,3
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestSortQuery/testSortWithAliasKey.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestSortQuery/testSortWithAliasKey.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestSortQuery/testSortWithAliasKey.result
new file mode 100644
index 0000000..81bb293
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestSortQuery/testSortWithAliasKey.result
@@ -0,0 +1,7 @@
+l_linenumber,sortkey
+-------------------------------
+1,1
+2,1
+1,2
+1,3
+2,3
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestSortQuery/testTopK.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestSortQuery/testTopK.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestSortQuery/testTopK.result
new file mode 100644
index 0000000..df40678
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestSortQuery/testTopK.result
@@ -0,0 +1,5 @@
+l_orderkey,l_linenumber
+-------------------------------
+3,1
+3,2
+2,1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestTPCH/testQ1OrderBy.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestTPCH/testQ1OrderBy.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestTPCH/testQ1OrderBy.result
new file mode 100644
index 0000000..94b5e84
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestTPCH/testQ1OrderBy.result
@@ -0,0 +1,4 @@
+l_returnflag,l_linestatus,count_order
+-------------------------------
+N,O,3
+R,F,2
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestTPCH/testQ2FourJoins.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestTPCH/testQ2FourJoins.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestTPCH/testQ2FourJoins.result
new file mode 100644
index 0000000..7c81978
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestTPCH/testQ2FourJoins.result
@@ -0,0 +1,3 @@
+s_acctbal,s_name,n_name,p_partkey,p_mfgr,s_address,s_phone,s_comment,ps_supplycost,r_name,p_type,p_size
+-------------------------------
+4192.4,Supplier#000000003,ARGENTINA,2,Manufacturer#1,q1,G3Pj6OjIuUYfUoH18BFTKP5aU9bEV3,11-383-516-1199,blithely silent requests after the express dependencies are sl,1.01,AMERICA,LARGE BRUSHED BRASS,15
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestTPCH/testTPCH14Expr.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestTPCH/testTPCH14Expr.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestTPCH/testTPCH14Expr.result
new file mode 100644
index 0000000..6bc69cc
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestTPCH/testTPCH14Expr.result
@@ -0,0 +1,3 @@
+promo_revenue
+-------------------------------
+33.610645634855025
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestTableSubQuery/testGroupBySubQuery.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestTableSubQuery/testGroupBySubQuery.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestTableSubQuery/testGroupBySubQuery.result
new file mode 100644
index 0000000..628924b
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestTableSubQuery/testGroupBySubQuery.result
@@ -0,0 +1,3 @@
+revenue
+-------------------------------
+12908.3436
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestTableSubQuery/testJoinSubQuery.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestTableSubQuery/testJoinSubQuery.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestTableSubQuery/testJoinSubQuery.result
new file mode 100644
index 0000000..0c0acd3
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestTableSubQuery/testJoinSubQuery.result
@@ -0,0 +1,4 @@
+n_regionkey,r_regionkey,n_name,r_name
+-------------------------------
+0,0,ALGERIA,AFRICA
+1,1,ARGENTINA,AMERICA
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestTableSubQuery/testJoinSubQuery2.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestTableSubQuery/testJoinSubQuery2.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestTableSubQuery/testJoinSubQuery2.result
new file mode 100644
index 0000000..0c0acd3
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestTableSubQuery/testJoinSubQuery2.result
@@ -0,0 +1,4 @@
+n_regionkey,r_regionkey,n_name,r_name
+-------------------------------
+0,0,ALGERIA,AFRICA
+1,1,ARGENTINA,AMERICA
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestTableSubQuery/testTableSubquery1.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestTableSubQuery/testTableSubquery1.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestTableSubQuery/testTableSubquery1.result
new file mode 100644
index 0000000..337de32
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestTableSubQuery/testTableSubquery1.result
@@ -0,0 +1,7 @@
+l_orderkey
+-------------------------------
+1
+1
+2
+3
+3
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/testBuildDDL.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/testBuildDDL.result b/tajo-core/tajo-core-backend/src/test/resources/results/testBuildDDL.result
new file mode 100644
index 0000000..4fd87c2
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/testBuildDDL.result
@@ -0,0 +1,5 @@
+--
+-- Name: table1; Type: TABLE; Storage: CSV
+-- Path: /table1
+--
+CREATE EXTERNAL TABLE table1 (name BLOB, addr TEXT) USING CSV WITH ('csv.delimiter'='|', 'compression.codec'='org.apache.hadoop.io.compress.GzipCodec') LOCATION '/table1';
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/results/testBuildDDL.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/results/testBuildDDL.result b/tajo-core/tajo-core-backend/src/test/results/testBuildDDL.result
deleted file mode 100644
index 4fd87c2..0000000
--- a/tajo-core/tajo-core-backend/src/test/results/testBuildDDL.result
+++ /dev/null
@@ -1,5 +0,0 @@
---
--- Name: table1; Type: TABLE; Storage: CSV
--- Path: /table1
---
-CREATE EXTERNAL TABLE table1 (name BLOB, addr TEXT) USING CSV WITH ('csv.delimiter'='|', 'compression.codec'='org.apache.hadoop.io.compress.GzipCodec') LOCATION '/table1';
\ No newline at end of file


[2/5] TAJO-476: Add a test development kit for unit tests based on executions of queries.

Posted by hy...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/complex_union_2.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/complex_union_2.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/complex_union_2.sql
new file mode 100644
index 0000000..d54ed27
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/complex_union_2.sql
@@ -0,0 +1,35 @@
+SELECT *
+FROM
+(
+    SELECT
+        l_orderkey,
+        l_partkey,
+        url
+    FROM
+        (
+          SELECT
+            l_orderkey,
+            l_partkey,
+            CASE
+              WHEN
+                l_partkey IS NOT NULL THEN ''
+              WHEN l_orderkey = 1 THEN '1'
+            ELSE
+              '2'
+            END AS url
+          FROM
+            lineitem
+        ) res1
+        JOIN
+        (
+          SELECT
+            *
+          FROM
+            part
+        ) res2
+        ON l_partkey = p_partkey
+) result
+
+
+
+

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_partitioned_table_as_select.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_partitioned_table_as_select.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_partitioned_table_as_select.sql
new file mode 100644
index 0000000..09b14eb
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_partitioned_table_as_select.sql
@@ -0,0 +1,6 @@
+CREATE TABLE sales ( col1 int, col2 int)
+PARTITION BY COLUMN (col3 int, col4 float, col5 text)
+AS SELECT col1, col2, col3, col4, col5 FROM sales_src
+   WHERE col1 > 16
+
+

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_1.hiveql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_1.hiveql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_1.hiveql
new file mode 100644
index 0000000..c4dcc74
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_1.hiveql
@@ -0,0 +1 @@
+create table name (name string, age int)

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_1.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_1.sql
new file mode 100644
index 0000000..8875b0e
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_1.sql
@@ -0,0 +1 @@
+create table name (name text, age int)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_10.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_10.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_10.sql
new file mode 100644
index 0000000..43314fa
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_10.sql
@@ -0,0 +1 @@
+create external table table1 (name text, age int, earn bigint, score float) using csv location '/tmp/data'
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_11.hiveql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_11.hiveql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_11.hiveql
new file mode 100644
index 0000000..014bcbe
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_11.hiveql
@@ -0,0 +1,3 @@
+create external table table1 (name string, age int)
+STORED as rcfile
+location '/user/hive/table1'
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_11.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_11.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_11.sql
new file mode 100644
index 0000000..d6ca3ae
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_11.sql
@@ -0,0 +1,3 @@
+create external table table1 (name text, age int)
+using rcfile
+location '/user/hive/table1'
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_12.hiveql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_12.hiveql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_12.hiveql
new file mode 100644
index 0000000..e74d3e3
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_12.hiveql
@@ -0,0 +1,4 @@
+create external table table1  (name string, age int)
+ROW FORMAT DELIMITED FIELDS TERMINATED BY '|'
+STORED as  textfile
+location '/user/hive/table1'
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_12.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_12.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_12.sql
new file mode 100644
index 0000000..0816084
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_12.sql
@@ -0,0 +1,3 @@
+create external table table1 (name text, age int)
+USING csv WITH ('csvfile.delimiter'='|')
+location '/user/hive/table1'
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_2.hiveql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_2.hiveql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_2.hiveql
new file mode 100644
index 0000000..a5cf55d
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_2.hiveql
@@ -0,0 +1 @@
+create table name (name string, age int) STORED as  rcfile
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_2.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_2.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_2.sql
new file mode 100644
index 0000000..4580e82
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_2.sql
@@ -0,0 +1 @@
+create table name (name text, age int) using rcfile
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_3.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_3.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_3.sql
new file mode 100644
index 0000000..5ab2af2
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_3.sql
@@ -0,0 +1 @@
+create table name (name text, age int) using rcfile with ('rcfile.buffer'=4096)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_4.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_4.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_4.sql
new file mode 100644
index 0000000..fe4d580
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_4.sql
@@ -0,0 +1 @@
+create table name as select * from test
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_5.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_5.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_5.sql
new file mode 100644
index 0000000..b22b841
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_5.sql
@@ -0,0 +1 @@
+create table name (name text, age int) as select * from test
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_6.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_6.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_6.sql
new file mode 100644
index 0000000..27e06f2
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_6.sql
@@ -0,0 +1 @@
+create table name (name text, age int) using rcfile as select * from test
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_7.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_7.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_7.sql
new file mode 100644
index 0000000..5c9bf35
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_7.sql
@@ -0,0 +1 @@
+create table name (name text, age int) using rcfile with ('rcfile.buffer'= 4096) as select * from test
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_8.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_8.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_8.sql
new file mode 100644
index 0000000..d6c2ae6
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_8.sql
@@ -0,0 +1,48 @@
+create table widetable (
+  col0 bit,
+  col1 BIT(10),
+  col2 bit varying,
+  col3 bit VARYING(10),
+  col4 tinyint,
+  col5 smallInt,
+  col6 integer,
+  col7 biginT,
+  col8 real,
+  col9 float,
+  col10 float(53),
+  col11 double,
+  col12 doublE precision,
+  col13 numeric,
+  col14 numeric(10),
+  col15 numeric(10,2),
+  col16 decimal,
+  col17 decimal(10),
+  col18 decimal(10,2),
+  col19 char,
+  col20 character,
+  col21 chaR(10),
+  col22 character(10),
+  col23 varchar,
+  col24 character varying,
+  col25 varchar(255),
+  col26 character varying (255),
+  col27 nchar,
+  col28 nchar(255),
+  col29 national character,
+  col30 national character(255),
+  col31 nvarchar,
+  col32 nvarchar(255),
+  col33 natIonal character varying,
+  col34 national character varying (255),
+  col35 date,
+  col36 time,
+  col37 timetz,
+  col38 time With time zone,
+  col39 timesTamptz,
+  col40 timestamp with time zone,
+  col41 binary,
+  col42 binary(10),
+  col43 varbinary(10),
+  col44 binary Varying(10),
+  col45 blOb
+) as select * from test
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_9.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_9.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_9.sql
new file mode 100644
index 0000000..49e1e3c
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_9.sql
@@ -0,0 +1 @@
+create table widetable (col1 float(10), col2 float) as select * from test
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_partition_by_column.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_partition_by_column.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_partition_by_column.sql
new file mode 100644
index 0000000..397e7ac
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_partition_by_column.sql
@@ -0,0 +1,4 @@
+CREATE TABLE sales ( col1 int, col2 int)
+PARTITION BY COLUMN (col3 int, col4 float, col5 text);
+
+

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_partition_by_hash_1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_partition_by_hash_1.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_partition_by_hash_1.sql
new file mode 100644
index 0000000..f13225a
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_partition_by_hash_1.sql
@@ -0,0 +1,3 @@
+CREATE TABLE sales ( col1 int, col2 int)
+PARTITION BY HASH (col1)
+PARTITIONS 2;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_partition_by_hash_2.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_partition_by_hash_2.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_partition_by_hash_2.sql
new file mode 100644
index 0000000..c8fe3c5
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_partition_by_hash_2.sql
@@ -0,0 +1,7 @@
+CREATE TABLE sales ( col1 int, col2 int)
+PARTITION BY HASH (col1)
+(
+  PARTITION part1,
+  PARTITION part2,
+  PARTITION part3
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_partition_by_list.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_partition_by_list.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_partition_by_list.sql
new file mode 100644
index 0000000..9461e01
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_partition_by_list.sql
@@ -0,0 +1,8 @@
+CREATE TABLE sales ( col1 int, col2 int)
+PARTITION BY LIST (col1)
+ (
+  PARTITION col1 VALUES ('Seoul', '서울'),
+  PARTITION col2 VALUES ('Busan', '부산')
+ );
+
+

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_partition_by_range.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_partition_by_range.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_partition_by_range.sql
new file mode 100644
index 0000000..65c4fdd
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/create_table_partition_by_range.sql
@@ -0,0 +1,9 @@
+CREATE TABLE sales ( col1 int, col2 int)
+PARTITION BY RANGE (col1)
+ (
+  PARTITION col1 VALUES LESS THAN (2),
+  PARTITION col1 VALUES LESS THAN (5),
+  PARTITION col1 VALUES LESS THAN (MAXVALUE)
+ );
+
+

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/drop_table.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/drop_table.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/drop_table.sql
new file mode 100644
index 0000000..0e52112
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/drop_table.sql
@@ -0,0 +1 @@
+drop table abc
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/exists_predicate_1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/exists_predicate_1.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/exists_predicate_1.sql
new file mode 100644
index 0000000..0b10799
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/exists_predicate_1.sql
@@ -0,0 +1 @@
+select c1,c2,c3 from table1 where exists (select c4 from table2 where c4 = table1.c1);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/exists_predicate_2.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/exists_predicate_2.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/exists_predicate_2.sql
new file mode 100644
index 0000000..f4f82f9
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/exists_predicate_2.sql
@@ -0,0 +1 @@
+select c1,c2,c3 from table1 where not exists (select c4 from table2 where c4 = table1.c1);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/groupby_1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/groupby_1.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/groupby_1.sql
new file mode 100644
index 0000000..85dbe21
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/groupby_1.sql
@@ -0,0 +1 @@
+select col0, col1, col2, col3, sum(col4) as total, avg(col5) from base group by col0, cube (col1, col2), rollup(col3) having total > 100
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/in_subquery_1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/in_subquery_1.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/in_subquery_1.sql
new file mode 100644
index 0000000..2a16a8d
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/in_subquery_1.sql
@@ -0,0 +1 @@
+select c1,c2,c3 from table1 where c1 in (select c4 from table2);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/in_subquery_2.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/in_subquery_2.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/in_subquery_2.sql
new file mode 100644
index 0000000..64c8034
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/in_subquery_2.sql
@@ -0,0 +1 @@
+select c1,c2,c3 from table1 where c1 not in (select c4 from table2);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/insert_into_select_1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/insert_into_select_1.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/insert_into_select_1.sql
new file mode 100644
index 0000000..d3291f5
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/insert_into_select_1.sql
@@ -0,0 +1 @@
+insert into table1 select col1, col2, sum(col3) from table2 group by col1, col2

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/insert_into_select_2.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/insert_into_select_2.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/insert_into_select_2.sql
new file mode 100644
index 0000000..2928b11
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/insert_into_select_2.sql
@@ -0,0 +1 @@
+insert into location 'file:/tmp/data' select col1, col2, sum(col3) from table2 group by col1, col2

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/insert_into_select_3.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/insert_into_select_3.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/insert_into_select_3.sql
new file mode 100644
index 0000000..b7718dc
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/insert_into_select_3.sql
@@ -0,0 +1 @@
+insert into table1 (col1, col2, col3) select col1, col2, sum(col3) as total from table2 group by col1, col2

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/insert_overwrite_into_select_1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/insert_overwrite_into_select_1.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/insert_overwrite_into_select_1.sql
new file mode 100644
index 0000000..84992bc
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/insert_overwrite_into_select_1.sql
@@ -0,0 +1 @@
+insert overwrite into table1 select col1, col2, sum(col3) from table2 group by col1, col2

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/insert_overwrite_into_select_2.hiveql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/insert_overwrite_into_select_2.hiveql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/insert_overwrite_into_select_2.hiveql
new file mode 100644
index 0000000..b99863e
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/insert_overwrite_into_select_2.hiveql
@@ -0,0 +1 @@
+INSERT OVERWRITE DIRECTORY  'file:/tmp/data' select col1, col2, sum(col3) from table2 group by col1, col2

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/insert_overwrite_into_select_2.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/insert_overwrite_into_select_2.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/insert_overwrite_into_select_2.sql
new file mode 100644
index 0000000..1c4227b
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/insert_overwrite_into_select_2.sql
@@ -0,0 +1 @@
+insert overwrite into location 'file:/tmp/data' select col1, col2, sum(col3) from table2 group by col1, col2

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/insert_overwrite_into_select_3.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/insert_overwrite_into_select_3.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/insert_overwrite_into_select_3.sql
new file mode 100644
index 0000000..bfacc01
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/insert_overwrite_into_select_3.sql
@@ -0,0 +1 @@
+insert overwrite into table1 (col1, col2, col3) select col1, col2, sum(col3) as total from table2 group by col1, col2

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_1.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_1.sql
new file mode 100644
index 0000000..ad27795
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_1.sql
@@ -0,0 +1 @@
+select name, addr from people natural join student natural join professor
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_10.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_10.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_10.sql
new file mode 100644
index 0000000..c9056cc
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_10.sql
@@ -0,0 +1 @@
+select * from a cross join b, c, d, e
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_11.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_11.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_11.sql
new file mode 100644
index 0000000..25daeb0
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_11.sql
@@ -0,0 +1 @@
+select * from x, y, (select * from a, b, c WHERE something) as ss where somethingelse
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_12.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_12.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_12.sql
new file mode 100644
index 0000000..02a0b8e
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_12.sql
@@ -0,0 +1 @@
+select name, addr from people join student join professor
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_13.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_13.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_13.sql
new file mode 100644
index 0000000..9c56bc0
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_13.sql
@@ -0,0 +1,13 @@
+select * 
+from table1 
+cross join table2 
+join table3 on table1.id = table3.id 
+inner join table4 on table1.id = table4.id 
+left outer join table5 on table1.id = table5.id 
+right outer join table6 on table1.id = table6.id 
+full outer join table7 on table1.id = table7.id 
+join table8 
+inner join table9 
+left outer join table10 
+right outer join table11 
+full outer join table12
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_14.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_14.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_14.sql
new file mode 100644
index 0000000..21c7099
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_14.sql
@@ -0,0 +1 @@
+select * from a cross join b cross join c cross join d cross join e
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_15.hiveql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_15.hiveql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_15.hiveql
new file mode 100644
index 0000000..28e9a02
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_15.hiveql
@@ -0,0 +1 @@
+select  * from x join y join (select * from a join b  on a.age = b.age join c on a.sex = c.sex) ss
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_15.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_15.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_15.sql
new file mode 100644
index 0000000..8e41142
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_15.sql
@@ -0,0 +1 @@
+select  * from x join y join (select * from a join b  on a.age = b.age join c on a.sex = c.sex) as ss
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_2.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_2.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_2.sql
new file mode 100644
index 0000000..03056ac
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_2.sql
@@ -0,0 +1 @@
+select name, addr from people inner join student on people.name = student.name
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_3.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_3.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_3.sql
new file mode 100644
index 0000000..22281fe
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_3.sql
@@ -0,0 +1 @@
+select name, addr from people inner join student using (id, name)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_4.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_4.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_4.sql
new file mode 100644
index 0000000..7e572de
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_4.sql
@@ -0,0 +1 @@
+select name, addr from people join student using (id, name)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_5.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_5.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_5.sql
new file mode 100644
index 0000000..79c69e3
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_5.sql
@@ -0,0 +1 @@
+select name, addr from people cross join student
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_6.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_6.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_6.sql
new file mode 100644
index 0000000..10aafa9
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_6.sql
@@ -0,0 +1 @@
+select name, addr from people left outer join student on people.name = student.name
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_7.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_7.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_7.sql
new file mode 100644
index 0000000..402b82f
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_7.sql
@@ -0,0 +1 @@
+select name, addr from people right outer join student on people.name = student.name
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_8.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_8.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_8.sql
new file mode 100644
index 0000000..f413478
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_8.sql
@@ -0,0 +1,13 @@
+select *
+  from table1
+  cross join table2
+  join table3 on table1.id = table3.id
+  inner join table4 on table1.id = table4.id
+  left outer join table5 on table1.id = table5.id
+  right outer join table6 on table1.id = table6.id
+  full outer join table7 on table1.id = table7.id
+  natural join table8
+  natural inner join table9
+  natural left outer join table10
+  natural right outer join table11
+  natural full outer join table12
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_9.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_9.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_9.sql
new file mode 100644
index 0000000..6f0ae0d
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/join_9.sql
@@ -0,0 +1,5 @@
+select s_acctbal, s_name, n_name, p_partkey, p_mfgr, s_address, s_phone, s_comment, ps_supplycost
+  from region join nation on n_regionkey = r_regionkey and r_name = 'EUROPE'
+  join supplier on s_nationekey = n_nationkey
+  join partsupp on s_suppkey = ps_ps_suppkey
+  join part on p_partkey = ps_partkey and p_type like '%BRASS' and p_size = 15
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_1.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_1.sql
new file mode 100644
index 0000000..7196f0c
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_1.sql
@@ -0,0 +1 @@
+select id, name, age, gender from people
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_10.hiveql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_10.hiveql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_10.hiveql
new file mode 100644
index 0000000..f03fdc0
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_10.hiveql
@@ -0,0 +1,5 @@
+select B.*
+from (
+  select A.member_id, A.member_name
+  from table1 A
+) B

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_10.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_10.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_10.sql
new file mode 100644
index 0000000..a3557a1
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_10.sql
@@ -0,0 +1,5 @@
+select B.*
+from (
+  select A.member_id, A.member_name
+  from table1 AS A
+) B

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_11.hiveql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_11.hiveql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_11.hiveql
new file mode 100644
index 0000000..3bb82e9
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_11.hiveql
@@ -0,0 +1,4 @@
+select A.member_id, A.member_name
+from table1 A
+where A.member_id between '10000' and '20000'
+and A.age between 30 and 50
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_11.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_11.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_11.sql
new file mode 100644
index 0000000..8984a4d
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_11.sql
@@ -0,0 +1,6 @@
+select A.member_id, A.member_name
+from table1 AS A
+where A.member_id >= '10000'
+and A.member_id <= '20000'
+and A.age >= 30
+and A.age <= 50
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_12.hiveql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_12.hiveql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_12.hiveql
new file mode 100644
index 0000000..3ea5008
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_12.hiveql
@@ -0,0 +1,3 @@
+SELECT name, salary
+FROM  employees
+limit 10

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_13.hiveql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_13.hiveql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_13.hiveql
new file mode 100644
index 0000000..e9f7592
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_13.hiveql
@@ -0,0 +1,2 @@
+select A.*
+from table1 A
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_13.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_13.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_13.sql
new file mode 100644
index 0000000..19410ea
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_13.sql
@@ -0,0 +1,2 @@
+select A.*
+from table1  A
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_14.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_14.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_14.sql
new file mode 100644
index 0000000..27c9a5a
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_14.sql
@@ -0,0 +1,2 @@
+select *
+from table1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_2.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_2.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_2.sql
new file mode 100644
index 0000000..0727705
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_2.sql
@@ -0,0 +1 @@
+select id, name, age, gender from people as p, students as s
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_3.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_3.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_3.sql
new file mode 100644
index 0000000..2e8f43a
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_3.sql
@@ -0,0 +1 @@
+select name, addr, sum(score) from students group by name, addr
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_4.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_4.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_4.sql
new file mode 100644
index 0000000..6c19a45
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_4.sql
@@ -0,0 +1 @@
+select name, addr, age from people where age > 30
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_5.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_5.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_5.sql
new file mode 100644
index 0000000..d9234e0
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_5.sql
@@ -0,0 +1 @@
+select name as n, func(score, 3+4, 3>4) as total, 3+4 as id from people where age = 30
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_6.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_6.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_6.sql
new file mode 100644
index 0000000..965aa08
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_6.sql
@@ -0,0 +1 @@
+select ipv4:src_ip from test
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_7.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_7.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_7.sql
new file mode 100644
index 0000000..d54276b
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_7.sql
@@ -0,0 +1 @@
+select distinct id, name, age, gender from people
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_8.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_8.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_8.sql
new file mode 100644
index 0000000..13f6842
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_8.sql
@@ -0,0 +1 @@
+select all id, name, age, gender from people
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_9.hiveql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_9.hiveql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_9.hiveql
new file mode 100644
index 0000000..96e6042
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_9.hiveql
@@ -0,0 +1,4 @@
+SELECT A.*
+FROM table1 A
+WHERE A.member_name is not null
+and A.post_code is null
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_9.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_9.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_9.sql
new file mode 100644
index 0000000..8f99ca3
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/select_9.sql
@@ -0,0 +1,4 @@
+SELECT A.*
+FROM table1 AS A
+WHERE A.member_name is not null
+and A.post_code is null
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/set_1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/set_1.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/set_1.sql
new file mode 100644
index 0000000..88600fc
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/set_1.sql
@@ -0,0 +1 @@
+select c1,c2,c3 from table1 union select c4,c5,c6 from table2 union all select c7, c8 from table3
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/set_2.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/set_2.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/set_2.sql
new file mode 100644
index 0000000..0eb5670
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/set_2.sql
@@ -0,0 +1 @@
+select a,b,c from table1 union distinct select a,b,c from table2 except all select a,b,c from table3
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/set_3.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/set_3.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/set_3.sql
new file mode 100644
index 0000000..eebfbcb
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/set_3.sql
@@ -0,0 +1 @@
+select a,b,c from table1 intersect select a,b,c from table2 intersect all select a,b,c from table3
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/set_4.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/set_4.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/set_4.sql
new file mode 100644
index 0000000..a8f0814
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/set_4.sql
@@ -0,0 +1,36 @@
+SELECT *
+FROM
+(
+  SELECT
+          a.reg_date,
+          a.user_id
+  FROM
+          (SELECT buy_date AS bdate
+          FROM buy_history
+          WHERE host='a0') as a JOIN (SELECT * FROM category_info WHERE category_id ='A1') as  b ON a.id=b.id
+  UNION ALL
+  SELECT
+          a.reg_date,
+          a.user_id
+  FROM
+          (SELECT buy_date AS bdate
+          FROM buy_history
+          WHERE host='b0') as a JOIN (SELECT * FROM category_info WHERE category_id ='B1') as b ON a.id=b.id
+  UNION ALL
+  SELECT
+          a.reg_date,
+          a.user_id
+  FROM
+          (SELECT buy_date AS bdate
+          FROM buy_history
+          WHERE host='c0') as a JOIN (SELECT * FROM category_info WHERE category_id ='C1') as  b ON a.id=b.id
+  UNION ALL
+  SELECT
+          a.reg_date,
+          a.user_id
+  FROM
+          (SELECT buy_date AS bdate
+          FROM buy_history
+          WHERE host='d0') as  a JOIN (SELECT * FROM category_info WHERE category_id ='D1') as  b ON a.id=b.id
+
+)  as T
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/table_subquery1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/table_subquery1.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/table_subquery1.sql
new file mode 100644
index 0000000..3181e43
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/table_subquery1.sql
@@ -0,0 +1,19 @@
+SELECT unioninput.*
+FROM (
+  select
+    table1.key,
+    table1.value
+  FROM
+    table1
+  WHERE
+    table1.key < 100
+
+  UNION ALL
+
+  SELECT
+    table2.*
+  FROM
+    table2
+  WHERE
+    table2.key > 100
+) unioninput
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/table_subquery2.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/table_subquery2.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/table_subquery2.sql
new file mode 100644
index 0000000..206b76f
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/table_subquery2.sql
@@ -0,0 +1,21 @@
+SELECT
+  t1.fk,
+  t2.name
+FROM
+ (
+    SELECT
+      table1.fk
+    FROM
+      table1
+ ) t1
+
+ inner join
+
+ (
+    SELECT
+      table2.name
+    FROM
+      table2
+ ) t2
+
+ ON t1.fk = t2.fk;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/union_1.hiveql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/union_1.hiveql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/union_1.hiveql
new file mode 100644
index 0000000..d5cda15
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/union_1.hiveql
@@ -0,0 +1,14 @@
+SELECT unioninput.*
+FROM (
+  select table1.key, table1.value
+  FROM table1
+  WHERE table1.key < 100
+  UNION ALL
+  SELECT table2.*
+  FROM table2
+  WHERE table2.key > 100
+  UNION ALL
+  select table3.key, table3.value
+  FROM table3
+  WHERE table3.key < 100
+) unioninput
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testAvgDouble.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testAvgDouble.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testAvgDouble.result
new file mode 100644
index 0000000..33b954e
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testAvgDouble.result
@@ -0,0 +1,5 @@
+l_orderkey,revenue
+-------------------------------
+1,0.065
+3,0.08
+2,0.0
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testAvgInt.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testAvgInt.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testAvgInt.result
new file mode 100644
index 0000000..aef1b53
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testAvgInt.result
@@ -0,0 +1,3 @@
+total_avg
+-------------------------------
+1.8
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testAvgLong.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testAvgLong.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testAvgLong.result
new file mode 100644
index 0000000..9c12da0
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testAvgLong.result
@@ -0,0 +1,3 @@
+total_avg
+-------------------------------
+2.0
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testCount.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testCount.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testCount.result
new file mode 100644
index 0000000..381cded
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testCount.result
@@ -0,0 +1,3 @@
+rownum
+-------------------------------
+5
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testMaxLong.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testMaxLong.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testMaxLong.result
new file mode 100644
index 0000000..6a87409
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testMaxLong.result
@@ -0,0 +1,3 @@
+total_max
+-------------------------------
+3
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testMinLong.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testMinLong.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testMinLong.result
new file mode 100644
index 0000000..216e683
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testMinLong.result
@@ -0,0 +1,3 @@
+total_min
+-------------------------------
+1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testRandom.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testRandom.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testRandom.result
new file mode 100644
index 0000000..9f2a456
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testRandom.result
@@ -0,0 +1 @@
+select l_orderkey, random(3) as rndnum from lineitem group by l_orderkey, rndnum;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testSplitPart.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testSplitPart.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testSplitPart.result
new file mode 100644
index 0000000..d22cd68
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testSplitPart.result
@@ -0,0 +1,7 @@
+?split_part
+-------------------------------
+DELIVER
+TAKE
+TAKE
+NONE
+TAKE
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testSplitPartByString.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testSplitPartByString.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testSplitPartByString.result
new file mode 100644
index 0000000..ac8119d
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testSplitPartByString.result
@@ -0,0 +1,7 @@
+?split_part
+-------------------------------
+DELIVER IN PERSON
+TA
+TA
+NONE
+TA
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testSplitPartNested.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testSplitPartNested.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testSplitPartNested.result
new file mode 100644
index 0000000..5dd4193
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestBuiltinFunctions/testSplitPartNested.result
@@ -0,0 +1,7 @@
+?split_part
+-------------------------------
+
+KE
+KE
+
+KE
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestCaseByCases/testTAJO415Case.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestCaseByCases/testTAJO415Case.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestCaseByCases/testTAJO415Case.result
new file mode 100644
index 0000000..4b02873
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestCaseByCases/testTAJO415Case.result
@@ -0,0 +1,7 @@
+c_custkey,o_orderkey,cnt
+-------------------------------
+1,1,1
+3,3,1
+2,2,1
+4,0,1
+5,0,1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestCaseByCases/testTAJO418Case.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestCaseByCases/testTAJO418Case.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestCaseByCases/testTAJO418Case.result
new file mode 100644
index 0000000..ba35aa1
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestCaseByCases/testTAJO418Case.result
@@ -0,0 +1,3 @@
+l_returnflag,l_linestatus
+-------------------------------
+R,F
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testComplexParameter.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testComplexParameter.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testComplexParameter.result
new file mode 100644
index 0000000..628924b
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testComplexParameter.result
@@ -0,0 +1,3 @@
+revenue
+-------------------------------
+12908.3436
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testComplexParameter2.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testComplexParameter2.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testComplexParameter2.result
new file mode 100644
index 0000000..6ee9cb5
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testComplexParameter2.result
@@ -0,0 +1,3 @@
+merged
+-------------------------------
+8
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testComplexParameterWithSubQuery.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testComplexParameterWithSubQuery.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testComplexParameterWithSubQuery.result
new file mode 100644
index 0000000..59e09fe
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testComplexParameterWithSubQuery.result
@@ -0,0 +1,3 @@
+total
+-------------------------------
+10
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testCountDistinct.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testCountDistinct.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testCountDistinct.result
new file mode 100644
index 0000000..f2ad32a
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testCountDistinct.result
@@ -0,0 +1,5 @@
+l_orderkey,maximum,unique_key
+-------------------------------
+1,1,2
+2,2,1
+3,3,2
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testCountDistinct2.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testCountDistinct2.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testCountDistinct2.result
new file mode 100644
index 0000000..9164120
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testCountDistinct2.result
@@ -0,0 +1,5 @@
+l_orderkey,cnt,unique_key
+-------------------------------
+1,2,2
+2,1,1
+3,2,2
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testGroupBy.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testGroupBy.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testGroupBy.result
new file mode 100644
index 0000000..385d0de
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testGroupBy.result
@@ -0,0 +1,3 @@
+unique_key
+-------------------------------
+5
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testGroupBy2.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testGroupBy2.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testGroupBy2.result
new file mode 100644
index 0000000..23efdb7
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testGroupBy2.result
@@ -0,0 +1,4 @@
+unique_key
+-------------------------------
+3
+2
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testGroupBy3.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testGroupBy3.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testGroupBy3.result
new file mode 100644
index 0000000..c956d65
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testGroupBy3.result
@@ -0,0 +1,5 @@
+gkey
+-------------------------------
+1
+2
+3
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testGroupBy4.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testGroupBy4.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testGroupBy4.result
new file mode 100644
index 0000000..714e73d
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testGroupBy4.result
@@ -0,0 +1,5 @@
+gkey,unique_key
+-------------------------------
+1,2
+3,2
+2,1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testHavingWithAggFunction.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testHavingWithAggFunction.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testHavingWithAggFunction.result
new file mode 100644
index 0000000..b8369d2
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testHavingWithAggFunction.result
@@ -0,0 +1,4 @@
+l_orderkey,total,num
+-------------------------------
+3,2.5,3
+2,2.0,1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testHavingWithNamedTarget.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testHavingWithNamedTarget.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testHavingWithNamedTarget.result
new file mode 100644
index 0000000..8e6eabd
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testHavingWithNamedTarget.result
@@ -0,0 +1,5 @@
+l_orderkey,total,num
+-------------------------------
+1,1.0,3
+3,2.5,3
+2,2.0,1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestJoinQuery/testCrossJoin.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestJoinQuery/testCrossJoin.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestJoinQuery/testCrossJoin.result
new file mode 100644
index 0000000..7a1a4c2
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestJoinQuery/testCrossJoin.result
@@ -0,0 +1,127 @@
+n_name,r_name,n_regionkey,r_regionkey
+-------------------------------
+ALGERIA,AFRICA,0,0
+ARGENTINA,AFRICA,1,0
+BRAZIL,AFRICA,1,0
+CANADA,AFRICA,1,0
+EGYPT,AFRICA,4,0
+ETHIOPIA,AFRICA,0,0
+FRANCE,AFRICA,3,0
+GERMANY,AFRICA,3,0
+INDIA,AFRICA,2,0
+INDONESIA,AFRICA,2,0
+IRAN,AFRICA,4,0
+IRAQ,AFRICA,4,0
+JAPAN,AFRICA,2,0
+JORDAN,AFRICA,4,0
+KENYA,AFRICA,0,0
+MOROCCO,AFRICA,0,0
+MOZAMBIQUE,AFRICA,0,0
+PERU,AFRICA,1,0
+CHINA,AFRICA,2,0
+ROMANIA,AFRICA,3,0
+SAUDI ARABIA,AFRICA,4,0
+VIETNAM,AFRICA,2,0
+RUSSIA,AFRICA,3,0
+UNITED KINGDOM,AFRICA,3,0
+UNITED STATES,AFRICA,1,0
+ALGERIA,AMERICA,0,1
+ARGENTINA,AMERICA,1,1
+BRAZIL,AMERICA,1,1
+CANADA,AMERICA,1,1
+EGYPT,AMERICA,4,1
+ETHIOPIA,AMERICA,0,1
+FRANCE,AMERICA,3,1
+GERMANY,AMERICA,3,1
+INDIA,AMERICA,2,1
+INDONESIA,AMERICA,2,1
+IRAN,AMERICA,4,1
+IRAQ,AMERICA,4,1
+JAPAN,AMERICA,2,1
+JORDAN,AMERICA,4,1
+KENYA,AMERICA,0,1
+MOROCCO,AMERICA,0,1
+MOZAMBIQUE,AMERICA,0,1
+PERU,AMERICA,1,1
+CHINA,AMERICA,2,1
+ROMANIA,AMERICA,3,1
+SAUDI ARABIA,AMERICA,4,1
+VIETNAM,AMERICA,2,1
+RUSSIA,AMERICA,3,1
+UNITED KINGDOM,AMERICA,3,1
+UNITED STATES,AMERICA,1,1
+ALGERIA,ASIA,0,2
+ARGENTINA,ASIA,1,2
+BRAZIL,ASIA,1,2
+CANADA,ASIA,1,2
+EGYPT,ASIA,4,2
+ETHIOPIA,ASIA,0,2
+FRANCE,ASIA,3,2
+GERMANY,ASIA,3,2
+INDIA,ASIA,2,2
+INDONESIA,ASIA,2,2
+IRAN,ASIA,4,2
+IRAQ,ASIA,4,2
+JAPAN,ASIA,2,2
+JORDAN,ASIA,4,2
+KENYA,ASIA,0,2
+MOROCCO,ASIA,0,2
+MOZAMBIQUE,ASIA,0,2
+PERU,ASIA,1,2
+CHINA,ASIA,2,2
+ROMANIA,ASIA,3,2
+SAUDI ARABIA,ASIA,4,2
+VIETNAM,ASIA,2,2
+RUSSIA,ASIA,3,2
+UNITED KINGDOM,ASIA,3,2
+UNITED STATES,ASIA,1,2
+ALGERIA,EUROPE,0,3
+ARGENTINA,EUROPE,1,3
+BRAZIL,EUROPE,1,3
+CANADA,EUROPE,1,3
+EGYPT,EUROPE,4,3
+ETHIOPIA,EUROPE,0,3
+FRANCE,EUROPE,3,3
+GERMANY,EUROPE,3,3
+INDIA,EUROPE,2,3
+INDONESIA,EUROPE,2,3
+IRAN,EUROPE,4,3
+IRAQ,EUROPE,4,3
+JAPAN,EUROPE,2,3
+JORDAN,EUROPE,4,3
+KENYA,EUROPE,0,3
+MOROCCO,EUROPE,0,3
+MOZAMBIQUE,EUROPE,0,3
+PERU,EUROPE,1,3
+CHINA,EUROPE,2,3
+ROMANIA,EUROPE,3,3
+SAUDI ARABIA,EUROPE,4,3
+VIETNAM,EUROPE,2,3
+RUSSIA,EUROPE,3,3
+UNITED KINGDOM,EUROPE,3,3
+UNITED STATES,EUROPE,1,3
+ALGERIA,MIDDLE EAST,0,4
+ARGENTINA,MIDDLE EAST,1,4
+BRAZIL,MIDDLE EAST,1,4
+CANADA,MIDDLE EAST,1,4
+EGYPT,MIDDLE EAST,4,4
+ETHIOPIA,MIDDLE EAST,0,4
+FRANCE,MIDDLE EAST,3,4
+GERMANY,MIDDLE EAST,3,4
+INDIA,MIDDLE EAST,2,4
+INDONESIA,MIDDLE EAST,2,4
+IRAN,MIDDLE EAST,4,4
+IRAQ,MIDDLE EAST,4,4
+JAPAN,MIDDLE EAST,2,4
+JORDAN,MIDDLE EAST,4,4
+KENYA,MIDDLE EAST,0,4
+MOROCCO,MIDDLE EAST,0,4
+MOZAMBIQUE,MIDDLE EAST,0,4
+PERU,MIDDLE EAST,1,4
+CHINA,MIDDLE EAST,2,4
+ROMANIA,MIDDLE EAST,3,4
+SAUDI ARABIA,MIDDLE EAST,4,4
+VIETNAM,MIDDLE EAST,2,4
+RUSSIA,MIDDLE EAST,3,4
+UNITED KINGDOM,MIDDLE EAST,3,4
+UNITED STATES,MIDDLE EAST,1,4
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestJoinQuery/testCrossJoinWithExplicitJoinQual.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestJoinQuery/testCrossJoinWithExplicitJoinQual.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestJoinQuery/testCrossJoinWithExplicitJoinQual.result
new file mode 100644
index 0000000..5c54325
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestJoinQuery/testCrossJoinWithExplicitJoinQual.result
@@ -0,0 +1,27 @@
+n_name,r_name,n_regionkey,r_regionkey
+-------------------------------
+ALGERIA,AFRICA,0,0
+ARGENTINA,AMERICA,1,1
+BRAZIL,AMERICA,1,1
+CANADA,AMERICA,1,1
+EGYPT,MIDDLE EAST,4,4
+ETHIOPIA,AFRICA,0,0
+FRANCE,EUROPE,3,3
+GERMANY,EUROPE,3,3
+INDIA,ASIA,2,2
+INDONESIA,ASIA,2,2
+IRAN,MIDDLE EAST,4,4
+IRAQ,MIDDLE EAST,4,4
+JAPAN,ASIA,2,2
+JORDAN,MIDDLE EAST,4,4
+KENYA,AFRICA,0,0
+MOROCCO,AFRICA,0,0
+MOZAMBIQUE,AFRICA,0,0
+PERU,AMERICA,1,1
+CHINA,ASIA,2,2
+ROMANIA,EUROPE,3,3
+SAUDI ARABIA,MIDDLE EAST,4,4
+VIETNAM,ASIA,2,2
+RUSSIA,EUROPE,3,3
+UNITED KINGDOM,EUROPE,3,3
+UNITED STATES,AMERICA,1,1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestJoinQuery/testFullOuterJoin1.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestJoinQuery/testFullOuterJoin1.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestJoinQuery/testFullOuterJoin1.result
new file mode 100644
index 0000000..81dc055
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestJoinQuery/testFullOuterJoin1.result
@@ -0,0 +1,7 @@
+c_custkey,o_orderkey
+-------------------------------
+1,1
+2,2
+3,3
+4,0
+5,0
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestJoinQuery/testJoinAndCaseWhen.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestJoinQuery/testJoinAndCaseWhen.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestJoinQuery/testJoinAndCaseWhen.result
new file mode 100644
index 0000000..f5215ea
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestJoinQuery/testJoinAndCaseWhen.result
@@ -0,0 +1,27 @@
+r_regionkey,n_regionkey,cond
+-------------------------------
+0,0,zero
+1,1,one
+1,1,one
+1,1,one
+4,4,four
+0,0,zero
+3,3,three
+3,3,three
+2,2,two
+2,2,two
+4,4,four
+4,4,four
+2,2,two
+4,4,four
+0,0,zero
+0,0,zero
+0,0,zero
+1,1,one
+2,2,two
+3,3,three
+4,4,four
+2,2,two
+3,3,three
+3,3,three
+1,1,one
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestJoinQuery/testJoinRefEval.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestJoinQuery/testJoinRefEval.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestJoinQuery/testJoinRefEval.result
new file mode 100644
index 0000000..1b960dc
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestJoinQuery/testJoinRefEval.result
@@ -0,0 +1,27 @@
+r_regionkey,n_regionkey,plus
+-------------------------------
+0,0,0
+1,1,2
+1,1,2
+1,1,2
+4,4,8
+0,0,0
+3,3,6
+3,3,6
+2,2,4
+2,2,4
+4,4,8
+4,4,8
+2,2,4
+4,4,8
+0,0,0
+0,0,0
+0,0,0
+1,1,2
+2,2,4
+3,3,6
+4,4,8
+2,2,4
+3,3,6
+3,3,6
+1,1,2
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestJoinQuery/testLeftOuterJoin1.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestJoinQuery/testLeftOuterJoin1.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestJoinQuery/testLeftOuterJoin1.result
new file mode 100644
index 0000000..81dc055
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestJoinQuery/testLeftOuterJoin1.result
@@ -0,0 +1,7 @@
+c_custkey,o_orderkey
+-------------------------------
+1,1
+2,2
+3,3
+4,0
+5,0
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestJoinQuery/testRightOuterJoin1.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestJoinQuery/testRightOuterJoin1.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestJoinQuery/testRightOuterJoin1.result
new file mode 100644
index 0000000..81dc055
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestJoinQuery/testRightOuterJoin1.result
@@ -0,0 +1,7 @@
+c_custkey,o_orderkey
+-------------------------------
+1,1
+2,2
+3,3
+4,0
+5,0
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestJoinQuery/testTPCHQ2Join.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestJoinQuery/testTPCHQ2Join.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestJoinQuery/testTPCHQ2Join.result
new file mode 100644
index 0000000..dcd7787
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestJoinQuery/testTPCHQ2Join.result
@@ -0,0 +1,5 @@
+s_acctbal,s_name,n_name,p_partkey,p_mfgr,s_address,s_phone,s_comment
+-------------------------------
+4192.4,Supplier#000000003,ARGENTINA,2,Manufacturer#1,q1,G3Pj6OjIuUYfUoH18BFTKP5aU9bEV3,11-383-516-1199,blithely silent requests after the express dependencies are sl
+4032.68,Supplier#000000002,ETHIOPIA,1,Manufacturer#1,89eJ5ksX3ImxJQBvxObC,,15-679-861-2259, slyly bold instructions. idle dependen
+4641.08,Supplier#000000004,MOROCCO,3,Manufacturer#4,Bk7ah4CK8SYQTepEmvMkkgMwg,25-843-787-7479,riously even requests above the exp
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testCaseWhen.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testCaseWhen.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testCaseWhen.result
new file mode 100644
index 0000000..68a5572
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testCaseWhen.result
@@ -0,0 +1,7 @@
+r_regionkey,cond
+-------------------------------
+0,zero
+1,one
+2,two
+3,three
+4,four
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testCaseWhenWithoutElse.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testCaseWhenWithoutElse.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testCaseWhenWithoutElse.result
new file mode 100644
index 0000000..843b4e8
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testCaseWhenWithoutElse.result
@@ -0,0 +1,7 @@
+r_regionkey,cond
+-------------------------------
+0,0
+1,11
+2,12
+3,13
+4,14
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testInClause.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testInClause.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testInClause.result
new file mode 100644
index 0000000..0fcabae
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testInClause.result
@@ -0,0 +1,5 @@
+l_orderkey
+-------------------------------
+2
+3
+3
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testInStrClause.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testInStrClause.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testInStrClause.result
new file mode 100644
index 0000000..4cefae9
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testInStrClause.result
@@ -0,0 +1,4 @@
+l_orderkey
+-------------------------------
+3
+3
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testLikeClause.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testLikeClause.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testLikeClause.result
new file mode 100644
index 0000000..4ba420d
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testLikeClause.result
@@ -0,0 +1,9 @@
+n_name
+-------------------------------
+ALGERIA
+ETHIOPIA
+INDIA
+INDONESIA
+ROMANIA
+SAUDI ARABIA
+RUSSIA
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testLimit.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testLimit.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testLimit.result
new file mode 100644
index 0000000..c6ada38
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testLimit.result
@@ -0,0 +1,5 @@
+l_orderkey,l_suppkey
+-------------------------------
+1,7706
+1,7311
+2,1191
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testNotEqual.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testNotEqual.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testNotEqual.result
new file mode 100644
index 0000000..0fcabae
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testNotEqual.result
@@ -0,0 +1,5 @@
+l_orderkey
+-------------------------------
+2
+3
+3
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testNotInClause.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testNotInClause.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testNotInClause.result
new file mode 100644
index 0000000..dcadee9
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testNotInClause.result
@@ -0,0 +1,4 @@
+l_orderkey
+-------------------------------
+1
+1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testNotInStrClause.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testNotInStrClause.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testNotInStrClause.result
new file mode 100644
index 0000000..4cefae9
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testNotInStrClause.result
@@ -0,0 +1,4 @@
+l_orderkey
+-------------------------------
+3
+3
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testRealValueCompare.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testRealValueCompare.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testRealValueCompare.result
new file mode 100644
index 0000000..02d3f4e
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testRealValueCompare.result
@@ -0,0 +1,3 @@
+ps_supplycost
+-------------------------------
+771.64
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testSelect.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testSelect.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testSelect.result
new file mode 100644
index 0000000..1378536
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testSelect.result
@@ -0,0 +1,7 @@
+l_orderkey,l_partkey
+-------------------------------
+1,1
+1,1
+2,2
+3,2
+3,3
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testSelect2.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testSelect2.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testSelect2.result
new file mode 100644
index 0000000..934c2c8
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestSelectQuery/testSelect2.result
@@ -0,0 +1,7 @@
+l_orderkey,l_partkey,plus
+-------------------------------
+1,1,2
+1,1,2
+2,2,4
+3,2,5
+3,3,6
\ No newline at end of file


[3/5] TAJO-476: Add a test development kit for unit tests based on executions of queries.

Posted by hy...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/drop_table.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/drop_table.sql b/tajo-core/tajo-core-backend/src/test/queries/drop_table.sql
deleted file mode 100644
index 0e52112..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/drop_table.sql
+++ /dev/null
@@ -1 +0,0 @@
-drop table abc
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/exists_predicate_1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/exists_predicate_1.sql b/tajo-core/tajo-core-backend/src/test/queries/exists_predicate_1.sql
deleted file mode 100644
index 0b10799..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/exists_predicate_1.sql
+++ /dev/null
@@ -1 +0,0 @@
-select c1,c2,c3 from table1 where exists (select c4 from table2 where c4 = table1.c1);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/exists_predicate_2.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/exists_predicate_2.sql b/tajo-core/tajo-core-backend/src/test/queries/exists_predicate_2.sql
deleted file mode 100644
index f4f82f9..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/exists_predicate_2.sql
+++ /dev/null
@@ -1 +0,0 @@
-select c1,c2,c3 from table1 where not exists (select c4 from table2 where c4 = table1.c1);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/groupby_1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/groupby_1.sql b/tajo-core/tajo-core-backend/src/test/queries/groupby_1.sql
deleted file mode 100644
index 85dbe21..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/groupby_1.sql
+++ /dev/null
@@ -1 +0,0 @@
-select col0, col1, col2, col3, sum(col4) as total, avg(col5) from base group by col0, cube (col1, col2), rollup(col3) having total > 100
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/in_subquery_1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/in_subquery_1.sql b/tajo-core/tajo-core-backend/src/test/queries/in_subquery_1.sql
deleted file mode 100644
index 2a16a8d..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/in_subquery_1.sql
+++ /dev/null
@@ -1 +0,0 @@
-select c1,c2,c3 from table1 where c1 in (select c4 from table2);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/in_subquery_2.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/in_subquery_2.sql b/tajo-core/tajo-core-backend/src/test/queries/in_subquery_2.sql
deleted file mode 100644
index 64c8034..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/in_subquery_2.sql
+++ /dev/null
@@ -1 +0,0 @@
-select c1,c2,c3 from table1 where c1 not in (select c4 from table2);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/insert_into_select_1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/insert_into_select_1.sql b/tajo-core/tajo-core-backend/src/test/queries/insert_into_select_1.sql
deleted file mode 100644
index d3291f5..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/insert_into_select_1.sql
+++ /dev/null
@@ -1 +0,0 @@
-insert into table1 select col1, col2, sum(col3) from table2 group by col1, col2

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/insert_into_select_2.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/insert_into_select_2.sql b/tajo-core/tajo-core-backend/src/test/queries/insert_into_select_2.sql
deleted file mode 100644
index 2928b11..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/insert_into_select_2.sql
+++ /dev/null
@@ -1 +0,0 @@
-insert into location 'file:/tmp/data' select col1, col2, sum(col3) from table2 group by col1, col2

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/insert_into_select_3.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/insert_into_select_3.sql b/tajo-core/tajo-core-backend/src/test/queries/insert_into_select_3.sql
deleted file mode 100644
index b7718dc..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/insert_into_select_3.sql
+++ /dev/null
@@ -1 +0,0 @@
-insert into table1 (col1, col2, col3) select col1, col2, sum(col3) as total from table2 group by col1, col2

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/insert_overwrite_into_select_1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/insert_overwrite_into_select_1.sql b/tajo-core/tajo-core-backend/src/test/queries/insert_overwrite_into_select_1.sql
deleted file mode 100644
index 84992bc..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/insert_overwrite_into_select_1.sql
+++ /dev/null
@@ -1 +0,0 @@
-insert overwrite into table1 select col1, col2, sum(col3) from table2 group by col1, col2

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/insert_overwrite_into_select_2.hiveql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/insert_overwrite_into_select_2.hiveql b/tajo-core/tajo-core-backend/src/test/queries/insert_overwrite_into_select_2.hiveql
deleted file mode 100644
index b99863e..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/insert_overwrite_into_select_2.hiveql
+++ /dev/null
@@ -1 +0,0 @@
-INSERT OVERWRITE DIRECTORY  'file:/tmp/data' select col1, col2, sum(col3) from table2 group by col1, col2

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/insert_overwrite_into_select_2.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/insert_overwrite_into_select_2.sql b/tajo-core/tajo-core-backend/src/test/queries/insert_overwrite_into_select_2.sql
deleted file mode 100644
index 1c4227b..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/insert_overwrite_into_select_2.sql
+++ /dev/null
@@ -1 +0,0 @@
-insert overwrite into location 'file:/tmp/data' select col1, col2, sum(col3) from table2 group by col1, col2

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/insert_overwrite_into_select_3.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/insert_overwrite_into_select_3.sql b/tajo-core/tajo-core-backend/src/test/queries/insert_overwrite_into_select_3.sql
deleted file mode 100644
index bfacc01..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/insert_overwrite_into_select_3.sql
+++ /dev/null
@@ -1 +0,0 @@
-insert overwrite into table1 (col1, col2, col3) select col1, col2, sum(col3) as total from table2 group by col1, col2

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/join_1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/join_1.sql b/tajo-core/tajo-core-backend/src/test/queries/join_1.sql
deleted file mode 100644
index ad27795..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/join_1.sql
+++ /dev/null
@@ -1 +0,0 @@
-select name, addr from people natural join student natural join professor
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/join_10.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/join_10.sql b/tajo-core/tajo-core-backend/src/test/queries/join_10.sql
deleted file mode 100644
index c9056cc..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/join_10.sql
+++ /dev/null
@@ -1 +0,0 @@
-select * from a cross join b, c, d, e
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/join_11.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/join_11.sql b/tajo-core/tajo-core-backend/src/test/queries/join_11.sql
deleted file mode 100644
index 25daeb0..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/join_11.sql
+++ /dev/null
@@ -1 +0,0 @@
-select * from x, y, (select * from a, b, c WHERE something) as ss where somethingelse
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/join_12.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/join_12.sql b/tajo-core/tajo-core-backend/src/test/queries/join_12.sql
deleted file mode 100644
index 02a0b8e..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/join_12.sql
+++ /dev/null
@@ -1 +0,0 @@
-select name, addr from people join student join professor
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/join_13.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/join_13.sql b/tajo-core/tajo-core-backend/src/test/queries/join_13.sql
deleted file mode 100644
index 9c56bc0..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/join_13.sql
+++ /dev/null
@@ -1,13 +0,0 @@
-select * 
-from table1 
-cross join table2 
-join table3 on table1.id = table3.id 
-inner join table4 on table1.id = table4.id 
-left outer join table5 on table1.id = table5.id 
-right outer join table6 on table1.id = table6.id 
-full outer join table7 on table1.id = table7.id 
-join table8 
-inner join table9 
-left outer join table10 
-right outer join table11 
-full outer join table12
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/join_14.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/join_14.sql b/tajo-core/tajo-core-backend/src/test/queries/join_14.sql
deleted file mode 100644
index 21c7099..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/join_14.sql
+++ /dev/null
@@ -1 +0,0 @@
-select * from a cross join b cross join c cross join d cross join e
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/join_15.hiveql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/join_15.hiveql b/tajo-core/tajo-core-backend/src/test/queries/join_15.hiveql
deleted file mode 100644
index 28e9a02..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/join_15.hiveql
+++ /dev/null
@@ -1 +0,0 @@
-select  * from x join y join (select * from a join b  on a.age = b.age join c on a.sex = c.sex) ss
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/join_15.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/join_15.sql b/tajo-core/tajo-core-backend/src/test/queries/join_15.sql
deleted file mode 100644
index 8e41142..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/join_15.sql
+++ /dev/null
@@ -1 +0,0 @@
-select  * from x join y join (select * from a join b  on a.age = b.age join c on a.sex = c.sex) as ss
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/join_2.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/join_2.sql b/tajo-core/tajo-core-backend/src/test/queries/join_2.sql
deleted file mode 100644
index 03056ac..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/join_2.sql
+++ /dev/null
@@ -1 +0,0 @@
-select name, addr from people inner join student on people.name = student.name
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/join_3.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/join_3.sql b/tajo-core/tajo-core-backend/src/test/queries/join_3.sql
deleted file mode 100644
index 22281fe..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/join_3.sql
+++ /dev/null
@@ -1 +0,0 @@
-select name, addr from people inner join student using (id, name)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/join_4.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/join_4.sql b/tajo-core/tajo-core-backend/src/test/queries/join_4.sql
deleted file mode 100644
index 7e572de..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/join_4.sql
+++ /dev/null
@@ -1 +0,0 @@
-select name, addr from people join student using (id, name)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/join_5.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/join_5.sql b/tajo-core/tajo-core-backend/src/test/queries/join_5.sql
deleted file mode 100644
index 79c69e3..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/join_5.sql
+++ /dev/null
@@ -1 +0,0 @@
-select name, addr from people cross join student
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/join_6.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/join_6.sql b/tajo-core/tajo-core-backend/src/test/queries/join_6.sql
deleted file mode 100644
index 10aafa9..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/join_6.sql
+++ /dev/null
@@ -1 +0,0 @@
-select name, addr from people left outer join student on people.name = student.name
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/join_7.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/join_7.sql b/tajo-core/tajo-core-backend/src/test/queries/join_7.sql
deleted file mode 100644
index 402b82f..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/join_7.sql
+++ /dev/null
@@ -1 +0,0 @@
-select name, addr from people right outer join student on people.name = student.name
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/join_8.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/join_8.sql b/tajo-core/tajo-core-backend/src/test/queries/join_8.sql
deleted file mode 100644
index f413478..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/join_8.sql
+++ /dev/null
@@ -1,13 +0,0 @@
-select *
-  from table1
-  cross join table2
-  join table3 on table1.id = table3.id
-  inner join table4 on table1.id = table4.id
-  left outer join table5 on table1.id = table5.id
-  right outer join table6 on table1.id = table6.id
-  full outer join table7 on table1.id = table7.id
-  natural join table8
-  natural inner join table9
-  natural left outer join table10
-  natural right outer join table11
-  natural full outer join table12
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/join_9.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/join_9.sql b/tajo-core/tajo-core-backend/src/test/queries/join_9.sql
deleted file mode 100644
index 6f0ae0d..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/join_9.sql
+++ /dev/null
@@ -1,5 +0,0 @@
-select s_acctbal, s_name, n_name, p_partkey, p_mfgr, s_address, s_phone, s_comment, ps_supplycost
-  from region join nation on n_regionkey = r_regionkey and r_name = 'EUROPE'
-  join supplier on s_nationekey = n_nationkey
-  join partsupp on s_suppkey = ps_ps_suppkey
-  join part on p_partkey = ps_partkey and p_type like '%BRASS' and p_size = 15
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/select_1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/select_1.sql b/tajo-core/tajo-core-backend/src/test/queries/select_1.sql
deleted file mode 100644
index 7196f0c..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/select_1.sql
+++ /dev/null
@@ -1 +0,0 @@
-select id, name, age, gender from people
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/select_10.hiveql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/select_10.hiveql b/tajo-core/tajo-core-backend/src/test/queries/select_10.hiveql
deleted file mode 100644
index f03fdc0..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/select_10.hiveql
+++ /dev/null
@@ -1,5 +0,0 @@
-select B.*
-from (
-  select A.member_id, A.member_name
-  from table1 A
-) B

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/select_10.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/select_10.sql b/tajo-core/tajo-core-backend/src/test/queries/select_10.sql
deleted file mode 100644
index a3557a1..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/select_10.sql
+++ /dev/null
@@ -1,5 +0,0 @@
-select B.*
-from (
-  select A.member_id, A.member_name
-  from table1 AS A
-) B

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/select_11.hiveql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/select_11.hiveql b/tajo-core/tajo-core-backend/src/test/queries/select_11.hiveql
deleted file mode 100644
index 3bb82e9..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/select_11.hiveql
+++ /dev/null
@@ -1,4 +0,0 @@
-select A.member_id, A.member_name
-from table1 A
-where A.member_id between '10000' and '20000'
-and A.age between 30 and 50
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/select_11.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/select_11.sql b/tajo-core/tajo-core-backend/src/test/queries/select_11.sql
deleted file mode 100644
index 8984a4d..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/select_11.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-select A.member_id, A.member_name
-from table1 AS A
-where A.member_id >= '10000'
-and A.member_id <= '20000'
-and A.age >= 30
-and A.age <= 50
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/select_12.hiveql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/select_12.hiveql b/tajo-core/tajo-core-backend/src/test/queries/select_12.hiveql
deleted file mode 100644
index 3ea5008..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/select_12.hiveql
+++ /dev/null
@@ -1,3 +0,0 @@
-SELECT name, salary
-FROM  employees
-limit 10

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/select_13.hiveql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/select_13.hiveql b/tajo-core/tajo-core-backend/src/test/queries/select_13.hiveql
deleted file mode 100644
index e9f7592..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/select_13.hiveql
+++ /dev/null
@@ -1,2 +0,0 @@
-select A.*
-from table1 A
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/select_13.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/select_13.sql b/tajo-core/tajo-core-backend/src/test/queries/select_13.sql
deleted file mode 100644
index 19410ea..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/select_13.sql
+++ /dev/null
@@ -1,2 +0,0 @@
-select A.*
-from table1  A
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/select_14.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/select_14.sql b/tajo-core/tajo-core-backend/src/test/queries/select_14.sql
deleted file mode 100644
index 27c9a5a..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/select_14.sql
+++ /dev/null
@@ -1,2 +0,0 @@
-select *
-from table1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/select_2.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/select_2.sql b/tajo-core/tajo-core-backend/src/test/queries/select_2.sql
deleted file mode 100644
index 0727705..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/select_2.sql
+++ /dev/null
@@ -1 +0,0 @@
-select id, name, age, gender from people as p, students as s
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/select_3.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/select_3.sql b/tajo-core/tajo-core-backend/src/test/queries/select_3.sql
deleted file mode 100644
index 2e8f43a..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/select_3.sql
+++ /dev/null
@@ -1 +0,0 @@
-select name, addr, sum(score) from students group by name, addr
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/select_4.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/select_4.sql b/tajo-core/tajo-core-backend/src/test/queries/select_4.sql
deleted file mode 100644
index 6c19a45..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/select_4.sql
+++ /dev/null
@@ -1 +0,0 @@
-select name, addr, age from people where age > 30
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/select_5.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/select_5.sql b/tajo-core/tajo-core-backend/src/test/queries/select_5.sql
deleted file mode 100644
index d9234e0..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/select_5.sql
+++ /dev/null
@@ -1 +0,0 @@
-select name as n, func(score, 3+4, 3>4) as total, 3+4 as id from people where age = 30
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/select_6.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/select_6.sql b/tajo-core/tajo-core-backend/src/test/queries/select_6.sql
deleted file mode 100644
index 965aa08..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/select_6.sql
+++ /dev/null
@@ -1 +0,0 @@
-select ipv4:src_ip from test
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/select_7.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/select_7.sql b/tajo-core/tajo-core-backend/src/test/queries/select_7.sql
deleted file mode 100644
index d54276b..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/select_7.sql
+++ /dev/null
@@ -1 +0,0 @@
-select distinct id, name, age, gender from people
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/select_8.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/select_8.sql b/tajo-core/tajo-core-backend/src/test/queries/select_8.sql
deleted file mode 100644
index 13f6842..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/select_8.sql
+++ /dev/null
@@ -1 +0,0 @@
-select all id, name, age, gender from people
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/select_9.hiveql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/select_9.hiveql b/tajo-core/tajo-core-backend/src/test/queries/select_9.hiveql
deleted file mode 100644
index 96e6042..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/select_9.hiveql
+++ /dev/null
@@ -1,4 +0,0 @@
-SELECT A.*
-FROM table1 A
-WHERE A.member_name is not null
-and A.post_code is null
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/select_9.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/select_9.sql b/tajo-core/tajo-core-backend/src/test/queries/select_9.sql
deleted file mode 100644
index 8f99ca3..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/select_9.sql
+++ /dev/null
@@ -1,4 +0,0 @@
-SELECT A.*
-FROM table1 AS A
-WHERE A.member_name is not null
-and A.post_code is null
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/set_1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/set_1.sql b/tajo-core/tajo-core-backend/src/test/queries/set_1.sql
deleted file mode 100644
index 88600fc..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/set_1.sql
+++ /dev/null
@@ -1 +0,0 @@
-select c1,c2,c3 from table1 union select c4,c5,c6 from table2 union all select c7, c8 from table3
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/set_2.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/set_2.sql b/tajo-core/tajo-core-backend/src/test/queries/set_2.sql
deleted file mode 100644
index 0eb5670..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/set_2.sql
+++ /dev/null
@@ -1 +0,0 @@
-select a,b,c from table1 union distinct select a,b,c from table2 except all select a,b,c from table3
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/set_3.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/set_3.sql b/tajo-core/tajo-core-backend/src/test/queries/set_3.sql
deleted file mode 100644
index eebfbcb..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/set_3.sql
+++ /dev/null
@@ -1 +0,0 @@
-select a,b,c from table1 intersect select a,b,c from table2 intersect all select a,b,c from table3
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/set_4.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/set_4.sql b/tajo-core/tajo-core-backend/src/test/queries/set_4.sql
deleted file mode 100644
index a8f0814..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/set_4.sql
+++ /dev/null
@@ -1,36 +0,0 @@
-SELECT *
-FROM
-(
-  SELECT
-          a.reg_date,
-          a.user_id
-  FROM
-          (SELECT buy_date AS bdate
-          FROM buy_history
-          WHERE host='a0') as a JOIN (SELECT * FROM category_info WHERE category_id ='A1') as  b ON a.id=b.id
-  UNION ALL
-  SELECT
-          a.reg_date,
-          a.user_id
-  FROM
-          (SELECT buy_date AS bdate
-          FROM buy_history
-          WHERE host='b0') as a JOIN (SELECT * FROM category_info WHERE category_id ='B1') as b ON a.id=b.id
-  UNION ALL
-  SELECT
-          a.reg_date,
-          a.user_id
-  FROM
-          (SELECT buy_date AS bdate
-          FROM buy_history
-          WHERE host='c0') as a JOIN (SELECT * FROM category_info WHERE category_id ='C1') as  b ON a.id=b.id
-  UNION ALL
-  SELECT
-          a.reg_date,
-          a.user_id
-  FROM
-          (SELECT buy_date AS bdate
-          FROM buy_history
-          WHERE host='d0') as  a JOIN (SELECT * FROM category_info WHERE category_id ='D1') as  b ON a.id=b.id
-
-)  as T
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/table_subquery1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/table_subquery1.sql b/tajo-core/tajo-core-backend/src/test/queries/table_subquery1.sql
deleted file mode 100644
index 3181e43..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/table_subquery1.sql
+++ /dev/null
@@ -1,19 +0,0 @@
-SELECT unioninput.*
-FROM (
-  select
-    table1.key,
-    table1.value
-  FROM
-    table1
-  WHERE
-    table1.key < 100
-
-  UNION ALL
-
-  SELECT
-    table2.*
-  FROM
-    table2
-  WHERE
-    table2.key > 100
-) unioninput
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/table_subquery2.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/table_subquery2.sql b/tajo-core/tajo-core-backend/src/test/queries/table_subquery2.sql
deleted file mode 100644
index 206b76f..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/table_subquery2.sql
+++ /dev/null
@@ -1,21 +0,0 @@
-SELECT
-  t1.fk,
-  t2.name
-FROM
- (
-    SELECT
-      table1.fk
-    FROM
-      table1
- ) t1
-
- inner join
-
- (
-    SELECT
-      table2.name
-    FROM
-      table2
- ) t2
-
- ON t1.fk = t2.fk;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/tajo415_case.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/tajo415_case.sql b/tajo-core/tajo-core-backend/src/test/queries/tajo415_case.sql
deleted file mode 100644
index 4a73b04..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/tajo415_case.sql
+++ /dev/null
@@ -1,33 +0,0 @@
-select
-  c_custkey,
-  o_orderkey,
-  a.cnt
-
-from (
-
-  select
-    c_custkey,
-    count(*) as cnt
-
-  from
-    customer
-
-  group by
-    c_custkey
-
-) a left outer join (
-
-  select
-    o_orderkey,
-    count(*) as cnt
-
-  from
-    orders
-
-  where
-    o_orderkey is not null
-
-  group by
-    o_orderkey
-
-) b on (a.c_custkey = b.o_orderkey);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/tajo418_case.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/tajo418_case.sql b/tajo-core/tajo-core-backend/src/test/queries/tajo418_case.sql
deleted file mode 100644
index b3ad48a..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/tajo418_case.sql
+++ /dev/null
@@ -1,29 +0,0 @@
-SELECT
-  l_returnflag,
-  l_linestatus
-
-FROM (
-  SELECT
-    *
-  FROM
-    lineitem
-  WHERE
-    l_returnflag = 'K'
-
-  UNION ALL
-
-  SELECT
-    *
-  FROM
-    lineitem
-  WHERE
-    l_returnflag = 'R'
-) T
-
-GROUP BY
-  l_returnflag,
-	l_linestatus
-
-ORDER BY
-  l_returnflag,
-	l_linestatus
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/tpch_q2_simplified.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/tpch_q2_simplified.sql b/tajo-core/tajo-core-backend/src/test/queries/tpch_q2_simplified.sql
deleted file mode 100644
index 80999d5..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/tpch_q2_simplified.sql
+++ /dev/null
@@ -1,20 +0,0 @@
-select
-	s_acctbal,
-	s_name,
-	n_name,
-	p_partkey,
-	p_mfgr,
-	s_address,
-	s_phone,
-	s_comment
-from
-	part,
-	supplier,
-	partsupp,
-	nation,
-	region
-where
-	p_partkey = ps_partkey
-	and s_suppkey = ps_suppkey
-	and s_nationkey = n_nationkey
-	and n_regionkey = r_regionkey

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/union_1.hiveql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/union_1.hiveql b/tajo-core/tajo-core-backend/src/test/queries/union_1.hiveql
deleted file mode 100644
index d5cda15..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/union_1.hiveql
+++ /dev/null
@@ -1,14 +0,0 @@
-SELECT unioninput.*
-FROM (
-  select table1.key, table1.value
-  FROM table1
-  WHERE table1.key < 100
-  UNION ALL
-  SELECT table2.*
-  FROM table2
-  WHERE table2.key > 100
-  UNION ALL
-  select table3.key, table3.value
-  FROM table3
-  WHERE table3.key < 100
-) unioninput
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/dataset/TestCreateTable/table1.tbl
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/dataset/TestCreateTable/table1.tbl b/tajo-core/tajo-core-backend/src/test/resources/dataset/TestCreateTable/table1.tbl
new file mode 100644
index 0000000..8095c0b
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/dataset/TestCreateTable/table1.tbl
@@ -0,0 +1,3 @@
+1|abc|2
+2|def|5
+3|ghi|8
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testAvgDouble.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testAvgDouble.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testAvgDouble.sql
new file mode 100644
index 0000000..1c8c749
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testAvgDouble.sql
@@ -0,0 +1 @@
+select l_orderkey, avg(l_discount) as revenue from lineitem group by l_orderkey;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testAvgInt.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testAvgInt.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testAvgInt.sql
new file mode 100644
index 0000000..4983563
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testAvgInt.sql
@@ -0,0 +1 @@
+select avg(l_partkey) as total_avg from lineitem;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testAvgLong.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testAvgLong.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testAvgLong.sql
new file mode 100644
index 0000000..324c6cd
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testAvgLong.sql
@@ -0,0 +1 @@
+select avg(l_orderkey) as total_avg from lineitem;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testCount.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testCount.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testCount.sql
new file mode 100644
index 0000000..1773e38
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testCount.sql
@@ -0,0 +1 @@
+select count(*) as rownum from lineitem;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testMaxLong.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testMaxLong.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testMaxLong.sql
new file mode 100644
index 0000000..0566377
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testMaxLong.sql
@@ -0,0 +1 @@
+select max(l_orderkey) as total_max from lineitem;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testMinLong.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testMinLong.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testMinLong.sql
new file mode 100644
index 0000000..0f3cfee
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testMinLong.sql
@@ -0,0 +1 @@
+select min(l_orderkey) as total_min from lineitem;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testRandom.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testRandom.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testRandom.sql
new file mode 100644
index 0000000..9f2a456
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testRandom.sql
@@ -0,0 +1 @@
+select l_orderkey, random(3) as rndnum from lineitem group by l_orderkey, rndnum;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testSplitPart.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testSplitPart.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testSplitPart.sql
new file mode 100644
index 0000000..528d60c
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testSplitPart.sql
@@ -0,0 +1 @@
+select split_part(l_shipinstruct, ' ', 1) from lineitem;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testSplitPartByString.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testSplitPartByString.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testSplitPartByString.sql
new file mode 100644
index 0000000..cd6a664
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testSplitPartByString.sql
@@ -0,0 +1 @@
+select split_part(l_shipinstruct, 'KE', 1) from lineitem;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testSplitPartNested.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testSplitPartNested.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testSplitPartNested.sql
new file mode 100644
index 0000000..b7add04
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestBuiltinFunctions/testSplitPartNested.sql
@@ -0,0 +1 @@
+select split_part(split_part(l_shipinstruct, ' ', 1), 'A', 2) from lineitem;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestCaseByCases/testTAJO415Case.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestCaseByCases/testTAJO415Case.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCaseByCases/testTAJO415Case.sql
new file mode 100644
index 0000000..4a73b04
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCaseByCases/testTAJO415Case.sql
@@ -0,0 +1,33 @@
+select
+  c_custkey,
+  o_orderkey,
+  a.cnt
+
+from (
+
+  select
+    c_custkey,
+    count(*) as cnt
+
+  from
+    customer
+
+  group by
+    c_custkey
+
+) a left outer join (
+
+  select
+    o_orderkey,
+    count(*) as cnt
+
+  from
+    orders
+
+  where
+    o_orderkey is not null
+
+  group by
+    o_orderkey
+
+) b on (a.c_custkey = b.o_orderkey);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestCaseByCases/testTAJO418Case.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestCaseByCases/testTAJO418Case.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCaseByCases/testTAJO418Case.sql
new file mode 100644
index 0000000..b3ad48a
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCaseByCases/testTAJO418Case.sql
@@ -0,0 +1,29 @@
+SELECT
+  l_returnflag,
+  l_linestatus
+
+FROM (
+  SELECT
+    *
+  FROM
+    lineitem
+  WHERE
+    l_returnflag = 'K'
+
+  UNION ALL
+
+  SELECT
+    *
+  FROM
+    lineitem
+  WHERE
+    l_returnflag = 'R'
+) T
+
+GROUP BY
+  l_returnflag,
+	l_linestatus
+
+ORDER BY
+  l_returnflag,
+	l_linestatus
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/create_table_various_types.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/create_table_various_types.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/create_table_various_types.sql
new file mode 100644
index 0000000..92a4990
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/create_table_various_types.sql
@@ -0,0 +1,48 @@
+create table various_types (
+  col0 bit,
+  col1 BIT(10),
+  col2 bit varying,
+  col3 bit VARYING(10),
+  col4 tinyint,
+  col5 smallInt,
+  col6 integer,
+  col7 biginT,
+  col8 real,
+  col9 float,
+  col10 float(53),
+  col11 double,
+  col12 doublE precision,
+  col13 numeric,
+  col14 numeric(10),
+  col15 numeric(10,2),
+  col16 decimal,
+  col17 decimal(10),
+  col18 decimal(10,2),
+  col19 char,
+  col20 character,
+  col21 chaR(10),
+  col22 character(10),
+  col23 varchar,
+  col24 character varying,
+  col25 varchar(255),
+  col26 character varying (255),
+  col27 nchar,
+  col28 nchar(255),
+  col29 national character,
+  col30 national character(255),
+  col31 nvarchar,
+  col32 nvarchar(255),
+  col33 natIonal character varying,
+  col34 national character varying (255),
+  col35 date,
+  col36 time,
+  col37 timetz,
+  col38 time With time zone,
+  col39 timesTamptz,
+  col40 timestamp with time zone,
+  col41 binary,
+  col42 binary(10),
+  col43 varbinary(10),
+  col44 binary Varying(10),
+  col45 blOb
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/table1_ddl.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/table1_ddl.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/table1_ddl.sql
new file mode 100644
index 0000000..11ced2a
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/table1_ddl.sql
@@ -0,0 +1 @@
+CREATE EXTERNAL TABLE ${0} (id int, str text, num int) using csv location ${table.path};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testComplexParameter.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testComplexParameter.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testComplexParameter.sql
new file mode 100644
index 0000000..8d5de04
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testComplexParameter.sql
@@ -0,0 +1 @@
+select sum(l_extendedprice*l_discount) as revenue from lineitem;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testComplexParameter2.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testComplexParameter2.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testComplexParameter2.sql
new file mode 100644
index 0000000..d72dc99
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testComplexParameter2.sql
@@ -0,0 +1 @@
+select count(*) + max(l_orderkey) as merged from lineitem;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testComplexParameterWithSubQuery.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testComplexParameterWithSubQuery.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testComplexParameterWithSubQuery.sql
new file mode 100644
index 0000000..6f2c77c
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testComplexParameterWithSubQuery.sql
@@ -0,0 +1,6 @@
+select
+  count(*) as total
+from (
+  select * from lineitem
+  union all
+  select * from lineitem ) l;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testCountDistinct.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testCountDistinct.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testCountDistinct.sql
new file mode 100644
index 0000000..6fe604e
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testCountDistinct.sql
@@ -0,0 +1 @@
+select l_orderkey, max(l_orderkey) as maximum, count(distinct l_linenumber) as unique_key from lineitem group by l_orderkey;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testCountDistinct2.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testCountDistinct2.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testCountDistinct2.sql
new file mode 100644
index 0000000..6bf8a8a
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testCountDistinct2.sql
@@ -0,0 +1 @@
+select l_orderkey, count(*) as cnt, count(distinct l_linenumber) as unique_key from lineitem group by l_orderkey;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testGroupBy.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testGroupBy.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testGroupBy.sql
new file mode 100644
index 0000000..1c6751a
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testGroupBy.sql
@@ -0,0 +1 @@
+select count(1) as unique_key from lineitem;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testGroupBy2.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testGroupBy2.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testGroupBy2.sql
new file mode 100644
index 0000000..7aeab38
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testGroupBy2.sql
@@ -0,0 +1 @@
+select count(1) as unique_key from lineitem group by l_linenumber;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testGroupBy3.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testGroupBy3.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testGroupBy3.sql
new file mode 100644
index 0000000..1e97435
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testGroupBy3.sql
@@ -0,0 +1 @@
+select l_orderkey as gkey from lineitem group by gkey order by gkey;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testGroupBy4.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testGroupBy4.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testGroupBy4.sql
new file mode 100644
index 0000000..df354d4
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testGroupBy4.sql
@@ -0,0 +1 @@
+select l_orderkey as gkey, count(1) as unique_key from lineitem group by lineitem.l_orderkey;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testHavingWithAggFunction.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testHavingWithAggFunction.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testHavingWithAggFunction.sql
new file mode 100644
index 0000000..9103ffc
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testHavingWithAggFunction.sql
@@ -0,0 +1 @@
+select l_orderkey, avg(l_partkey) total, sum(l_linenumber) as num from lineitem group by l_orderkey having avg(l_partkey) = 2.5 or num = 1;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testHavingWithNamedTarget.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testHavingWithNamedTarget.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testHavingWithNamedTarget.sql
new file mode 100644
index 0000000..79467be
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testHavingWithNamedTarget.sql
@@ -0,0 +1 @@
+select l_orderkey, avg(l_partkey) total, sum(l_linenumber) as num from lineitem group by l_orderkey having total >= 2 or num = 3;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestJoinQuery/testCrossJoin.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestJoinQuery/testCrossJoin.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestJoinQuery/testCrossJoin.sql
new file mode 100644
index 0000000..5b21842
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestJoinQuery/testCrossJoin.sql
@@ -0,0 +1 @@
+select n_name, r_name, n_regionkey, r_regionkey from nation, region;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestJoinQuery/testCrossJoinWithExplicitJoinQual.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestJoinQuery/testCrossJoinWithExplicitJoinQual.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestJoinQuery/testCrossJoinWithExplicitJoinQual.sql
new file mode 100644
index 0000000..9910296
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestJoinQuery/testCrossJoinWithExplicitJoinQual.sql
@@ -0,0 +1 @@
+select n_name, r_name, n_regionkey, r_regionkey from nation, region where n_regionkey = r_regionkey;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestJoinQuery/testFullOuterJoin1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestJoinQuery/testFullOuterJoin1.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestJoinQuery/testFullOuterJoin1.sql
new file mode 100644
index 0000000..221b8a9
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestJoinQuery/testFullOuterJoin1.sql
@@ -0,0 +1 @@
+select c_custkey, orders.o_orderkey from orders full outer join customer on c_custkey = o_orderkey;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestJoinQuery/testJoinAndCaseWhen.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestJoinQuery/testJoinAndCaseWhen.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestJoinQuery/testJoinAndCaseWhen.sql
new file mode 100644
index 0000000..f22b1b3
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestJoinQuery/testJoinAndCaseWhen.sql
@@ -0,0 +1,15 @@
+select
+  r_regionkey,
+  n_regionkey,
+  case
+    when r_regionkey = 1 then 'one'
+    when r_regionkey = 2 then 'two'
+    when r_regionkey = 3 then 'three'
+    when r_regionkey = 4 then 'four'
+    else 'zero'
+  end as cond
+from
+  region,
+  nation
+where
+  r_regionkey = n_regionkey
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestJoinQuery/testJoinRefEval.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestJoinQuery/testJoinRefEval.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestJoinQuery/testJoinRefEval.sql
new file mode 100644
index 0000000..bc5f180
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestJoinQuery/testJoinRefEval.sql
@@ -0,0 +1 @@
+select r_regionkey, n_regionkey, (r_regionkey + n_regionkey) as plus from region, nation where r_regionkey = n_regionkey;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestJoinQuery/testLeftOuterJoin1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestJoinQuery/testLeftOuterJoin1.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestJoinQuery/testLeftOuterJoin1.sql
new file mode 100644
index 0000000..59a876a
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestJoinQuery/testLeftOuterJoin1.sql
@@ -0,0 +1 @@
+select c_custkey, orders.o_orderkey from customer left outer join orders on c_custkey = o_orderkey;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestJoinQuery/testRightOuterJoin1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestJoinQuery/testRightOuterJoin1.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestJoinQuery/testRightOuterJoin1.sql
new file mode 100644
index 0000000..cf9896d
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestJoinQuery/testRightOuterJoin1.sql
@@ -0,0 +1 @@
+select c_custkey, orders.o_orderkey from orders right outer join customer on c_custkey = o_orderkey;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestJoinQuery/testTPCHQ2Join.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestJoinQuery/testTPCHQ2Join.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestJoinQuery/testTPCHQ2Join.sql
new file mode 100644
index 0000000..80999d5
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestJoinQuery/testTPCHQ2Join.sql
@@ -0,0 +1,20 @@
+select
+	s_acctbal,
+	s_name,
+	n_name,
+	p_partkey,
+	p_mfgr,
+	s_address,
+	s_phone,
+	s_comment
+from
+	part,
+	supplier,
+	partsupp,
+	nation,
+	region
+where
+	p_partkey = ps_partkey
+	and s_suppkey = ps_suppkey
+	and s_nationkey = n_nationkey
+	and n_regionkey = r_regionkey

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testCaseWhen.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testCaseWhen.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testCaseWhen.sql
new file mode 100644
index 0000000..20e8190
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testCaseWhen.sql
@@ -0,0 +1,11 @@
+select
+  r_regionkey,
+  case
+    when r_regionkey = 1 then 'one'
+    when r_regionkey = 2 then 'two'
+    when r_regionkey = 3 then 'three'
+    when r_regionkey = 4 then 'four'
+    else 'zero'
+  end as cond
+from
+  region;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testCaseWhenWithoutElse.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testCaseWhenWithoutElse.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testCaseWhenWithoutElse.sql
new file mode 100644
index 0000000..279d3fd
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testCaseWhenWithoutElse.sql
@@ -0,0 +1,10 @@
+select
+  r_regionkey,
+  case
+    when r_regionkey = 1 then 10 + r_regionkey
+    when r_regionkey = 2 then 10 + r_regionkey
+    when r_regionkey = 3 then 10 + r_regionkey
+    when r_regionkey = 4 then 10 + r_regionkey
+  end as cond
+from
+  region;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testCreateAfterSelect.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testCreateAfterSelect.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testCreateAfterSelect.sql
new file mode 100644
index 0000000..2bc4be9
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testCreateAfterSelect.sql
@@ -0,0 +1 @@
+create table orderkeys as select l_orderkey from lineitem;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testInClause.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testInClause.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testInClause.sql
new file mode 100644
index 0000000..406fd31
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testInClause.sql
@@ -0,0 +1 @@
+select l_orderkey from lineitem where l_partkey in (2,3);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testInStrClause.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testInStrClause.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testInStrClause.sql
new file mode 100644
index 0000000..8a4f426
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testInStrClause.sql
@@ -0,0 +1 @@
+select l_orderkey from lineitem where l_returnflag in ('R', 'S');
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testLikeClause.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testLikeClause.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testLikeClause.sql
new file mode 100644
index 0000000..b173aa1
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testLikeClause.sql
@@ -0,0 +1 @@
+SELECT n_name FROM nation WHERE n_name LIKE '%IA';
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testLimit.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testLimit.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testLimit.sql
new file mode 100644
index 0000000..6e74de5
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testLimit.sql
@@ -0,0 +1 @@
+select l_orderkey, l_suppkey from lineitem limit 3;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testNotEqual.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testNotEqual.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testNotEqual.sql
new file mode 100644
index 0000000..ccd6a9f
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testNotEqual.sql
@@ -0,0 +1 @@
+select l_orderkey from lineitem where l_orderkey != 1;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testNotInClause.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testNotInClause.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testNotInClause.sql
new file mode 100644
index 0000000..1e9ea93
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testNotInClause.sql
@@ -0,0 +1 @@
+select l_orderkey from lineitem where l_partkey not in (2,3);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testNotInStrClause.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testNotInStrClause.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testNotInStrClause.sql
new file mode 100644
index 0000000..8e38750
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testNotInStrClause.sql
@@ -0,0 +1 @@
+select l_orderkey from lineitem where l_returnflag not in ('N', 'S');
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testRealValueCompare.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testRealValueCompare.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testRealValueCompare.sql
new file mode 100644
index 0000000..589b51b
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testRealValueCompare.sql
@@ -0,0 +1 @@
+select ps_supplycost from partsupp where ps_supplycost = 771.64;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testSelect.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testSelect.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testSelect.sql
new file mode 100644
index 0000000..0c176b7
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testSelect.sql
@@ -0,0 +1 @@
+select l_orderkey, l_partkey from lineitem;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testSelect2.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testSelect2.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testSelect2.sql
new file mode 100644
index 0000000..3bc28da
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testSelect2.sql
@@ -0,0 +1 @@
+select l_orderkey, l_partkey, l_orderkey + l_partkey as plus from lineitem;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testSelect3.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testSelect3.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testSelect3.sql
new file mode 100644
index 0000000..1c85f59
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testSelect3.sql
@@ -0,0 +1 @@
+select l_orderkey + l_partkey as plus from lineitem;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testSelectAsterik.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testSelectAsterik.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testSelectAsterik.sql
new file mode 100644
index 0000000..cda515b
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testSelectAsterik.sql
@@ -0,0 +1 @@
+select * from lineitem;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testSelectDistinct.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testSelectDistinct.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testSelectDistinct.sql
new file mode 100644
index 0000000..224e181
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testSelectDistinct.sql
@@ -0,0 +1,7 @@
+select
+  l_orderkey, l_linenumber
+from (
+  select distinct l_orderkey, l_linenumber from lineitem
+) table1
+order by
+  l_orderkey, l_linenumber;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testStringCompare.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testStringCompare.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testStringCompare.sql
new file mode 100644
index 0000000..7f4a672
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testStringCompare.sql
@@ -0,0 +1 @@
+select l_orderkey from lineitem where l_shipdate <= '1996-03-22';
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testUnion1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testUnion1.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testUnion1.sql
new file mode 100644
index 0000000..34ca8d6
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testUnion1.sql
@@ -0,0 +1,19 @@
+select
+  num
+from (
+
+select
+  o_custkey as num
+from
+  orders
+
+union
+
+select
+  c_custkey as num
+from
+  customer
+) table1
+
+order by
+  num;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testUnion2.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testUnion2.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testUnion2.sql
new file mode 100644
index 0000000..6a42488
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testUnion2.sql
@@ -0,0 +1,9 @@
+select
+  l_orderkey
+from (
+  select l_orderkey from lineitem l1
+  union
+  select l_orderkey from lineitem l2
+) table1
+
+order by l_orderkey;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testWhereCond1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testWhereCond1.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testWhereCond1.sql
new file mode 100644
index 0000000..cb44aed
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testWhereCond1.sql
@@ -0,0 +1 @@
+select l_orderkey + l_partkey as plus from lineitem where plus = 4;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testWhereCondWithAlias1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testWhereCondWithAlias1.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testWhereCondWithAlias1.sql
new file mode 100644
index 0000000..e758dfd
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testWhereCondWithAlias1.sql
@@ -0,0 +1 @@
+select l_orderkey as orderkey, l_partkey from lineitem where orderkey = 1;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testWhereCondWithAlias2.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testWhereCondWithAlias2.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testWhereCondWithAlias2.sql
new file mode 100644
index 0000000..566ea2d
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSelectQuery/testWhereCondWithAlias2.sql
@@ -0,0 +1 @@
+select l_orderkey as orderkey from lineitem where l_orderkey = 1;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestSortQuery/testSort.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestSortQuery/testSort.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSortQuery/testSort.sql
new file mode 100644
index 0000000..7958002
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSortQuery/testSort.sql
@@ -0,0 +1 @@
+select l_linenumber, l_orderkey from lineitem order by l_orderkey;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestSortQuery/testSortAfterGroupby.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestSortQuery/testSortAfterGroupby.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSortQuery/testSortAfterGroupby.sql
new file mode 100644
index 0000000..5807873
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSortQuery/testSortAfterGroupby.sql
@@ -0,0 +1 @@
+select max(l_quantity), l_orderkey from lineitem group by l_orderkey order by l_orderkey;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestSortQuery/testSortAfterGroupbyWithAlias.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestSortQuery/testSortAfterGroupbyWithAlias.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSortQuery/testSortAfterGroupbyWithAlias.sql
new file mode 100644
index 0000000..a167e76
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSortQuery/testSortAfterGroupbyWithAlias.sql
@@ -0,0 +1 @@
+select max(l_quantity) as max_quantity, l_orderkey from lineitem group by l_orderkey order by max_quantity;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestSortQuery/testSortDesc.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestSortQuery/testSortDesc.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSortQuery/testSortDesc.sql
new file mode 100644
index 0000000..4252643
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSortQuery/testSortDesc.sql
@@ -0,0 +1 @@
+select l_linenumber, l_orderkey from lineitem order by l_orderkey desc;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestSortQuery/testSortWithAliasButOriginalName.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestSortQuery/testSortWithAliasButOriginalName.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSortQuery/testSortWithAliasButOriginalName.sql
new file mode 100644
index 0000000..1d6396a
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSortQuery/testSortWithAliasButOriginalName.sql
@@ -0,0 +1 @@
+select l_linenumber, l_orderkey as sortkey from lineitem order by l_orderkey;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestSortQuery/testSortWithAliasKey.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestSortQuery/testSortWithAliasKey.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSortQuery/testSortWithAliasKey.sql
new file mode 100644
index 0000000..cd8be3e
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSortQuery/testSortWithAliasKey.sql
@@ -0,0 +1 @@
+select l_linenumber, l_orderkey as sortkey from lineitem order by sortkey;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestSortQuery/testTopK.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestSortQuery/testTopK.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSortQuery/testTopK.sql
new file mode 100644
index 0000000..331f3b4
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestSortQuery/testTopK.sql
@@ -0,0 +1 @@
+select l_orderkey, l_linenumber from lineitem order by l_orderkey desc limit 3;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestTPCH/testQ1OrderBy.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestTPCH/testQ1OrderBy.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestTPCH/testQ1OrderBy.sql
new file mode 100644
index 0000000..5864144
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestTPCH/testQ1OrderBy.sql
@@ -0,0 +1,12 @@
+select
+  l_returnflag,
+  l_linestatus,
+  count(*) as count_order
+from
+  lineitem
+group by
+  l_returnflag,
+  l_linestatus
+order by
+  l_returnflag,
+  l_linestatus;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestTPCH/testQ2FourJoins.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestTPCH/testQ2FourJoins.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestTPCH/testQ2FourJoins.sql
new file mode 100644
index 0000000..3ee34db
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestTPCH/testQ2FourJoins.sql
@@ -0,0 +1,8 @@
+select
+  s_acctbal, s_name, n_name, p_partkey, p_mfgr, s_address, s_phone, s_comment, ps_supplycost,
+  r_name, p_type, p_size
+from
+  region join nation on n_regionkey = r_regionkey and r_name = 'AMERICA'
+  join supplier on s_nationkey = n_nationkey
+  join partsupp on s_suppkey = ps_suppkey
+  join part on p_partkey = ps_partkey and p_type like '%BRASS' and p_size = 15;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestTPCH/testTPCH14Expr.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestTPCH/testTPCH14Expr.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestTPCH/testTPCH14Expr.sql
new file mode 100644
index 0000000..425f6a1
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestTPCH/testTPCH14Expr.sql
@@ -0,0 +1,7 @@
+select 100 * sum(
+  case
+    when p_type like 'PROMO%' then l_extendedprice else 0.0 end) / sum(l_extendedprice * (1 - l_discount)) as promo_revenue
+from
+  lineitem, part
+where
+  l_partkey = p_partkey;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestTableSubQuery/testGroupBySubQuery.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestTableSubQuery/testGroupBySubQuery.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestTableSubQuery/testGroupBySubQuery.sql
new file mode 100644
index 0000000..9f86886
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestTableSubQuery/testGroupBySubQuery.sql
@@ -0,0 +1 @@
+select sum(l_extendedprice * l_discount) as revenue from (select * from lineitem) as l;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestTableSubQuery/testJoinSubQuery.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestTableSubQuery/testJoinSubQuery.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestTableSubQuery/testJoinSubQuery.sql
new file mode 100644
index 0000000..5944365
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestTableSubQuery/testJoinSubQuery.sql
@@ -0,0 +1,5 @@
+SELECT
+  A.n_regionkey, B.r_regionkey, A.n_name, B.r_name
+FROM
+  (SELECT * FROM nation WHERE n_name LIKE 'A%') A
+  JOIN region B ON A.n_regionkey=B.r_regionkey;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestTableSubQuery/testJoinSubQuery2.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestTableSubQuery/testJoinSubQuery2.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestTableSubQuery/testJoinSubQuery2.sql
new file mode 100644
index 0000000..e08b8fe
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestTableSubQuery/testJoinSubQuery2.sql
@@ -0,0 +1,4 @@
+SELECT
+  A.n_regionkey, B.r_regionkey, A.n_name, B.r_name
+FROM
+  (SELECT * FROM nation WHERE n_name LIKE 'A%') A, region B WHERE A.n_regionkey=B.r_regionkey;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/TestTableSubQuery/testTableSubquery1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestTableSubQuery/testTableSubquery1.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestTableSubQuery/testTableSubquery1.sql
new file mode 100644
index 0000000..95fac4f
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestTableSubQuery/testTableSubquery1.sql
@@ -0,0 +1 @@
+select l_orderkey from (select * from lineitem) as l;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/resources/queries/default/complex_union_1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/default/complex_union_1.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/default/complex_union_1.sql
new file mode 100644
index 0000000..9020ad7
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/default/complex_union_1.sql
@@ -0,0 +1,29 @@
+create table xdr_url as
+
+SELECT
+  l_orderkey,
+  l_partkey,
+  query
+FROM
+  (
+  SELECT
+    l_orderkey,
+    l_partkey,
+    'abc' as query
+  FROM
+    lineitem
+  WHERE
+    l_orderkey = 1
+
+  UNION ALL
+
+  SELECT
+    l_orderkey,
+    l_partkey,
+    'bbc' as query
+  FROM
+    lineitem
+  WHERE
+    l_orderkey = 1
+) result
+


[5/5] git commit: TAJO-476: Add a test development kit for unit tests based on executions of queries.

Posted by hy...@apache.org.
TAJO-476: Add a test development kit for unit tests based on executions of queries.


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

Branch: refs/heads/master
Commit: eaf0a5854bf13c3b6a767af5394d4ad100e5dbe5
Parents: f825dce
Author: Hyunsik Choi <hy...@apache.org>
Authored: Tue Jan 7 11:18:59 2014 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Tue Jan 7 11:18:59 2014 +0900

----------------------------------------------------------------------
 CHANGES.txt                                     |   5 +-
 .../tajo/catalog/statistics/StatisticsUtil.java |  29 --
 .../engine/planner/global/GlobalPlanner.java    |  57 ++-
 .../join/GreedyHeuristicJoinOrderAlgorithm.java |   6 +-
 .../tajo/master/DefaultTaskScheduler.java       |   4 +-
 .../org/apache/tajo/master/GlobalEngine.java    |   3 +-
 .../apache/tajo/master/querymaster/Query.java   |   3 +-
 .../tajo/master/querymaster/Repartitioner.java  |  59 +--
 .../tajo/master/querymaster/SubQuery.java       |  14 +-
 .../java/org/apache/tajo/QueryTestCaseBase.java | 393 +++++++++++++++++
 .../org/apache/tajo/benchmark/TestTPCH.java     |  79 +---
 .../org/apache/tajo/client/TestDDLBuilder.java  |   2 +-
 .../engine/function/TestBuiltinFunctions.java   | 162 ++-----
 .../tajo/engine/parser/TestHiveConverter.java   |  80 ++--
 .../tajo/engine/parser/TestSQLAnalyzer.java     | 100 ++---
 .../tajo/engine/planner/TestLogicalPlanner.java |   2 +-
 .../tajo/engine/query/TestCaseByCases.java      |  58 +--
 .../tajo/engine/query/TestCreateTable.java      |  40 ++
 .../engine/query/TestCreateTableStatement.java  |  57 ---
 .../tajo/engine/query/TestGroupByQuery.java     | 227 ++--------
 .../apache/tajo/engine/query/TestJoinQuery.java | 197 ++-------
 .../tajo/engine/query/TestSelectQuery.java      | 426 +++----------------
 .../apache/tajo/engine/query/TestSortQuery.java | 174 ++------
 .../tajo/engine/query/TestTablePartitions.java  |   2 +-
 .../tajo/engine/query/TestTableSubQuery.java    |  90 +---
 .../apache/tajo/master/TestGlobalPlanner.java   |   9 +-
 .../src/test/queries/complex_union_1.sql        |  29 --
 .../src/test/queries/complex_union_2.sql        |  35 --
 .../create_partitioned_table_as_select.sql      |   6 -
 .../src/test/queries/create_table_1.hiveql      |   1 -
 .../src/test/queries/create_table_1.sql         |   1 -
 .../src/test/queries/create_table_10.sql        |   1 -
 .../src/test/queries/create_table_11.hiveql     |   3 -
 .../src/test/queries/create_table_11.sql        |   3 -
 .../src/test/queries/create_table_12.hiveql     |   4 -
 .../src/test/queries/create_table_12.sql        |   3 -
 .../src/test/queries/create_table_2.hiveql      |   1 -
 .../src/test/queries/create_table_2.sql         |   1 -
 .../src/test/queries/create_table_3.sql         |   1 -
 .../src/test/queries/create_table_4.sql         |   1 -
 .../src/test/queries/create_table_5.sql         |   1 -
 .../src/test/queries/create_table_6.sql         |   1 -
 .../src/test/queries/create_table_7.sql         |   1 -
 .../src/test/queries/create_table_8.sql         |  48 ---
 .../src/test/queries/create_table_9.sql         |   1 -
 .../create_table_partition_by_column.sql        |   4 -
 .../create_table_partition_by_hash_1.sql        |   3 -
 .../create_table_partition_by_hash_2.sql        |   7 -
 .../queries/create_table_partition_by_list.sql  |   8 -
 .../queries/create_table_partition_by_range.sql |   9 -
 .../test/queries/create_table_various_types.sql |  48 ---
 .../src/test/queries/drop_table.sql             |   1 -
 .../src/test/queries/exists_predicate_1.sql     |   1 -
 .../src/test/queries/exists_predicate_2.sql     |   1 -
 .../src/test/queries/groupby_1.sql              |   1 -
 .../src/test/queries/in_subquery_1.sql          |   1 -
 .../src/test/queries/in_subquery_2.sql          |   1 -
 .../src/test/queries/insert_into_select_1.sql   |   1 -
 .../src/test/queries/insert_into_select_2.sql   |   1 -
 .../src/test/queries/insert_into_select_3.sql   |   1 -
 .../queries/insert_overwrite_into_select_1.sql  |   1 -
 .../insert_overwrite_into_select_2.hiveql       |   1 -
 .../queries/insert_overwrite_into_select_2.sql  |   1 -
 .../queries/insert_overwrite_into_select_3.sql  |   1 -
 .../src/test/queries/join_1.sql                 |   1 -
 .../src/test/queries/join_10.sql                |   1 -
 .../src/test/queries/join_11.sql                |   1 -
 .../src/test/queries/join_12.sql                |   1 -
 .../src/test/queries/join_13.sql                |  13 -
 .../src/test/queries/join_14.sql                |   1 -
 .../src/test/queries/join_15.hiveql             |   1 -
 .../src/test/queries/join_15.sql                |   1 -
 .../src/test/queries/join_2.sql                 |   1 -
 .../src/test/queries/join_3.sql                 |   1 -
 .../src/test/queries/join_4.sql                 |   1 -
 .../src/test/queries/join_5.sql                 |   1 -
 .../src/test/queries/join_6.sql                 |   1 -
 .../src/test/queries/join_7.sql                 |   1 -
 .../src/test/queries/join_8.sql                 |  13 -
 .../src/test/queries/join_9.sql                 |   5 -
 .../src/test/queries/select_1.sql               |   1 -
 .../src/test/queries/select_10.hiveql           |   5 -
 .../src/test/queries/select_10.sql              |   5 -
 .../src/test/queries/select_11.hiveql           |   4 -
 .../src/test/queries/select_11.sql              |   6 -
 .../src/test/queries/select_12.hiveql           |   3 -
 .../src/test/queries/select_13.hiveql           |   2 -
 .../src/test/queries/select_13.sql              |   2 -
 .../src/test/queries/select_14.sql              |   2 -
 .../src/test/queries/select_2.sql               |   1 -
 .../src/test/queries/select_3.sql               |   1 -
 .../src/test/queries/select_4.sql               |   1 -
 .../src/test/queries/select_5.sql               |   1 -
 .../src/test/queries/select_6.sql               |   1 -
 .../src/test/queries/select_7.sql               |   1 -
 .../src/test/queries/select_8.sql               |   1 -
 .../src/test/queries/select_9.hiveql            |   4 -
 .../src/test/queries/select_9.sql               |   4 -
 .../src/test/queries/set_1.sql                  |   1 -
 .../src/test/queries/set_2.sql                  |   1 -
 .../src/test/queries/set_3.sql                  |   1 -
 .../src/test/queries/set_4.sql                  |  36 --
 .../src/test/queries/table_subquery1.sql        |  19 -
 .../src/test/queries/table_subquery2.sql        |  21 -
 .../src/test/queries/tajo415_case.sql           |  33 --
 .../src/test/queries/tajo418_case.sql           |  29 --
 .../src/test/queries/tpch_q2_simplified.sql     |  20 -
 .../src/test/queries/union_1.hiveql             |  14 -
 .../dataset/TestCreateTable/table1.tbl          |   3 +
 .../TestBuiltinFunctions/testAvgDouble.sql      |   1 +
 .../queries/TestBuiltinFunctions/testAvgInt.sql |   1 +
 .../TestBuiltinFunctions/testAvgLong.sql        |   1 +
 .../queries/TestBuiltinFunctions/testCount.sql  |   1 +
 .../TestBuiltinFunctions/testMaxLong.sql        |   1 +
 .../TestBuiltinFunctions/testMinLong.sql        |   1 +
 .../queries/TestBuiltinFunctions/testRandom.sql |   1 +
 .../TestBuiltinFunctions/testSplitPart.sql      |   1 +
 .../testSplitPartByString.sql                   |   1 +
 .../testSplitPartNested.sql                     |   1 +
 .../queries/TestCaseByCases/testTAJO415Case.sql |  33 ++
 .../queries/TestCaseByCases/testTAJO418Case.sql |  29 ++
 .../create_table_various_types.sql              |  48 +++
 .../queries/TestCreateTable/table1_ddl.sql      |   1 +
 .../TestGroupByQuery/testComplexParameter.sql   |   1 +
 .../TestGroupByQuery/testComplexParameter2.sql  |   1 +
 .../testComplexParameterWithSubQuery.sql        |   6 +
 .../TestGroupByQuery/testCountDistinct.sql      |   1 +
 .../TestGroupByQuery/testCountDistinct2.sql     |   1 +
 .../queries/TestGroupByQuery/testGroupBy.sql    |   1 +
 .../queries/TestGroupByQuery/testGroupBy2.sql   |   1 +
 .../queries/TestGroupByQuery/testGroupBy3.sql   |   1 +
 .../queries/TestGroupByQuery/testGroupBy4.sql   |   1 +
 .../testHavingWithAggFunction.sql               |   1 +
 .../testHavingWithNamedTarget.sql               |   1 +
 .../queries/TestJoinQuery/testCrossJoin.sql     |   1 +
 .../testCrossJoinWithExplicitJoinQual.sql       |   1 +
 .../TestJoinQuery/testFullOuterJoin1.sql        |   1 +
 .../TestJoinQuery/testJoinAndCaseWhen.sql       |  15 +
 .../queries/TestJoinQuery/testJoinRefEval.sql   |   1 +
 .../TestJoinQuery/testLeftOuterJoin1.sql        |   1 +
 .../TestJoinQuery/testRightOuterJoin1.sql       |   1 +
 .../queries/TestJoinQuery/testTPCHQ2Join.sql    |  20 +
 .../queries/TestSelectQuery/testCaseWhen.sql    |  11 +
 .../TestSelectQuery/testCaseWhenWithoutElse.sql |  10 +
 .../TestSelectQuery/testCreateAfterSelect.sql   |   1 +
 .../queries/TestSelectQuery/testInClause.sql    |   1 +
 .../queries/TestSelectQuery/testInStrClause.sql |   1 +
 .../queries/TestSelectQuery/testLikeClause.sql  |   1 +
 .../queries/TestSelectQuery/testLimit.sql       |   1 +
 .../queries/TestSelectQuery/testNotEqual.sql    |   1 +
 .../queries/TestSelectQuery/testNotInClause.sql |   1 +
 .../TestSelectQuery/testNotInStrClause.sql      |   1 +
 .../TestSelectQuery/testRealValueCompare.sql    |   1 +
 .../queries/TestSelectQuery/testSelect.sql      |   1 +
 .../queries/TestSelectQuery/testSelect2.sql     |   1 +
 .../queries/TestSelectQuery/testSelect3.sql     |   1 +
 .../TestSelectQuery/testSelectAsterik.sql       |   1 +
 .../TestSelectQuery/testSelectDistinct.sql      |   7 +
 .../TestSelectQuery/testStringCompare.sql       |   1 +
 .../queries/TestSelectQuery/testUnion1.sql      |  19 +
 .../queries/TestSelectQuery/testUnion2.sql      |   9 +
 .../queries/TestSelectQuery/testWhereCond1.sql  |   1 +
 .../TestSelectQuery/testWhereCondWithAlias1.sql |   1 +
 .../TestSelectQuery/testWhereCondWithAlias2.sql |   1 +
 .../queries/TestSortQuery/testSort.sql          |   1 +
 .../TestSortQuery/testSortAfterGroupby.sql      |   1 +
 .../testSortAfterGroupbyWithAlias.sql           |   1 +
 .../queries/TestSortQuery/testSortDesc.sql      |   1 +
 .../testSortWithAliasButOriginalName.sql        |   1 +
 .../TestSortQuery/testSortWithAliasKey.sql      |   1 +
 .../queries/TestSortQuery/testTopK.sql          |   1 +
 .../queries/TestTPCH/testQ1OrderBy.sql          |  12 +
 .../queries/TestTPCH/testQ2FourJoins.sql        |   8 +
 .../queries/TestTPCH/testTPCH14Expr.sql         |   7 +
 .../TestTableSubQuery/testGroupBySubQuery.sql   |   1 +
 .../TestTableSubQuery/testJoinSubQuery.sql      |   5 +
 .../TestTableSubQuery/testJoinSubQuery2.sql     |   4 +
 .../TestTableSubQuery/testTableSubquery1.sql    |   1 +
 .../queries/default/complex_union_1.sql         |  29 ++
 .../queries/default/complex_union_2.sql         |  35 ++
 .../create_partitioned_table_as_select.sql      |   6 +
 .../queries/default/create_table_1.hiveql       |   1 +
 .../queries/default/create_table_1.sql          |   1 +
 .../queries/default/create_table_10.sql         |   1 +
 .../queries/default/create_table_11.hiveql      |   3 +
 .../queries/default/create_table_11.sql         |   3 +
 .../queries/default/create_table_12.hiveql      |   4 +
 .../queries/default/create_table_12.sql         |   3 +
 .../queries/default/create_table_2.hiveql       |   1 +
 .../queries/default/create_table_2.sql          |   1 +
 .../queries/default/create_table_3.sql          |   1 +
 .../queries/default/create_table_4.sql          |   1 +
 .../queries/default/create_table_5.sql          |   1 +
 .../queries/default/create_table_6.sql          |   1 +
 .../queries/default/create_table_7.sql          |   1 +
 .../queries/default/create_table_8.sql          |  48 +++
 .../queries/default/create_table_9.sql          |   1 +
 .../create_table_partition_by_column.sql        |   4 +
 .../create_table_partition_by_hash_1.sql        |   3 +
 .../create_table_partition_by_hash_2.sql        |   7 +
 .../default/create_table_partition_by_list.sql  |   8 +
 .../default/create_table_partition_by_range.sql |   9 +
 .../resources/queries/default/drop_table.sql    |   1 +
 .../queries/default/exists_predicate_1.sql      |   1 +
 .../queries/default/exists_predicate_2.sql      |   1 +
 .../resources/queries/default/groupby_1.sql     |   1 +
 .../resources/queries/default/in_subquery_1.sql |   1 +
 .../resources/queries/default/in_subquery_2.sql |   1 +
 .../queries/default/insert_into_select_1.sql    |   1 +
 .../queries/default/insert_into_select_2.sql    |   1 +
 .../queries/default/insert_into_select_3.sql    |   1 +
 .../default/insert_overwrite_into_select_1.sql  |   1 +
 .../insert_overwrite_into_select_2.hiveql       |   1 +
 .../default/insert_overwrite_into_select_2.sql  |   1 +
 .../default/insert_overwrite_into_select_3.sql  |   1 +
 .../test/resources/queries/default/join_1.sql   |   1 +
 .../test/resources/queries/default/join_10.sql  |   1 +
 .../test/resources/queries/default/join_11.sql  |   1 +
 .../test/resources/queries/default/join_12.sql  |   1 +
 .../test/resources/queries/default/join_13.sql  |  13 +
 .../test/resources/queries/default/join_14.sql  |   1 +
 .../resources/queries/default/join_15.hiveql    |   1 +
 .../test/resources/queries/default/join_15.sql  |   1 +
 .../test/resources/queries/default/join_2.sql   |   1 +
 .../test/resources/queries/default/join_3.sql   |   1 +
 .../test/resources/queries/default/join_4.sql   |   1 +
 .../test/resources/queries/default/join_5.sql   |   1 +
 .../test/resources/queries/default/join_6.sql   |   1 +
 .../test/resources/queries/default/join_7.sql   |   1 +
 .../test/resources/queries/default/join_8.sql   |  13 +
 .../test/resources/queries/default/join_9.sql   |   5 +
 .../test/resources/queries/default/select_1.sql |   1 +
 .../resources/queries/default/select_10.hiveql  |   5 +
 .../resources/queries/default/select_10.sql     |   5 +
 .../resources/queries/default/select_11.hiveql  |   4 +
 .../resources/queries/default/select_11.sql     |   6 +
 .../resources/queries/default/select_12.hiveql  |   3 +
 .../resources/queries/default/select_13.hiveql  |   2 +
 .../resources/queries/default/select_13.sql     |   2 +
 .../resources/queries/default/select_14.sql     |   2 +
 .../test/resources/queries/default/select_2.sql |   1 +
 .../test/resources/queries/default/select_3.sql |   1 +
 .../test/resources/queries/default/select_4.sql |   1 +
 .../test/resources/queries/default/select_5.sql |   1 +
 .../test/resources/queries/default/select_6.sql |   1 +
 .../test/resources/queries/default/select_7.sql |   1 +
 .../test/resources/queries/default/select_8.sql |   1 +
 .../resources/queries/default/select_9.hiveql   |   4 +
 .../test/resources/queries/default/select_9.sql |   4 +
 .../test/resources/queries/default/set_1.sql    |   1 +
 .../test/resources/queries/default/set_2.sql    |   1 +
 .../test/resources/queries/default/set_3.sql    |   1 +
 .../test/resources/queries/default/set_4.sql    |  36 ++
 .../queries/default/table_subquery1.sql         |  19 +
 .../queries/default/table_subquery2.sql         |  21 +
 .../resources/queries/default/union_1.hiveql    |  14 +
 .../TestBuiltinFunctions/testAvgDouble.result   |   5 +
 .../TestBuiltinFunctions/testAvgInt.result      |   3 +
 .../TestBuiltinFunctions/testAvgLong.result     |   3 +
 .../TestBuiltinFunctions/testCount.result       |   3 +
 .../TestBuiltinFunctions/testMaxLong.result     |   3 +
 .../TestBuiltinFunctions/testMinLong.result     |   3 +
 .../TestBuiltinFunctions/testRandom.result      |   1 +
 .../TestBuiltinFunctions/testSplitPart.result   |   7 +
 .../testSplitPartByString.result                |   7 +
 .../testSplitPartNested.result                  |   7 +
 .../TestCaseByCases/testTAJO415Case.result      |   7 +
 .../TestCaseByCases/testTAJO418Case.result      |   3 +
 .../testComplexParameter.result                 |   3 +
 .../testComplexParameter2.result                |   3 +
 .../testComplexParameterWithSubQuery.result     |   3 +
 .../TestGroupByQuery/testCountDistinct.result   |   5 +
 .../TestGroupByQuery/testCountDistinct2.result  |   5 +
 .../results/TestGroupByQuery/testGroupBy.result |   3 +
 .../TestGroupByQuery/testGroupBy2.result        |   4 +
 .../TestGroupByQuery/testGroupBy3.result        |   5 +
 .../TestGroupByQuery/testGroupBy4.result        |   5 +
 .../testHavingWithAggFunction.result            |   4 +
 .../testHavingWithNamedTarget.result            |   5 +
 .../results/TestJoinQuery/testCrossJoin.result  | 127 ++++++
 .../testCrossJoinWithExplicitJoinQual.result    |  27 ++
 .../TestJoinQuery/testFullOuterJoin1.result     |   7 +
 .../TestJoinQuery/testJoinAndCaseWhen.result    |  27 ++
 .../TestJoinQuery/testJoinRefEval.result        |  27 ++
 .../TestJoinQuery/testLeftOuterJoin1.result     |   7 +
 .../TestJoinQuery/testRightOuterJoin1.result    |   7 +
 .../results/TestJoinQuery/testTPCHQ2Join.result |   5 +
 .../results/TestSelectQuery/testCaseWhen.result |   7 +
 .../testCaseWhenWithoutElse.result              |   7 +
 .../results/TestSelectQuery/testInClause.result |   5 +
 .../TestSelectQuery/testInStrClause.result      |   4 +
 .../TestSelectQuery/testLikeClause.result       |   9 +
 .../results/TestSelectQuery/testLimit.result    |   5 +
 .../results/TestSelectQuery/testNotEqual.result |   5 +
 .../TestSelectQuery/testNotInClause.result      |   4 +
 .../TestSelectQuery/testNotInStrClause.result   |   4 +
 .../TestSelectQuery/testRealValueCompare.result |   3 +
 .../results/TestSelectQuery/testSelect.result   |   7 +
 .../results/TestSelectQuery/testSelect2.result  |   7 +
 .../results/TestSelectQuery/testSelect3.result  |   7 +
 .../TestSelectQuery/testSelectAsterik.result    |   7 +
 .../TestSelectQuery/testSelectDistinct.result   |   7 +
 .../TestSelectQuery/testStringCompare.result    |   5 +
 .../results/TestSelectQuery/testUnion1.result   |  10 +
 .../results/TestSelectQuery/testUnion2.result   |  12 +
 .../TestSelectQuery/testWhereCond1.result       |   3 +
 .../testWhereCondWithAlias1.result              |   4 +
 .../testWhereCondWithAlias2.result              |   4 +
 .../results/TestSortQuery/testSort.result       |   7 +
 .../TestSortQuery/testSortAfterGroupby.result   |   5 +
 .../testSortAfterGroupbyWithAlias.result        |   5 +
 .../results/TestSortQuery/testSortDesc.result   |   7 +
 .../testSortWithAliasButOriginalName.result     |   7 +
 .../TestSortQuery/testSortWithAliasKey.result   |   7 +
 .../results/TestSortQuery/testTopK.result       |   5 +
 .../results/TestTPCH/testQ1OrderBy.result       |   4 +
 .../results/TestTPCH/testQ2FourJoins.result     |   3 +
 .../results/TestTPCH/testTPCH14Expr.result      |   3 +
 .../testGroupBySubQuery.result                  |   3 +
 .../TestTableSubQuery/testJoinSubQuery.result   |   4 +
 .../TestTableSubQuery/testJoinSubQuery2.result  |   4 +
 .../TestTableSubQuery/testTableSubquery1.result |   7 +
 .../test/resources/results/testBuildDDL.result  |   5 +
 .../src/test/results/testBuildDDL.result        |   5 -
 324 files changed, 2039 insertions(+), 1942 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 169be3f..1efed2c 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -110,7 +110,10 @@ Release 0.8.0 - unreleased
 
   IMPROVEMENTS
 
-    TAJO-464: Rename the name 'partition', actually meaning shuffle to 
+    TAJO-476: Add a test development kit for unit tests based on executions
+    of queries. (hyunsik)
+
+    TAJO-464: Rename the name 'partition', actually meaning shuffle to
     'shuffle'. (hyunsik)
 
     TAJO-385: Refactoring TaskScheduler to assign multiple fragments. (jihoon)

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/statistics/StatisticsUtil.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/statistics/StatisticsUtil.java b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/statistics/StatisticsUtil.java
index 8e411b5..b836818 100644
--- a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/statistics/StatisticsUtil.java
+++ b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/statistics/StatisticsUtil.java
@@ -22,8 +22,6 @@ import com.google.common.collect.Lists;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import java.util.Collection;
-import java.util.Iterator;
 import java.util.List;
 
 public class StatisticsUtil {
@@ -102,31 +100,4 @@ public class StatisticsUtil {
 
     return aggregated;
   }
-
-  public static TableStats computeStatFromUnionBlock(Collection<TableStats> stats) {
-    TableStats stat = new TableStats();
-    TableStats childStat;
-    long avgRows = 0, numBytes = 0, numRows = 0;
-    int numBlocks = 0, numPartitions = 0;
-    List<ColumnStats> columnStatses = Lists.newArrayList();
-
-    Iterator<TableStats> it = stats.iterator();
-    while (it.hasNext()) {
-      childStat = it.next();
-      avgRows += childStat.getAvgRows();
-      columnStatses.addAll(childStat.getColumnStats());
-      numBlocks += childStat.getNumBlocks();
-      numBytes += childStat.getNumBytes();
-      numPartitions += childStat.getNumShuffleOutputs();
-      numRows += childStat.getNumRows();
-    }
-
-    stat.setColumnStats(columnStatses);
-    stat.setNumBlocks(numBlocks);
-    stat.setNumBytes(numBytes);
-    stat.setNumShuffleOutputs(numPartitions);
-    stat.setNumRows(numRows);
-    stat.setAvgRows(avgRows);
-    return stat;
-  }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/global/GlobalPlanner.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/global/GlobalPlanner.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/global/GlobalPlanner.java
index 2b3ecea..d05ac46 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/global/GlobalPlanner.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/global/GlobalPlanner.java
@@ -314,24 +314,44 @@ public class GlobalPlanner {
     ExecutionBlock currentBlock;
 
     SortNode firstSortNode = PlannerUtil.clone(context.plan.getLogicalPlan(), currentNode);
-    LogicalNode childBlockPlan = childBlock.getPlan();
-    firstSortNode.setChild(childBlockPlan);
-    // sort is a non-projectable operator. So, in/out schemas are the same to its child operator.
-    firstSortNode.setInSchema(childBlockPlan.getOutSchema());
-    firstSortNode.setOutSchema(childBlockPlan.getOutSchema());
-    childBlock.setPlan(firstSortNode);
 
-    currentBlock = masterPlan.newExecutionBlock();
-    DataChannel channel = new DataChannel(childBlock, currentBlock, RANGE_SHUFFLE, 32);
-    channel.setShuffleKeys(PlannerUtil.sortSpecsToSchema(currentNode.getSortKeys()).toArray());
-    channel.setSchema(firstSortNode.getOutSchema());
-    channel.setStoreType(storeType);
+    if (firstSortNode.getChild().getType() == NodeType.TABLE_SUBQUERY &&
+        ((TableSubQueryNode)firstSortNode.getChild()).getSubQuery().getType() == NodeType.UNION) {
 
-    ScanNode secondScan = buildInputExecutor(masterPlan.getLogicalPlan(), channel);
-    currentNode.setChild(secondScan);
-    currentNode.setInSchema(secondScan.getOutSchema());
-    currentBlock.setPlan(currentNode);
-    masterPlan.addConnect(channel);
+      currentBlock = childBlock;
+      for (DataChannel channel : masterPlan.getIncomingChannels(childBlock.getId())) {
+        channel.setShuffle(RANGE_SHUFFLE, PlannerUtil.sortSpecsToSchema(currentNode.getSortKeys()).toArray(), 32);
+        channel.setSchema(firstSortNode.getOutSchema());
+
+        ExecutionBlock subBlock = masterPlan.getExecBlock(channel.getSrcId());
+        SortNode s1 = PlannerUtil.clone(context.plan.getLogicalPlan(), firstSortNode);
+        s1.setChild(subBlock.getPlan());
+        subBlock.setPlan(s1);
+
+        ScanNode secondScan = buildInputExecutor(masterPlan.getLogicalPlan(), channel);
+        currentNode.setChild(secondScan);
+        currentNode.setInSchema(secondScan.getOutSchema());
+        currentBlock.setPlan(currentNode);
+      }
+    } else {
+      LogicalNode childBlockPlan = childBlock.getPlan();
+      firstSortNode.setChild(childBlockPlan);
+      // sort is a non-projectable operator. So, in/out schemas are the same to its child operator.
+      firstSortNode.setInSchema(childBlockPlan.getOutSchema());
+      firstSortNode.setOutSchema(childBlockPlan.getOutSchema());
+      childBlock.setPlan(firstSortNode);
+
+      currentBlock = masterPlan.newExecutionBlock();
+      DataChannel channel = new DataChannel(childBlock, currentBlock, RANGE_SHUFFLE, 32);
+      channel.setShuffleKeys(PlannerUtil.sortSpecsToSchema(currentNode.getSortKeys()).toArray());
+      channel.setSchema(firstSortNode.getOutSchema());
+
+      ScanNode secondScan = buildInputExecutor(masterPlan.getLogicalPlan(), channel);
+      currentNode.setChild(secondScan);
+      currentNode.setInSchema(secondScan.getOutSchema());
+      currentBlock.setPlan(currentNode);
+      masterPlan.addConnect(channel);
+    }
 
     return currentBlock;
   }
@@ -360,7 +380,7 @@ public class GlobalPlanner {
     // 2. create a new execution block, pipeline 2 exec blocks through a DataChannel
     MasterPlan masterPlan = context.plan;
     ExecutionBlock currentBlock = masterPlan.newExecutionBlock();
-    DataChannel channel = null;
+    DataChannel channel;
     CatalogProtos.PartitionsType partitionsType = partitionDesc.getPartitionsType();
     if(partitionsType == CatalogProtos.PartitionsType.COLUMN) {
       channel = new DataChannel(childBlock, currentBlock, HASH_SHUFFLE, 32);
@@ -389,8 +409,7 @@ public class GlobalPlanner {
     @Override
     public LogicalNode visitRoot(GlobalPlanContext context, LogicalPlan plan, LogicalPlan.QueryBlock block,
                                  LogicalRootNode node, Stack<LogicalNode> stack) throws PlanningException {
-      LogicalNode child = super.visitRoot(context, plan, block, node, stack);
-      return child;
+      return super.visitRoot(context, plan, block, node, stack);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/join/GreedyHeuristicJoinOrderAlgorithm.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/join/GreedyHeuristicJoinOrderAlgorithm.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/join/GreedyHeuristicJoinOrderAlgorithm.java
index cbdad1a..1b2e4d9 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/join/GreedyHeuristicJoinOrderAlgorithm.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/join/GreedyHeuristicJoinOrderAlgorithm.java
@@ -27,7 +27,7 @@ import org.apache.tajo.engine.planner.PlanningException;
 import org.apache.tajo.engine.planner.logical.*;
 import org.apache.tajo.engine.utils.SchemaUtil;
 
-import java.util.HashSet;
+import java.util.LinkedHashSet;
 import java.util.Set;
 
 /**
@@ -43,7 +43,9 @@ public class GreedyHeuristicJoinOrderAlgorithm implements JoinOrderAlgorithm {
                                       Set<String> relationsWithoutQual) throws PlanningException {
 
     // Setup a remain relation set to be joined
-    Set<LogicalNode> remainRelations = new HashSet<LogicalNode>();
+    // Why we should use LinkedHashSet? - it should keep the deterministic for the order of joins.
+    // Otherwise, join orders can be different even if join costs are the same to each other.
+    Set<LogicalNode> remainRelations = new LinkedHashSet<LogicalNode>();
     for (RelationNode relation : block.getRelations()) {
       remainRelations.add(relation);
     }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/DefaultTaskScheduler.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/DefaultTaskScheduler.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/DefaultTaskScheduler.java
index 5c986ec..82788fd 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/DefaultTaskScheduler.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/DefaultTaskScheduler.java
@@ -126,7 +126,9 @@ public class DefaultTaskScheduler extends AbstractTaskScheduler {
   @Override
   public void stop() {
     stopEventHandling = true;
-    schedulingThread.interrupt();
+    if (schedulingThread != null) {
+      schedulingThread.interrupt();
+    }
 
     // Return all of request callbacks instantly.
     for (TaskRequestEvent req : taskRequests.taskRequestQueue) {

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/GlobalEngine.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/GlobalEngine.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/GlobalEngine.java
index 7336f2f..ed7828e 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/GlobalEngine.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/GlobalEngine.java
@@ -276,6 +276,7 @@ public class GlobalEngine extends AbstractService {
     }
 
     if(!fs.exists(path)) {
+      LOG.error("ERROR: " + path.toUri() + " does not exist");
       throw new IOException("ERROR: " + path.toUri() + " does not exist");
     }
 
@@ -284,7 +285,7 @@ public class GlobalEngine extends AbstractService {
     try {
       totalSize = sm.calculateSize(path);
     } catch (IOException e) {
-      LOG.error("Cannot calculate the size of the relation", e);
+      LOG.warn("Cannot calculate the size of the relation", e);
     }
 
     TableStats stats = new TableStats();

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/Query.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/Query.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/Query.java
index f8c335b..22c3a35 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/Query.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/Query.java
@@ -307,8 +307,7 @@ public class Query implements EventHandler<QueryEvent> {
           SubQuery nextSubQuery = new SubQuery(query.context, query.getPlan(), nextBlock, query.sm);
           nextSubQuery.setPriority(query.priority--);
           query.addSubQuery(nextSubQuery);
-          nextSubQuery.handle(new SubQueryEvent(nextSubQuery.getId(),
-              SubQueryEventType.SQ_INIT));
+          nextSubQuery.handle(new SubQueryEvent(nextSubQuery.getId(), SubQueryEventType.SQ_INIT));
           LOG.info("Scheduling SubQuery:" + nextSubQuery.getId());
           if(LOG.isDebugEnabled()) {
             LOG.debug("Scheduling SubQuery's Priority: " + nextSubQuery.getPriority());

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/Repartitioner.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/Repartitioner.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/Repartitioner.java
index 2eed5d8..0f4a62b 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/Repartitioner.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/Repartitioner.java
@@ -252,37 +252,45 @@ public class Repartitioner {
   }
 
   public static void scheduleFragmentsForNonLeafTasks(TaskSchedulerContext schedulerContext,
-                                                      MasterPlan masterPlan, SubQuery subQuery, SubQuery childSubQuery,
-                                                      DataChannel channel, int maxNum)
+                                                      MasterPlan masterPlan, SubQuery subQuery, int maxNum)
       throws InternalException {
+    DataChannel channel = masterPlan.getIncomingChannels(subQuery.getBlock().getId()).get(0);
     if (channel.getShuffleType() == HASH_SHUFFLE) {
       scheduleHashShuffledFetches(schedulerContext, masterPlan, subQuery, channel, maxNum);
     } else if (channel.getShuffleType() == RANGE_SHUFFLE) {
-      scheduleRangeShuffledFetches(schedulerContext, subQuery, childSubQuery, channel, maxNum);
+      scheduleRangeShuffledFetches(schedulerContext, masterPlan, subQuery, channel, maxNum);
     } else {
       throw new InternalException("Cannot support partition type");
     }
   }
 
-  public static void scheduleRangeShuffledFetches(TaskSchedulerContext schedulerContext, SubQuery subQuery,
-                                                  SubQuery childSubQuery, DataChannel channel, int maxNum)
-      throws InternalException {
-    ExecutionBlock execBlock = subQuery.getBlock();
-    TableStats stat = childSubQuery.getTableStat();
-    if (stat.getNumRows() == 0) {
-      return;
+  private static TableStats computeChildBlocksStats(QueryMasterTask.QueryMasterTaskContext context, MasterPlan masterPlan,
+                                                    ExecutionBlockId parentBlockId) {
+    List<TableStats> tableStatses = new ArrayList<TableStats>();
+    List<ExecutionBlock> childBlocks = masterPlan.getChilds(parentBlockId);
+    for (ExecutionBlock childBlock : childBlocks) {
+      SubQuery childExecSM = context.getSubQuery(childBlock.getId());
+      tableStatses.add(childExecSM.getTableStat());
     }
+    return StatisticsUtil.aggregateTableStat(tableStatses);
+  }
 
+  public static void scheduleRangeShuffledFetches(TaskSchedulerContext schedulerContext, MasterPlan masterPlan,
+                                                  SubQuery subQuery, DataChannel channel, int maxNum)
+      throws InternalException {
+    ExecutionBlock execBlock = subQuery.getBlock();
     ScanNode scan = execBlock.getScanNodes()[0];
     Path tablePath;
     tablePath = subQuery.getContext().getStorageManager().getTablePath(scan.getTableName());
 
-    SortNode sortNode = PlannerUtil.findTopNode(childSubQuery.getBlock().getPlan(), NodeType.SORT);
+    ExecutionBlock sampleChildBlock = masterPlan.getChild(subQuery.getId(), 0);
+    SortNode sortNode = PlannerUtil.findTopNode(sampleChildBlock.getPlan(), NodeType.SORT);
     SortSpec [] sortSpecs = sortNode.getSortKeys();
     Schema sortSchema = new Schema(channel.getShuffleKeys());
 
     // calculate the number of maximum query ranges
-    TupleRange mergedRange = TupleUtil.columnStatToRange(channel.getSchema(), sortSchema, stat.getColumnStats());
+    TableStats totalStat = computeChildBlocksStats(subQuery.getContext(), masterPlan, subQuery.getId());
+    TupleRange mergedRange = TupleUtil.columnStatToRange(channel.getSchema(), sortSchema, totalStat.getColumnStats());
     RangePartitionAlgorithm partitioner = new UniformRangePartition(sortSchema, mergedRange);
     BigDecimal card = partitioner.getTotalCardinality();
 
@@ -305,12 +313,14 @@ public class Repartitioner {
     SubQuery.scheduleFragment(subQuery, dummyFragment);
 
     List<String> basicFetchURIs = new ArrayList<String>();
-
-    for (QueryUnit qu : childSubQuery.getQueryUnits()) {
-      for (IntermediateEntry p : qu.getIntermediateData()) {
-        String uri = createBasicFetchUri(p.getPullHost(), p.getPullPort(),
-            childSubQuery.getId(), p.taskId, p.attemptId);
-        basicFetchURIs.add(uri);
+    List<ExecutionBlock> childBlocks = masterPlan.getChilds(subQuery.getId());
+    for (ExecutionBlock childBlock : childBlocks) {
+      SubQuery childExecSM = subQuery.getContext().getSubQuery(childBlock.getId());
+      for (QueryUnit qu : childExecSM.getQueryUnits()) {
+        for (IntermediateEntry p : qu.getIntermediateData()) {
+          String uri = createBasicFetchUri(p.getPullHost(), p.getPullPort(), childBlock.getId(), p.taskId, p.attemptId);
+          basicFetchURIs.add(uri);
+        }
       }
     }
 
@@ -345,7 +355,7 @@ public class Repartitioner {
   }
 
   public static void scheduleFetchesByRoundRobin(SubQuery subQuery, Map<?, Set<URI>> partitions,
-                                                 String tableName, int num) {
+                                                   String tableName, int num) {
     int i;
     Map<String, List<URI>>[] fetchesArray = new Map[num];
     for (i = 0; i < num; i++) {
@@ -381,14 +391,7 @@ public class Repartitioner {
                                                  SubQuery subQuery, DataChannel channel,
                                                  int maxNum) {
     ExecutionBlock execBlock = subQuery.getBlock();
-
-    List<TableStats> tableStatses = new ArrayList<TableStats>();
-    List<ExecutionBlock> childBlocks = masterPlan.getChilds(subQuery.getId());
-    for (ExecutionBlock childBlock : childBlocks) {
-      SubQuery childExecSM = subQuery.getContext().getSubQuery(childBlock.getId());
-      tableStatses.add(childExecSM.getTableStat());
-    }
-    TableStats totalStat = StatisticsUtil.computeStatFromUnionBlock(tableStatses);
+    TableStats totalStat = computeChildBlocksStats(subQuery.getContext(), masterPlan, subQuery.getId());
 
     if (totalStat.getNumRows() == 0) {
       return;
@@ -406,7 +409,7 @@ public class Repartitioner {
     Map<String, List<IntermediateEntry>> hashedByHost;
     Map<Integer, List<URI>> finalFetchURI = new HashMap<Integer, List<URI>>();
 
-    for (ExecutionBlock block : childBlocks) {
+    for (ExecutionBlock block : masterPlan.getChilds(execBlock)) {
       List<IntermediateEntry> partitions = new ArrayList<IntermediateEntry>();
       for (QueryUnit tasks : subQuery.getContext().getSubQuery(block.getId()).getQueryUnits()) {
         if (tasks.getIntermediateData() != null) {

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/SubQuery.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/SubQuery.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/SubQuery.java
index 3e44959..91c403d 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/SubQuery.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/SubQuery.java
@@ -27,6 +27,7 @@ import org.apache.hadoop.yarn.api.records.Container;
 import org.apache.hadoop.yarn.api.records.ContainerId;
 import org.apache.hadoop.yarn.api.records.Priority;
 import org.apache.hadoop.yarn.api.records.Resource;
+import org.apache.hadoop.yarn.event.Event;
 import org.apache.hadoop.yarn.event.EventHandler;
 import org.apache.hadoop.yarn.state.*;
 import org.apache.hadoop.yarn.util.Records;
@@ -77,7 +78,7 @@ public class SubQuery implements EventHandler<SubQueryEvent> {
   private Schema schema;
   private TableMeta meta;
   private TableStats statistics;
-  private EventHandler eventHandler;
+  private EventHandler<Event> eventHandler;
   private final AbstractStorageManager sm;
   private AbstractTaskScheduler taskScheduler;
   private QueryMasterTask.QueryMasterTaskContext context;
@@ -233,7 +234,7 @@ public class SubQuery implements EventHandler<SubQueryEvent> {
     return masterPlan.getOutgoingChannels(getId()).iterator().next();
   }
 
-  public EventHandler getEventHandler() {
+  public EventHandler<Event> getEventHandler() {
     return eventHandler;
   }
 
@@ -666,11 +667,10 @@ public class SubQuery implements EventHandler<SubQueryEvent> {
         Repartitioner.scheduleFragmentsForJoinQuery(subQuery.schedulerContext, subQuery);
       } else { // Case 3: Others (Sort or Aggregation)
         int numTasks = getNonLeafTaskNum(subQuery);
-        ExecutionBlockId childId = masterPlan.getChilds(subQuery.getBlock()).get(0).getId();
-        SubQuery child = subQuery.context.getSubQuery(childId);
-        DataChannel channel = masterPlan.getChannel(child.getId(), subQuery.getId());
-        Repartitioner.scheduleFragmentsForNonLeafTasks(subQuery.schedulerContext, masterPlan, subQuery, child,
-            channel, numTasks);
+//        ExecutionBlockId childId = masterPlan.getChilds(subQuery.getBlock()).get(0).getId();
+//        SubQuery child = subQuery.context.getSubQuery(childId);
+//        DataChannel channel = masterPlan.getChannel(child.getId(), subQuery.getId());
+        Repartitioner.scheduleFragmentsForNonLeafTasks(subQuery.schedulerContext, masterPlan, subQuery, numTasks);
       }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/QueryTestCaseBase.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/QueryTestCaseBase.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/QueryTestCaseBase.java
new file mode 100644
index 0000000..fd280c7
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/QueryTestCaseBase.java
@@ -0,0 +1,393 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo;
+
+import com.google.protobuf.ServiceException;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.tajo.algebra.CreateTable;
+import org.apache.tajo.algebra.DropTable;
+import org.apache.tajo.algebra.Expr;
+import org.apache.tajo.algebra.OpType;
+import org.apache.tajo.client.TajoClient;
+import org.apache.tajo.conf.TajoConf;
+import org.apache.tajo.engine.parser.SQLAnalyzer;
+import org.apache.tajo.storage.StorageUtil;
+import org.apache.tajo.util.FileUtil;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.rules.TestName;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.util.HashSet;
+import java.util.Set;
+
+import static org.junit.Assert.*;
+
+/**
+ * (Note that this class is not thread safe. Do not execute maven test in any parallel mode.)
+ * <br />
+ * <code>QueryTestCaseBase</code> provides useful methods to easily execute queries and verify their results.
+ *
+ * This class basically uses four resource directories:
+ * <ul>
+ *   <li>src/test/resources/dataset - contains a set of data files. It contains sub directories, each of which
+ *   corresponds each test class. All data files in each sub directory can be used in the corresponding test class.</li>
+ *
+ *   <li>src/test/resources/queries - This is the query directory. It contains sub directories, each of which
+ *   corresponds each test class. All query files in each sub directory can be used in the corresponding test
+ *   class.</li>
+ *
+ *   <li>src/test/resources/results - This is the result directory. It contains sub directories, each of which
+ *   corresponds each test class. All result files in each sub directory can be used in the corresponding test class.
+ *   </li>
+ * </ul>
+ *
+ * For example, if you create a test class named <code>TestJoinQuery</code>, you should create a pair of query and
+ * result set directories as follows:
+ *
+ * <pre>
+ *   src-|
+ *       |- resources
+ *             |- dataset
+ *             |     |- TestJoinQuery
+ *             |              |- table1.tbl
+ *             |              |- table2.tbl
+ *             |
+ *             |- queries
+ *             |     |- TestJoinQuery
+ *             |              |- TestInnerJoin.sql
+ *             |              |- table1_ddl.sql
+ *             |              |- table2_ddl.sql
+ *             |
+ *             |- results
+ *                   |- TestJoinQuery
+ *                            |- TestInnerJoin.result
+ * </pre>
+ *
+ * <code>QueryTestCaseBase</code> basically provides the following methods:
+ * <ul>
+ *  <li><code>{@link #executeQuery()}</code> - executes a corresponding query and returns an ResultSet instance</li>
+ *  <li><code>{@link #executeQuery(String)}</code> - executes a given query file included in the corresponding query
+ *  file in the current class's query directory</li>
+ *  <li><code>assertResultSet()</code> - check if the query result is equivalent to the expected result included
+ *  in the corresponding result file in the current class's result directory.</li>
+ *  <li><code>cleanQuery()</code> - clean up all resources</li>
+ *  <li><code>executeDDL()</code> - execute a DDL query like create or drop table.</li>
+ * </ul>
+ *
+ * In order to make use of the above methods, query files and results file must be as follows:
+ * <ul>
+ *  <li>Each query file must be located on the subdirectory whose structure must be src/resources/queries/${ClassName},
+ *  where ${ClassName} indicates an actual test class's simple name.</li>
+ *  <li>Each result file must be located on the subdirectory whose structure must be src/resources/results/${ClassName},
+ *  where ${ClassName} indicates an actual test class's simple name.</li>
+ * </ul>
+ *
+ * Especially, {@link #executeQuery() and {@link #assertResultSet(java.sql.ResultSet)} methods automatically finds
+ * a query file to be executed and a result to be compared, which are corresponding to the running class and method.
+ * For them, query and result files additionally must be follows as:
+ * <ul>
+ *  <li>Each result file must have the file extension '.result'</li>
+ *  <li>Each query file must have the file extension '.sql'.</li>
+ * </ul>
+ */
+public class QueryTestCaseBase {
+
+  protected static final TpchTestBase testingCluster;
+  protected static TajoConf conf;
+  protected static TajoClient client;
+  protected static SQLAnalyzer sqlParser = new SQLAnalyzer();
+
+  /** the base path of dataset directories */
+  protected static final Path datasetBasePath;
+  /** the base path of query directories */
+  protected static final Path queryBasePath;
+  /** the base path of result directories */
+  protected static final Path resultBasePath;
+
+  static {
+    testingCluster = TpchTestBase.getInstance();
+    conf = testingCluster.getTestingCluster().getConfiguration();
+    URL datasetBaseURL = ClassLoader.getSystemResource("dataset");
+    datasetBasePath = new Path(datasetBaseURL.toString());
+    URL queryBaseURL = ClassLoader.getSystemResource("queries");
+    queryBasePath = new Path(queryBaseURL.toString());
+    URL resultBaseURL = ClassLoader.getSystemResource("results");
+    resultBasePath = new Path(resultBaseURL.toString());
+  }
+
+  /** It transiently contains created tables for the running test class. */
+  private static Set<String> createdTableSet = new HashSet<String>();
+  // queries and results directory corresponding to subclass class.
+  private Path currentQueryPath;
+  private Path currentResultPath;
+  private Path currentDatasetPath;
+
+  // for getting a method name
+  @Rule public TestName name= new TestName();
+
+  @BeforeClass
+  public static void setUpClass() throws IOException {
+    conf = testingCluster.getTestingCluster().getConfiguration();
+    client = new TajoClient(conf);
+  }
+
+  @AfterClass
+  public static void tearDownClass() throws ServiceException {
+    for (String tableName : createdTableSet) {
+      client.dropTable(tableName, false);
+    }
+    createdTableSet.clear();
+    client.close();
+  }
+
+  @Before
+  public void setUp() {
+    String className = getClass().getSimpleName();
+    currentQueryPath = new Path(queryBasePath, className);
+    currentResultPath = new Path(resultBasePath, className);
+    currentDatasetPath = new Path(datasetBasePath, className);
+  }
+
+  /**
+   * Execute a query contained in the file located in src/test/resources/results/<i>ClassName</i>/<i>MethodName</i>.
+   * <i>ClassName</i> and <i>MethodName</i> will be replaced by actual executed class and methods.
+   *
+   * @return ResultSet of query execution.
+   */
+  public ResultSet executeQuery() throws Exception {
+    return executeQuery(name.getMethodName() + ".sql");
+  }
+
+  /**
+   * Execute a query contained in the given named file. This methods tries to find the given file within the directory
+   * src/test/resources/results/<i>ClassName</i>.
+   *
+   * @param queryFileName The file name to be used to execute a query.
+   * @return ResultSet of query execution.
+   */
+  public ResultSet executeQuery(String queryFileName) throws Exception {
+    Path queryFilePath = getQueryFilePath(queryFileName);
+    FileSystem fs = currentQueryPath.getFileSystem(testingCluster.getTestingCluster().getConfiguration());
+    assertTrue(queryFilePath.toString() + " existence check", fs.exists(queryFilePath));
+    ResultSet result = testingCluster.execute(FileUtil.readTextFile(new File(queryFilePath.toUri())));
+    assertNotNull("Query succeeded test", result);
+    return result;
+  }
+
+  /**
+   * Assert the equivalence between the expected result and an actual query result.
+   * If it isn't it throws an AssertionError.
+   *
+   * @param result Query result to be compared.
+   */
+  public final void assertResultSet(ResultSet result) throws IOException {
+    assertResultSet("Result Verification", result, name.getMethodName() + ".result");
+  }
+
+  /**
+   * Assert the equivalence between the expected result and an actual query result.
+   * If it isn't it throws an AssertionError.
+   *
+   * @param result Query result to be compared.
+   * @param resultFileName The file name containing the result to be compared
+   */
+  public final void assertResultSet(ResultSet result, String resultFileName) throws IOException {
+    assertResultSet("Result Verification", result, resultFileName);
+  }
+
+  /**
+   * Assert the equivalence between the expected result and an actual query result.
+   * If it isn't it throws an AssertionError with the given message.
+   *
+   * @param message message The message to printed if the assertion is failed.
+   * @param result Query result to be compared.
+   */
+  public final void assertResultSet(String message, ResultSet result, String resultFileName) throws IOException {
+    FileSystem fs = currentQueryPath.getFileSystem(testingCluster.getTestingCluster().getConfiguration());
+    Path resultFile = getResultFile(resultFileName);
+    assertTrue(resultFile.toString() + " existence check", fs.exists(resultFile));
+    try {
+      verifyResult(message, result, resultFile);
+    } catch (SQLException e) {
+      throw new IOException(e);
+    }
+  }
+
+  /**
+   * Release all resources
+   *
+   * @param resultSet ResultSet
+   */
+  public final void cleanupQuery(ResultSet resultSet) throws IOException {
+    try {
+      resultSet.close();
+    } catch (SQLException e) {
+      throw new IOException(e);
+    }
+  }
+
+  public void assertTableExists(String tableName) throws ServiceException {
+    assertTrue(client.existTable(tableName));
+  }
+
+  /**
+   * It transforms a ResultSet instance to rows represented as strings.
+   *
+   * @param resultSet ResultSet that contains a query result
+   * @return String
+   * @throws SQLException
+   */
+  public String resultSetToString(ResultSet resultSet) throws SQLException {
+    StringBuilder sb = new StringBuilder();
+    ResultSetMetaData rsmd = resultSet.getMetaData();
+    int numOfColumns = rsmd.getColumnCount();
+
+    for (int i = 1; i <= numOfColumns; i++) {
+      if (i > 1) sb.append(",");
+      String columnName = rsmd.getColumnName(i);
+      sb.append(columnName);
+    }
+    sb.append("\n-------------------------------\n");
+
+    while (resultSet.next()) {
+      for (int i = 1; i <= numOfColumns; i++) {
+        if (i > 1) sb.append(",");
+        String columnValue = resultSet.getObject(i).toString();
+        sb.append(columnValue);
+      }
+      sb.append("\n");
+    }
+    return sb.toString();
+  }
+
+  private void verifyResult(String message, ResultSet res, Path resultFile) throws SQLException, IOException {
+    String actualResult = resultSetToString(res);
+    String expectedResult = FileUtil.readTextFile(new File(resultFile.toUri()));
+    assertEquals(message, expectedResult.trim(), actualResult.trim());
+  }
+
+  private Path getQueryFilePath(String fileName) {
+    return StorageUtil.concatPath(currentQueryPath, fileName);
+  }
+
+  private Path getResultFile(String fileName) {
+    return StorageUtil.concatPath(currentResultPath, fileName);
+  }
+
+  private Path getDataSetFile(String fileName) {
+    return StorageUtil.concatPath(currentDatasetPath, fileName);
+  }
+
+  /**
+   *
+   * Execute a data definition language (DDL) template. A general SQL DDL statement can be included in this file. But,
+   * for user-specified table name or exact external table path, you must use some format string to indicate them.
+   * The format string will be replaced by the corresponding arguments.
+   *
+   * The below is predefined format strings:
+   * <ul>
+   *   <li>${table.path} - It is replaced by the absolute file path that <code>dataFileName</code> points. </li>
+   *   <li>${i} - It is replaced by the corresponding element of <code>args</code>. For example, ${0} and ${1} are
+   *   replaced by the first and second elements of <code>args</code> respectively</li>. It uses zero-based index.
+   * </ul>
+   *
+   * @param ddlFileName A file name, containing a data definition statement.
+   * @param dataFileName A file name, containing data rows, which columns have to be separated by vertical bar '|'.
+   *                     This file name is used for replacing some format string indicating an external table location.
+   * @param args A list of arguments, each of which is used to replace corresponding variable which has a form of ${i}.
+   * @return The table name created
+   */
+  public String executeDDL(String ddlFileName, String dataFileName, String ... args) throws Exception {
+    return executeDDL(ddlFileName, dataFileName, true, args);
+  }
+
+  private String executeDDL(String ddlFileName, String dataFileName, boolean isLocalTable, String ... args)
+      throws Exception {
+
+    Path ddlFilePath = new Path(currentQueryPath, ddlFileName);
+    FileSystem fs = ddlFilePath.getFileSystem(conf);
+    assertTrue(ddlFilePath + " existence check", fs.exists(ddlFilePath));
+
+    String template = FileUtil.readTextFile(new File(ddlFilePath.toUri()));
+    String dataFilePath = null;
+    if (dataFileName != null) {
+      dataFilePath = getDataSetFile(dataFileName).toString();
+    }
+    String compiled = compileTemplate(template, dataFilePath, args);
+
+    // parse a statement
+    Expr expr = sqlParser.parse(compiled);
+    assertNotNull(ddlFilePath + " cannot be parsed", expr);
+
+    String tableName = null;
+    if (expr.getType() == OpType.CreateTable) {
+      CreateTable createTable = (CreateTable) expr;
+      tableName = createTable.getTableName();
+      client.updateQuery(compiled);
+      assertTrue("table '" + tableName  + "' creation check", client.existTable(tableName));
+      if (isLocalTable) {
+        createdTableSet.add(tableName);
+      }
+    } else if (expr.getType() == OpType.DropTable) {
+      DropTable dropTable = (DropTable) expr;
+      tableName = dropTable.getTableName();
+      assertTrue("table '" + tableName + "' existence check", client.existTable(tableName));
+      client.updateQuery(compiled);
+      assertFalse("table '" + tableName + "' dropped check", client.existTable(tableName));
+      if (isLocalTable) {
+        createdTableSet.remove(tableName);
+      }
+    } else {
+      assertTrue(ddlFilePath + " is not a Create or Drop Table statement", false);
+    }
+
+    return tableName;
+  }
+
+  /**
+   * Replace format strings by a given parameters.
+   *
+   * @param template
+   * @param dataFileName The data file name to replace <code>${table.path}</code>
+   * @param args The list argument to replace each corresponding format string ${i}. ${i} uses zero-based index.
+   * @return A string compiled
+   */
+  private String compileTemplate(String template, String dataFileName, String... args) {
+    String result;
+    if (dataFileName != null) {
+      result = template.replace("${table.path}", "\'" + dataFileName + "'");
+    } else {
+      result = template;
+    }
+
+    for (int i = 0; i < args.length; i++) {
+      result = result.replace("${" + i + "}", args[i]);
+    }
+    return result;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/benchmark/TestTPCH.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/benchmark/TestTPCH.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/benchmark/TestTPCH.java
index b61dc46..f0a0812 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/benchmark/TestTPCH.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/benchmark/TestTPCH.java
@@ -18,90 +18,33 @@
 
 package org.apache.tajo.benchmark;
 
-import com.google.common.collect.Maps;
 import org.apache.tajo.IntegrationTest;
-import org.apache.tajo.TpchTestBase;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
+import org.apache.tajo.QueryTestCaseBase;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-import java.io.IOException;
 import java.sql.ResultSet;
-import java.util.Map;
-
-import static org.junit.Assert.*;
 
 @Category(IntegrationTest.class)
-public class TestTPCH {
-  private static TpchTestBase tpch;
-
-  @BeforeClass
-  public static void setUp() throws Exception {
-    tpch = TpchTestBase.getInstance();
-  }
-
-  @AfterClass
-  public static void tearDown() throws IOException {
-  }
-
-  /**
-   * it verifies NTA-788.
-   */
+public class TestTPCH extends QueryTestCaseBase {
   @Test
   public void testQ1OrderBy() throws Exception {
-    ResultSet res = tpch.execute("select l_returnflag, l_linestatus, count(*) as count_order from lineitem " +
-        "group by l_returnflag, l_linestatus order by l_returnflag, l_linestatus");
-
-    try {
-      Map<String,Integer> result = Maps.newHashMap();
-      result.put("NO", 3);
-      result.put("RF", 2);
-
-      assertNotNull(res);
-      assertTrue(res.next());
-      assertTrue(result.get(res.getString(1) + res.getString(2)) == res.getInt(3));
-      assertTrue(res.next());
-      assertTrue(result.get(res.getString(1) + res.getString(2)) == res.getInt(3));
-      assertFalse(res.next());
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public void testQ2FourJoins() throws Exception {
-    ResultSet res = tpch.execute(
-        "select s_acctbal, s_name, n_name, p_partkey, p_mfgr, s_address, s_phone, s_comment, ps_supplycost, " +
-            "r_name, p_type, p_size " +
-            "from region join nation on n_regionkey = r_regionkey and r_name = 'AMERICA' " +
-            "join supplier on s_nationkey = n_nationkey " +
-            "join partsupp on s_suppkey = ps_suppkey " +
-            "join part on p_partkey = ps_partkey and p_type like '%BRASS' and p_size = 15");
-
-    try {
-      assertTrue(res.next());
-      assertEquals("AMERICA", res.getString(10));
-      String [] pType = res.getString(11).split(" ");
-      assertEquals("BRASS", pType[pType.length - 1]);
-      assertEquals(15, res.getInt(12));
-      assertFalse(res.next());
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public void testTPCH14Expr() throws Exception {
-    ResultSet res = tpch.execute("select 100 * sum(" +
-        "case when p_type like 'PROMO%' then l_extendedprice else 0.0 end) / sum(l_extendedprice * (1 - l_discount)) "
-        + "as promo_revenue from lineitem, part where l_partkey = p_partkey");
-
-    try {
-      assertTrue(res.next());
-      assertEquals(33, res.getInt(1));
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/client/TestDDLBuilder.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/client/TestDDLBuilder.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/client/TestDDLBuilder.java
index f91e8ec..7f9d15c 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/client/TestDDLBuilder.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/client/TestDDLBuilder.java
@@ -43,6 +43,6 @@ public class TestDDLBuilder {
 
     TableDesc desc = new TableDesc("table1", schema, meta, new Path("/table1"));
 
-    assertEquals(FileUtil.readTextFile(new File("src/test/results/testBuildDDL.result")), DDLBuilder.buildDDL(desc));
+    assertEquals(FileUtil.readTextFile(new File("src/test/resources/results/testBuildDDL.result")), DDLBuilder.buildDDL(desc));
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/function/TestBuiltinFunctions.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/function/TestBuiltinFunctions.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/function/TestBuiltinFunctions.java
index 1b354ba..a688323 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/function/TestBuiltinFunctions.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/function/TestBuiltinFunctions.java
@@ -18,180 +18,86 @@
 
 package org.apache.tajo.engine.function;
 
-import com.google.common.collect.Maps;
 import org.apache.tajo.IntegrationTest;
-import org.apache.tajo.TpchTestBase;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
+import org.apache.tajo.QueryTestCaseBase;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-import java.io.IOException;
 import java.sql.ResultSet;
-import java.util.Map;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertTrue;
 
 @Category(IntegrationTest.class)
-public class TestBuiltinFunctions {
-  static TpchTestBase tpch;
-
-  @BeforeClass
-  public static void setUp() throws Exception {
-    tpch = TpchTestBase.getInstance();
-  }
-
-  @AfterClass
-  public static void tearDown() throws IOException {
-  }
-
+public class TestBuiltinFunctions extends QueryTestCaseBase {
   @Test
   public void testMaxLong() throws Exception {
-    ResultSet res = tpch.execute("select max(l_orderkey) as total_max from lineitem");
-    try {
-      res.next();
-      assertEquals(3, res.getInt(1));
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public void testMinLong() throws Exception {
-    ResultSet res = tpch.execute("select min(l_orderkey) as total_min from lineitem");
-    try {
-      res.next();
-      assertEquals(1, res.getInt(1));
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public void testCount() throws Exception {
-    ResultSet res = tpch.execute("select count(*) as rownum from lineitem");
-    try {
-      res.next();
-      assertEquals(5, res.getInt(1));
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public void testAvgDouble() throws Exception {
-    Map<Long, Float> result = Maps.newHashMap();
-    result.put(1l, 0.065f);
-    result.put(2l, 0.0f);
-    result.put(3l, 0.08f);
-
-    ResultSet res = tpch.execute("select l_orderkey, avg(l_discount) as revenue from lineitem group by l_orderkey");
-
-    try {
-      while(res.next()) {
-        assertTrue(result.get(res.getLong(1)) == res.getFloat(2));
-      }
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public void testAvgLong() throws Exception {
-    ResultSet res = tpch.execute("select avg(l_orderkey) as total_avg from lineitem");
-    try {
-      res.next();
-      assertEquals(2, res.getLong(1));
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public void testAvgInt() throws Exception {
-    ResultSet res = tpch.execute("select avg(l_partkey) as total_avg from lineitem");
-    try {
-      res.next();
-      System.out.println(res.getFloat(1));
-      assertTrue(1.8f == res.getFloat(1));
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public void testRandom() throws Exception {
-    ResultSet res = tpch.execute("select l_orderkey, random(3) as rndnum from lineitem group by l_orderkey, rndnum");
-
-    try {
-      while(res.next()) {
-        assertTrue(res.getInt(2) >= 0 && res.getInt(2) < 3);
-      }
-    } finally {
-      res.close();
+    ResultSet res = executeQuery();
+    while(res.next()) {
+      assertTrue(res.getInt(2) >= 0 && res.getInt(2) < 3);
     }
+    cleanupQuery(res);
   }
 
   @Test
   public void testSplitPart() throws Exception {
-    ResultSet res = tpch.execute("select split_part(l_shipinstruct, ' ', 1) from lineitem");
-
-    String [] result ={
-      "DELIVER",
-      "TAKE",
-      "TAKE",
-      "NONE",
-      "TAKE"
-    };
-
-    for (int i = 0; i < result.length; i++) {
-      assertTrue(res.next());
-      assertEquals(result[i], res.getString(1));
-    }
-    assertFalse(res.next());
-
-    res.close();
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public void testSplitPartByString() throws Exception {
-    ResultSet res = tpch.execute("select split_part(l_shipinstruct, 'KE', 1) from lineitem");
-
-    String [] result ={
-        "DELIVER IN PERSON",
-        "TA",
-        "TA",
-        "NONE",
-        "TA"
-    };
-
-    for (int i = 0; i < result.length; i++) {
-      assertTrue(res.next());
-      assertEquals(result[i], res.getString(1));
-    }
-    assertFalse(res.next());
-
-    res.close();
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public void testSplitPartNested() throws Exception {
-    ResultSet res = tpch.execute("select split_part(split_part(l_shipinstruct, ' ', 1), 'A', 2) from lineitem");
-
-    String [] result ={
-        "",
-        "KE",
-        "KE",
-        "",
-        "KE"
-    };
-
-    for (int i = 0; i < result.length; i++) {
-      assertTrue(res.next());
-      assertEquals(result[i], res.getString(1));
-    }
-    assertFalse(res.next());
-
-    res.close();
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/parser/TestHiveConverter.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/parser/TestHiveConverter.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/parser/TestHiveConverter.java
index 2e44701..2573391 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/parser/TestHiveConverter.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/parser/TestHiveConverter.java
@@ -85,7 +85,7 @@ public class TestHiveConverter {
 
   @Test
   public void testSelect1() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/select_1.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/select_1.sql"));
     Expr expr = parseQuery(sql);
     Expr hiveExpr = parseHiveQL(sql);
     compareJsonResult(expr, hiveExpr);
@@ -93,7 +93,7 @@ public class TestHiveConverter {
 
   @Test
   public void testSelect3() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/select_3.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/select_3.sql"));
     Expr expr = parseQuery(sql);
     Expr hiveExpr = parseHiveQL(sql);
     compareJsonResult(expr, hiveExpr);
@@ -101,7 +101,7 @@ public class TestHiveConverter {
 
   @Test
   public void testSelect4() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/select_4.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/select_4.sql"));
     Expr expr = parseQuery(sql);
     Expr hiveExpr = parseHiveQL(sql);
     compareJsonResult(expr, hiveExpr);
@@ -109,7 +109,7 @@ public class TestHiveConverter {
 
   @Test
   public void testSelect5() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/select_5.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/select_5.sql"));
     Expr expr = parseQuery(sql);
     Expr hiveExpr = parseHiveQL(sql);
     compareJsonResult(expr, hiveExpr);
@@ -117,7 +117,7 @@ public class TestHiveConverter {
 
   @Test
   public void testSelect7() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/select_7.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/select_7.sql"));
     Expr expr = parseQuery(sql);
     Expr hiveExpr = parseHiveQL(sql);
     compareJsonResult(expr, hiveExpr);
@@ -125,7 +125,7 @@ public class TestHiveConverter {
 
   @Test
   public void testSelect8() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/select_8.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/select_8.sql"));
     Expr expr = parseQuery(sql);
     Expr hiveExpr = parseHiveQL(sql);
     compareJsonResult(expr, hiveExpr);
@@ -133,34 +133,34 @@ public class TestHiveConverter {
 
   @Test
   public void testSelect9() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/select_9.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/select_9.sql"));
     Expr expr = parseQuery(sql);
-    sql = FileUtil.readTextFile(new File("src/test/queries/select_9.hiveql"));
+    sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/select_9.hiveql"));
     Expr hiveExpr = parseHiveQL(sql);
     compareJsonResult(expr, hiveExpr);
   }
 
   @Test
   public void testSelect10() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/select_10.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/select_10.sql"));
     Expr expr = parseQuery(sql);
-    sql = FileUtil.readTextFile(new File("src/test/queries/select_10.hiveql"));
+    sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/select_10.hiveql"));
     Expr hiveExpr = parseHiveQL(sql);
     compareJsonResult(expr, hiveExpr);
   }
 
   //@Test
   public void testSelect11() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/select_11.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/select_11.sql"));
     Expr expr = parseQuery(sql);
-    sql = FileUtil.readTextFile(new File("src/test/queries/select_11.hiveql"));
+    sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/select_11.hiveql"));
     Expr hiveExpr = parseHiveQL(sql);
     compareJsonResult(expr, hiveExpr);
   }
 
   @Test
   public void testSelect12() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/select_12.hiveql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/select_12.hiveql"));
     Expr expr = parseQuery(sql);
     Expr hiveExpr = parseHiveQL(sql);
     compareJsonResult(expr, hiveExpr);
@@ -168,16 +168,16 @@ public class TestHiveConverter {
 
   @Test
   public void testSelect13() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/select_13.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/select_13.sql"));
     Expr expr = parseQuery(sql);
-    sql = FileUtil.readTextFile(new File("src/test/queries/select_13.hiveql"));
+    sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/select_13.hiveql"));
     Expr hiveExpr = parseHiveQL(sql);
     compareJsonResult(expr, hiveExpr);
   }
 
   @Test
   public void testSelect14() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/select_14.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/select_14.sql"));
     Expr expr = parseQuery(sql);
     Expr hiveExpr = parseHiveQL(sql);
     compareJsonResult(expr, hiveExpr);
@@ -185,7 +185,7 @@ public class TestHiveConverter {
 
   @Test
   public void testGroupby1() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/groupby_1.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/groupby_1.sql"));
     Expr expr = parseQuery(sql);
     Expr hiveExpr = parseHiveQL(sql);
     compareJsonResult(expr, hiveExpr);
@@ -193,7 +193,7 @@ public class TestHiveConverter {
 
   @Test
   public void testJoin2() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/join_2.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/join_2.sql"));
     Expr expr = parseQuery(sql);
     Expr hiveExpr = parseHiveQL(sql);
     compareJsonResult(expr, hiveExpr);
@@ -201,7 +201,7 @@ public class TestHiveConverter {
 
   @Test
   public void testJoin5() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/join_5.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/join_5.sql"));
     Expr expr = parseQuery(sql);
     Expr hiveExpr = parseHiveQL(sql);
     compareJsonResult(expr, hiveExpr);
@@ -209,7 +209,7 @@ public class TestHiveConverter {
 
   @Test
   public void testJoin6() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/join_6.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/join_6.sql"));
     Expr expr = parseQuery(sql);
     Expr hiveExpr = parseHiveQL(sql);
     compareJsonResult(expr, hiveExpr);
@@ -217,7 +217,7 @@ public class TestHiveConverter {
 
   @Test
   public void testJoin7() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/join_7.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/join_7.sql"));
     Expr expr = parseQuery(sql);
     Expr hiveExpr = parseHiveQL(sql);
     compareJsonResult(expr, hiveExpr);
@@ -225,7 +225,7 @@ public class TestHiveConverter {
 
   //@Test
   public void testJoin9() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/join_9.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/join_9.sql"));
     Expr expr = parseQuery(sql);
     Expr hiveExpr = parseHiveQL(sql);
     assertEquals(expr, hiveExpr);
@@ -233,7 +233,7 @@ public class TestHiveConverter {
 
   @Test
   public void testJoin12() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/join_12.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/join_12.sql"));
     Expr expr = parseQuery(sql);
     Expr hiveExpr = parseHiveQL(sql);
     assertEquals(expr, hiveExpr);
@@ -241,7 +241,7 @@ public class TestHiveConverter {
 
   @Test
   public void testJoin13() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/join_13.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/join_13.sql"));
     Expr expr = parseQuery(sql);
     Expr hiveExpr = parseHiveQL(sql);
     compareJsonResult(expr, hiveExpr);
@@ -249,7 +249,7 @@ public class TestHiveConverter {
 
   @Test
   public void testJoin14() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/join_14.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/join_14.sql"));
     Expr expr = parseQuery(sql);
     Expr hiveExpr = parseHiveQL(sql);
     compareJsonResult(expr, hiveExpr);
@@ -257,16 +257,16 @@ public class TestHiveConverter {
 
   @Test
   public void testJoin15() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/join_15.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/join_15.sql"));
     Expr expr = parseQuery(sql);
-    sql = FileUtil.readTextFile(new File("src/test/queries/join_15.hiveql"));
+    sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/join_15.hiveql"));
     Expr hiveExpr = parseHiveQL(sql);
     compareJsonResult(expr, hiveExpr);
   }
 
   @Test
   public void testUnion1() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/union_1.hiveql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/union_1.hiveql"));
     Expr expr = parseQuery(sql);
     Expr hiveExpr = parseHiveQL(sql);
     compareJsonResult(expr, hiveExpr);
@@ -274,7 +274,7 @@ public class TestHiveConverter {
 
   @Test
   public void testInsert1() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/insert_into_select_1.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/insert_into_select_1.sql"));
     Expr expr = parseQuery(sql);
     Expr hiveExpr = parseHiveQL(sql);
     compareJsonResult(expr, hiveExpr);
@@ -283,52 +283,52 @@ public class TestHiveConverter {
 
   @Test
   public void testInsert2() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/insert_overwrite_into_select_2.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/insert_overwrite_into_select_2.sql"));
     Expr expr = parseQuery(sql);
-    sql = FileUtil.readTextFile(new File("src/test/queries/insert_overwrite_into_select_2.hiveql"));
+    sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/insert_overwrite_into_select_2.hiveql"));
     Expr hiveExpr = parseHiveQL(sql);
     compareJsonResult(expr, hiveExpr);
   }
 
   @Test
   public void testCreate1() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/create_table_1.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/create_table_1.sql"));
     Expr expr = parseQuery(sql);
-    sql = FileUtil.readTextFile(new File("src/test/queries/create_table_1.hiveql"));
+    sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/create_table_1.hiveql"));
     Expr hiveExpr = parseHiveQL(sql);
     compareJsonResult(expr, hiveExpr);
   }
 
   @Test
   public void testCreate2() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/create_table_2.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/create_table_2.sql"));
     Expr expr = parseQuery(sql);
-    sql = FileUtil.readTextFile(new File("src/test/queries/create_table_2.hiveql"));
+    sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/create_table_2.hiveql"));
     Expr hiveExpr = parseHiveQL(sql);
     compareJsonResult(expr, hiveExpr);
   }
 
   @Test
   public void testCreate11() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/create_table_11.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/create_table_11.sql"));
     Expr expr = parseQuery(sql);
-    sql = FileUtil.readTextFile(new File("src/test/queries/create_table_11.hiveql"));
+    sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/create_table_11.hiveql"));
     Expr hiveExpr = parseHiveQL(sql);
     compareJsonResult(expr, hiveExpr);
   }
 
   @Test
   public void testCreate12() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/create_table_12.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/create_table_12.sql"));
     Expr expr = parseQuery(sql);
-    sql = FileUtil.readTextFile(new File("src/test/queries/create_table_12.hiveql"));
+    sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/create_table_12.hiveql"));
     Expr hiveExpr = parseHiveQL(sql);
     compareJsonResult(expr, hiveExpr);
   }
 
   @Test
   public void testDrop() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/drop_table.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/drop_table.sql"));
     Expr expr = parseQuery(sql);
     Expr hiveExpr = parseHiveQL(sql);
     compareJsonResult(expr, hiveExpr);


[4/5] TAJO-476: Add a test development kit for unit tests based on executions of queries.

Posted by hy...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/parser/TestSQLAnalyzer.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/parser/TestSQLAnalyzer.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/parser/TestSQLAnalyzer.java
index 389a9e5..e81326e 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/parser/TestSQLAnalyzer.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/parser/TestSQLAnalyzer.java
@@ -55,199 +55,199 @@ public class TestSQLAnalyzer {
 
   @Test
   public void testSelect1() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/select_1.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/select_1.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testSelect2() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/select_2.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/select_2.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testSelect3() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/select_3.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/select_3.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testSelect4() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/select_4.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/select_4.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testSelect5() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/select_5.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/select_5.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testGroupby1() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/groupby_1.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/groupby_1.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testJoin1() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/join_1.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/join_1.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testJoin2() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/join_2.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/join_2.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testJoin3() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/join_3.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/join_3.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testJoin4() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/join_4.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/join_4.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testJoin5() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/join_5.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/join_5.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testJoin6() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/join_6.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/join_6.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testJoin7() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/join_7.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/join_7.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testJoin8() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/join_8.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/join_8.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testJoin9() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/join_9.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/join_9.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testJoin10() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/join_10.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/join_10.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testJoin11() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/join_11.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/join_11.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testSet1() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/set_1.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/set_1.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testSet2() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/set_2.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/set_2.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testSet3() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/set_3.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/set_3.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testSet4() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/set_4.sql"));
-    System.out.println(parseQuery(sql));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/set_4.sql"));
+    parseQuery(sql);
   }
 
   @Test
   public void testDropTable() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/drop_table.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/drop_table.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testCreateTable1() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/create_table_1.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/create_table_1.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testCreateTable2() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/create_table_2.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/create_table_2.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testCreateTable3() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/create_table_3.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/create_table_3.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testCreateTable4() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/create_table_4.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/create_table_4.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testCreateTable5() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/create_table_5.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/create_table_5.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testCreateTable6() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/create_table_6.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/create_table_6.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testCreateTable7() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/create_table_7.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/create_table_7.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testCreateTable8() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/create_table_8.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/create_table_8.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testCreateTable9() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/create_table_9.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/create_table_9.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testCreateTable10() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/create_table_10.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/create_table_10.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testCreateTablePartitionByHash1() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/create_table_partition_by_hash_1.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/create_table_partition_by_hash_1.sql"));
     Expr expr = parseQuery(sql);
     assertEquals(OpType.CreateTable, expr.getType());
     CreateTable createTable = (CreateTable) expr;
@@ -260,7 +260,7 @@ public class TestSQLAnalyzer {
 
   @Test
   public void testCreateTablePartitionByHash2() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/create_table_partition_by_hash_2.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/create_table_partition_by_hash_2.sql"));
     Expr expr = parseQuery(sql);
     assertEquals(OpType.CreateTable, expr.getType());
     CreateTable createTable = (CreateTable) expr;
@@ -274,7 +274,7 @@ public class TestSQLAnalyzer {
 
   @Test
   public void testCreateTablePartitionByRange() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/create_table_partition_by_range.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/create_table_partition_by_range.sql"));
     Expr expr = parseQuery(sql);
     assertEquals(OpType.CreateTable, expr.getType());
     CreateTable createTable = (CreateTable) expr;
@@ -287,7 +287,7 @@ public class TestSQLAnalyzer {
 
   @Test
   public void testCreateTablePartitionByList() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/create_table_partition_by_list.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/create_table_partition_by_list.sql"));
     Expr expr = parseQuery(sql);
     assertEquals(OpType.CreateTable, expr.getType());
     CreateTable createTable = (CreateTable) expr;
@@ -312,7 +312,7 @@ public class TestSQLAnalyzer {
 
   @Test
   public void testCreateTablePartitionByColumn() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/create_table_partition_by_column.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/create_table_partition_by_column.sql"));
     Expr expr = parseQuery(sql);
     assertEquals(OpType.CreateTable, expr.getType());
     CreateTable createTable = (CreateTable) expr;
@@ -327,73 +327,73 @@ public class TestSQLAnalyzer {
 
   @Test
   public void testTableSubQuery1() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/table_subquery1.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/table_subquery1.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testTableSubQuery2() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/table_subquery2.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/table_subquery2.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testInSubquery1() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/in_subquery_1.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/in_subquery_1.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testInSubquery2() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/in_subquery_2.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/in_subquery_2.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testExistsPredicate1() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/exists_predicate_1.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/exists_predicate_1.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testExistsPredicate2() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/exists_predicate_2.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/exists_predicate_2.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testInsertIntoTable() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/insert_into_select_1.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/insert_into_select_1.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testInsertIntoLocation() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/insert_into_select_2.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/insert_into_select_2.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testInsertIntoTable2() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/insert_into_select_3.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/insert_into_select_3.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testInsertOverwriteIntoTable() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/insert_overwrite_into_select_1.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/insert_overwrite_into_select_1.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testInsertOverwriteIntoLocation() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/insert_overwrite_into_select_2.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/insert_overwrite_into_select_2.sql"));
     parseQuery(sql);
   }
 
   @Test
   public void testInsertOverwriteIntoTable2() throws IOException {
-    String sql = FileUtil.readTextFile(new File("src/test/queries/insert_overwrite_into_select_3.sql"));
+    String sql = FileUtil.readTextFile(new File("src/test/resources/queries/default/insert_overwrite_into_select_3.sql"));
     parseQuery(sql);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/TestLogicalPlanner.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/TestLogicalPlanner.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/TestLogicalPlanner.java
index b3aaf32..8a3f9f6 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/TestLogicalPlanner.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/TestLogicalPlanner.java
@@ -386,7 +386,7 @@ public class TestLogicalPlanner {
   @Test
   public final void testMultipleJoin() throws IOException, PlanningException {
     Expr expr = sqlAnalyzer.parse(
-        FileUtil.readTextFile(new File("src/test/queries/tpch_q2_simplified.sql")));
+        FileUtil.readTextFile(new File("src/test/resources/queries/TestJoinQuery/testTPCHQ2Join.sql")));
     LogicalNode plan = planner.createPlan(expr).getRootBlock().getRoot();
     testJsonSerDerObject(plan);
     Schema expected = tpch.getOutSchema("q2");

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCaseByCases.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCaseByCases.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCaseByCases.java
index 5885f10..20b5ac5 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCaseByCases.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCaseByCases.java
@@ -18,65 +18,23 @@
 
 package org.apache.tajo.engine.query;
 
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import org.apache.tajo.TpchTestBase;
-import org.apache.tajo.client.ResultSetUtil;
-import org.apache.tajo.util.FileUtil;
-import org.junit.BeforeClass;
+import org.apache.tajo.QueryTestCaseBase;
 import org.junit.Test;
 
-import java.io.File;
-import java.io.IOException;
 import java.sql.ResultSet;
-import java.util.List;
-import java.util.Map;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-public class TestCaseByCases {
-  private static TpchTestBase tpch;
-
-  public TestCaseByCases() throws IOException {
-    super();
-  }
-
-  @BeforeClass
-  public static void setUp() throws Exception {
-    tpch = TpchTestBase.getInstance();
-  }
 
+public class TestCaseByCases extends QueryTestCaseBase {
   @Test
   public final void testTAJO415Case() throws Exception {
-    ResultSet res = tpch.execute(FileUtil.readTextFile(new File("src/test/queries/tajo415_case.sql")));
-    try {
-      Map<Integer, List<Integer>> result = Maps.newHashMap();
-      result.put(1, Lists.newArrayList(1, 1));
-      result.put(2, Lists.newArrayList(2, 1));
-      result.put(3, Lists.newArrayList(3, 1));
-      result.put(4, Lists.newArrayList(0, 1));
-      result.put(5, Lists.newArrayList(0, 1));
-      while(res.next()) {
-        assertTrue(result.get(res.getInt(1)).get(0) == res.getInt(2));
-        assertTrue(result.get(res.getInt(1)).get(1) == res.getInt(3));
-      }
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testTAJO418Case() throws Exception {
-    ResultSet res = tpch.execute(FileUtil.readTextFile(new File("src/test/queries/tajo418_case.sql")));
-    try {
-      assertTrue(res.next());
-      assertEquals("R", res.getString(1));
-      assertEquals("F", res.getString(2));
-      assertFalse(res.next());
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCreateTable.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCreateTable.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCreateTable.java
new file mode 100644
index 0000000..f6930ba
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCreateTable.java
@@ -0,0 +1,40 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.engine.query;
+
+import org.apache.tajo.IntegrationTest;
+import org.apache.tajo.QueryTestCaseBase;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(IntegrationTest.class)
+public class TestCreateTable extends QueryTestCaseBase {
+
+  @Test
+  public final void testVariousTypes() throws Exception {
+    String tableName = executeDDL("create_table_various_types.sql", null);
+    assertTableExists(tableName);
+  }
+
+  @Test
+  public final void testCreateTable1() throws Exception {
+    String tableName = executeDDL("table1_ddl.sql", "table1.tbl", "table1");
+    assertTableExists(tableName);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCreateTableStatement.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCreateTableStatement.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCreateTableStatement.java
deleted file mode 100644
index 416f613..0000000
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCreateTableStatement.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tajo.engine.query;
-
-import org.apache.tajo.IntegrationTest;
-import org.apache.tajo.TajoTestingCluster;
-import org.apache.tajo.TpchTestBase;
-import org.apache.tajo.catalog.CatalogService;
-import org.apache.tajo.util.FileUtil;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.io.File;
-import java.io.IOException;
-import java.sql.ResultSet;
-
-import static org.junit.Assert.assertTrue;
-
-@Category(IntegrationTest.class)
-public class TestCreateTableStatement {
-  private static TpchTestBase tpch;
-  public TestCreateTableStatement() throws IOException {
-    super();
-  }
-
-  @BeforeClass
-  public static void setUp() throws Exception {
-    tpch = TpchTestBase.getInstance();
-  }
-
-  @Test
-  public final void testVariousTypes() throws Exception {
-    String tableName ="various_types";
-    ResultSet res = tpch.execute(FileUtil.readTextFile(new File("src/test/queries/create_table_various_types.sql")));
-    res.close();
-    TajoTestingCluster cluster = tpch.getTestingCluster();
-    CatalogService catalog = cluster.getMaster().getCatalog();
-    assertTrue(catalog.existsTable(tableName));
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestGroupByQuery.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestGroupByQuery.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestGroupByQuery.java
index 311dabb..e0e7e21 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestGroupByQuery.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestGroupByQuery.java
@@ -18,123 +18,48 @@
 
 package org.apache.tajo.engine.query;
 
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
 import org.apache.tajo.IntegrationTest;
-import org.apache.tajo.TpchTestBase;
-import org.apache.tajo.util.TUtil;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
+import org.apache.tajo.QueryTestCaseBase;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-import java.io.IOException;
 import java.sql.ResultSet;
-import java.util.Map;
-import java.util.Set;
-
-import static org.junit.Assert.*;
 
 @Category(IntegrationTest.class)
-public class TestGroupByQuery {
-  private static TpchTestBase tpch;
-  public TestGroupByQuery() throws IOException {
-    super();
-  }
-
-  @BeforeClass
-  public static void setUp() throws Exception {
-    tpch = TpchTestBase.getInstance();
-  }
-
-  @AfterClass
-  public static void tearDown() throws Exception {
-  }
-
+public class TestGroupByQuery extends QueryTestCaseBase {
   @Test
   public final void testGroupBy() throws Exception {
-    ResultSet res = tpch.execute(
-        "select count(1) as unique_key from lineitem;");
-    assertTrue(res.next());
-    assertEquals(5, res.getLong(1));
-    assertFalse(res.next());
-    res.close();
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testGroupBy2() throws Exception {
-    ResultSet res = tpch.execute(
-        "select count(1) as unique_key from lineitem group by l_linenumber");
-    Set<Long> expected = Sets.newHashSet(2l,3l);
-    for (int i = 0; i < 2; i++) {
-      assertTrue(res.next());
-      assertTrue(expected.contains(res.getLong(1)));
-    }
-    assertFalse(res.next());
-    res.close();
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testGroupBy3() throws Exception {
-    ResultSet res = tpch.execute(
-        "select l_orderkey as gkey from lineitem group by gkey order by gkey");
-    assertTrue(res.next());
-    assertEquals(1, res.getLong(1));
-    assertTrue(res.next());
-    assertEquals(2, res.getLong(1));
-    assertTrue(res.next());
-    assertEquals(3, res.getLong(1));
-    assertFalse(res.next());
-    res.close();
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testGroupBy4() throws Exception {
-    ResultSet res = tpch.execute(
-        "select l_orderkey as gkey, count(1) as unique_key from lineitem group by lineitem.l_orderkey");
-
-    long [][] expectedRows = new long[3][];
-    expectedRows[0] = new long [] {1,2};
-    expectedRows[1] = new long [] {2,1};
-    expectedRows[2] = new long [] {3,2};
-    Map<Long, long []> expected = Maps.newHashMap();
-    for (long [] expectedRow : expectedRows) {
-      expected.put(expectedRow[0], expectedRow);
-    }
-
-    for (int i = 0; i < expectedRows.length; i++) {
-      assertTrue(res.next());
-      long [] expectedRow = expected.get(res.getLong(1));
-      assertEquals(expectedRow[0], res.getLong(1));
-      assertEquals(expectedRow[1], res.getLong(2));
-    }
-    assertFalse(res.next());
-    res.close();
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testCountDistinct() throws Exception {
-    ResultSet res = tpch.execute(
-        "select l_orderkey, max(l_orderkey) as maximum, count(distinct l_linenumber) as unique_key from lineitem " +
-            "group by l_orderkey");
-
-    long [][] expectedRows = new long[3][];
-    expectedRows[0] = new long [] {1,1,2};
-    expectedRows[1] = new long [] {2,2,1};
-    expectedRows[2] = new long [] {3,3,2};
-
-    Map<Long, long []> expected = Maps.newHashMap();
-    for (long [] expectedRow : expectedRows) {
-      expected.put(expectedRow[0], expectedRow);
-    }
-    for (int i = 0; i < expectedRows.length; i++) {
-      assertTrue(res.next());
-      long [] expectedRow = expected.get(res.getLong(1));
-      assertEquals(expectedRow[1], res.getLong(2));
-      assertEquals(expectedRow[2], res.getLong(3));
-    }
-    assertFalse(res.next());
-    res.close();
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
@@ -142,126 +67,44 @@ public class TestGroupByQuery {
    * This is an unit test for a combination of aggregation and distinct aggregation functions.
    */
   public final void testCountDistinct2() throws Exception {
-    ResultSet res = tpch.execute(
-        "select l_orderkey, count(*) as cnt, count(distinct l_linenumber) as unique_key from lineitem " +
-            "group by l_orderkey");
-
-    long [][] expectedRows = new long[3][];
-    expectedRows[0] = new long [] {1,2,2};
-    expectedRows[1] = new long [] {2,1,1};
-    expectedRows[2] = new long [] {3,2,2};
-
-    Map<Long, long []> expected = Maps.newHashMap();
-    for (long [] expectedRow : expectedRows) {
-      expected.put(expectedRow[0], expectedRow);
-    }
-    for (int i = 0; i < expectedRows.length; i++) {
-      assertTrue(res.next());
-      long [] expectedRow = expected.get(res.getLong(1));
-      assertEquals(expectedRow[1], res.getLong(2));
-      assertEquals(expectedRow[2], res.getLong(3));
-    }
-    assertFalse(res.next());
-    res.close();
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testComplexParameter() throws Exception {
-    ResultSet res = tpch.execute(
-        "select sum(l_extendedprice*l_discount) as revenue from lineitem");
-    try {
-      assertNotNull(res);
-      assertTrue(res.next());
-      assertTrue(12908 == (int) res.getDouble("revenue"));
-      assertFalse(res.next());
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testComplexParameterWithSubQuery() throws Exception {
-
-
-    ResultSet res = tpch.execute(
-        "select count(*) as total from ("+
-            "        select * from lineitem " +
-            "        union all"+
-            "        select * from lineitem ) l");
-    try {
-      assertNotNull(res);
-      assertTrue(res.next());
-      assertTrue(10 == (int) res.getDouble("total"));
-      assertFalse(res.next());
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testComplexParameter2() throws Exception {
-    ResultSet res = tpch.execute("select count(*) + max(l_orderkey) as merged from lineitem");
-    try {
-      assertTrue(res.next());
-      assertEquals(8, res.getLong("merged"));
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testHavingWithNamedTarget() throws Exception {
-    ResultSet res = tpch.execute(
-        "select l_orderkey, avg(l_partkey) total, sum(l_linenumber) as num from lineitem " +
-            "group by l_orderkey having total >= 2 or num = 3");
-    Map<Integer, Double> result = TUtil.newHashMap();
-    result.put(3, 2.5d);
-    result.put(2, 2.0d);
-    result.put(1, 1.0d);
-
-    for (int i = 0; i < 3; i++) {
-      assertTrue(res.next());
-      assertTrue(result.containsKey(res.getInt("l_orderkey")));
-      assertTrue(result.get(res.getInt("l_orderkey")) == res.getDouble("total"));
-    }
-    assertFalse(res.next());
-    res.close();
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
 
   @Test
   public final void testHavingWithAggFunction() throws Exception {
-    ResultSet res = tpch.execute(
-        "select l_orderkey, avg(l_partkey) total, sum(l_linenumber) as num from lineitem " +
-            "group by l_orderkey having avg(l_partkey) = 2.5 or num = 1");
-    Map<Integer, Double> result = TUtil.newHashMap();
-    result.put(3, 2.5d);
-    result.put(2, 2.0d);
-
-    for (int i = 0; i < 2; i++) {
-      assertTrue(res.next());
-      assertTrue(result.containsKey(res.getInt("l_orderkey")));
-      assertTrue(result.get(res.getInt("l_orderkey")) == res.getDouble("total"));
-    }
-    assertFalse(res.next());
-    res.close();
-  }
-
-
-
-  //@Test
-  public final void testCube() throws Exception {
-    ResultSet res = tpch.execute(
-        "cube_test := select l_orderkey, l_partkey, sum(l_quantity) from lineitem " +
-            "group by cube(l_orderkey, l_partkey)");
-    try {
-      int count = 0;
-      for (;res.next();) {
-        count++;
-      }
-      assertEquals(11, count);
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java
index f4172dc..ee29379 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java
@@ -18,213 +18,68 @@
 
 package org.apache.tajo.engine.query;
 
-import com.google.common.collect.Maps;
 import org.apache.tajo.IntegrationTest;
-import org.apache.tajo.TpchTestBase;
-import org.apache.tajo.util.FileUtil;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
+import org.apache.tajo.QueryTestCaseBase;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-import java.io.File;
-import java.io.IOException;
 import java.sql.ResultSet;
-import java.util.Map;
-
-import static org.junit.Assert.*;
 
 @Category(IntegrationTest.class)
-public class TestJoinQuery {
-  static TpchTestBase tpch;
-
-  public TestJoinQuery() throws IOException {
-    super();
-  }
-
-  @BeforeClass
-  public static void setUp() throws Exception {
-    tpch = TpchTestBase.getInstance();
-  }
-
-  @AfterClass
-  public static void tearDown() throws Exception {
-  }
-
+public class TestJoinQuery extends QueryTestCaseBase {
   @Test
   public final void testCrossJoin() throws Exception {
-    ResultSet res = tpch.execute("select n_name, r_name, n_regionkey, r_regionkey from nation, region");
-
-    try {
-      int cnt = 0;
-      while(res.next()) {
-        cnt++;
-      }
-      // TODO - to check their joined contents
-      assertEquals(25 * 5, cnt);
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testCrossJoinWithExplicitJoinQual() throws Exception {
-    ResultSet res = tpch.execute(
-        "select n_name, r_name, n_regionkey, r_regionkey from nation, region where n_regionkey = r_regionkey");
-    try {
-      int cnt = 0;
-      while(res.next()) {
-        cnt++;
-      }
-      // TODO - to check their joined contents
-      assertEquals(25, cnt);
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testTPCHQ2Join() throws Exception {
-    ResultSet res = tpch.execute(FileUtil
-        .readTextFile(new File("src/test/queries/tpch_q2_simplified.sql")));
-
-    try {
-      Object [][] result = new Object[3][3];
-
-      int tupleId = 0;
-      int colId = 0;
-      result[tupleId][colId++] = 4032.68f;
-      result[tupleId][colId++] = "Supplier#000000002";
-      result[tupleId++][colId] = "ETHIOPIA";
-
-      colId = 0;
-      result[tupleId][colId++] = 4641.08f;
-      result[tupleId][colId++] = "Supplier#000000004";
-      result[tupleId++][colId] = "MOROCCO";
-
-      colId = 0;
-      result[tupleId][colId++] = 4192.4f;
-      result[tupleId][colId++] = "Supplier#000000003";
-      result[tupleId][colId] = "ARGENTINA";
-
-      Map<Float, Object[]> resultSet =
-          Maps.newHashMap();
-      for (Object [] t : result) {
-        resultSet.put((Float) t[0], t);
-      }
-
-      for (int i = 0; i < 3; i++) {
-        assertTrue(res.next());
-        Object [] resultTuple = resultSet.get(res.getFloat("s_acctbal"));
-        assertEquals(resultTuple[0], res.getFloat("s_acctbal"));
-        assertEquals(resultTuple[1], res.getString("s_name"));
-        assertEquals(resultTuple[2], res.getString("n_name"));
-      }
-
-      assertFalse(res.next());
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testLeftOuterJoin1() throws Exception {
-    ResultSet res = tpch.execute(
-        "select c_custkey, orders.o_orderkey from customer left outer join orders on c_custkey = o_orderkey;");
-    try {
-      Map<Integer, Integer> result = Maps.newHashMap();
-      result.put(1, 1);
-      result.put(2, 2);
-      result.put(3, 3);
-      result.put(4, 0);
-      result.put(5, 0);
-      while(res.next()) {
-        assertTrue(result.get(res.getInt(1)) == res.getInt(2));
-      }
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testRightOuterJoin1() throws Exception {
-    ResultSet res = tpch.execute(
-        "select c_custkey, orders.o_orderkey from orders right outer join customer on c_custkey = o_orderkey;");
-    try {
-      Map<Integer, Integer> result = Maps.newHashMap();
-      result.put(1, 1);
-      result.put(2, 2);
-      result.put(3, 3);
-      result.put(4, 0);
-      result.put(5, 0);
-      for (int i = 0; i < result.size(); i++) {
-        assertTrue(res.next());
-        assertTrue(result.get(res.getInt(1)) == res.getInt(2));
-      }
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testFullOuterJoin1() throws Exception {
-    ResultSet res = tpch.execute(
-        "select c_custkey, orders.o_orderkey from orders full outer join customer on c_custkey = o_orderkey;");
-    try {
-      Map<Integer, Integer> result = Maps.newHashMap();
-      result.put(1, 1);
-      result.put(2, 2);
-      result.put(3, 3);
-      result.put(4, 0);
-      result.put(5, 0);
-      for (int i = 0; i < result.size(); i++) {
-        assertTrue(res.next());
-        assertTrue(result.get(res.getInt(1)) == res.getInt(2));
-      }
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public void testJoinRefEval() throws Exception {
-    ResultSet res = tpch.execute(
-        "select r_regionkey, n_regionkey, (r_regionkey + n_regionkey) as plus from region, nation " +
-            "where r_regionkey = n_regionkey");
-    try {
-      int r, n;
-      while(res.next()) {
-        r = res.getInt(1);
-        n = res.getInt(2);
-        assertEquals(r + n, res.getInt(3));
-      }
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public void testJoinAndCaseWhen() throws Exception {
-    ResultSet res = tpch.execute("select r_regionkey, n_regionkey, " +
-        "case when r_regionkey = 1 then 'one' " +
-        "when r_regionkey = 2 then 'two' " +
-        "when r_regionkey = 3 then 'three' " +
-        "when r_regionkey = 4 then 'four' " +
-        "else 'zero' " +
-        "end as cond from region, nation where r_regionkey = n_regionkey");
-
-    try {
-      Map<Integer, String> result = Maps.newHashMap();
-      result.put(0, "zero");
-      result.put(1, "one");
-      result.put(2, "two");
-      result.put(3, "three");
-      result.put(4, "four");
-      while(res.next()) {
-        assertEquals(result.get(res.getInt(1)), res.getString(3));
-      }
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestSelectQuery.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestSelectQuery.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestSelectQuery.java
index 4a4ec81..4152d85 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestSelectQuery.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestSelectQuery.java
@@ -18,440 +18,167 @@
 
 package org.apache.tajo.engine.query;
 
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
 import org.apache.tajo.IntegrationTest;
+import org.apache.tajo.QueryTestCaseBase;
 import org.apache.tajo.TajoTestingCluster;
-import org.apache.tajo.TpchTestBase;
 import org.apache.tajo.catalog.CatalogService;
 import org.apache.tajo.catalog.TableDesc;
-import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-import java.io.IOException;
 import java.sql.ResultSet;
-import java.util.Map;
-import java.util.Set;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 @Category(IntegrationTest.class)
-public class TestSelectQuery {
-  private static TpchTestBase tpch;
-  public TestSelectQuery() throws IOException {
-    super();
-  }
-
-  @BeforeClass
-  public static void setUp() throws Exception {
-    tpch = TpchTestBase.getInstance();
-  }
-
+public class TestSelectQuery extends QueryTestCaseBase {
   @Test
   public final void testSelect() throws Exception {
-    ResultSet res = tpch.execute("select l_orderkey, l_partkey from lineitem");
-    try {
-      res.next();
-      assertEquals(1, res.getInt(1));
-      assertEquals(1, res.getInt(2));
-
-      res.next();
-      assertEquals(1, res.getInt(1));
-      assertEquals(1, res.getInt(2));
-      assertEquals(1, res.getInt(2));
-
-      res.next();
-      assertEquals(2, res.getInt(1));
-      assertEquals(2, res.getInt(2));
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testSelect2() throws Exception {
-    ResultSet res = tpch.execute("select l_orderkey, l_partkey, l_orderkey + l_partkey as plus from lineitem");
-    try {
-      res.next();
-      assertEquals(1, res.getInt(1));
-      assertEquals(1, res.getInt(2));
-      assertEquals(2, res.getInt(3));
-
-      res.next();
-      assertEquals(1, res.getInt(1));
-      assertEquals(1, res.getInt(2));
-      assertEquals(2, res.getInt(3));
-
-      res.next();
-      assertEquals(2, res.getInt(1));
-      assertEquals(2, res.getInt(2));
-      assertEquals(4, res.getInt(3));
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testSelect3() throws Exception {
-    ResultSet res = tpch.execute("select l_orderkey + l_partkey as plus from lineitem");
-    try {
-      res.next();
-      assertEquals(2, res.getInt(1));
-
-      res.next();
-      assertEquals(2, res.getInt(1));
-
-      res.next();
-      assertEquals(4, res.getInt(1));
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testWhereCond1() throws Exception {
-    ResultSet res = tpch.execute("select l_orderkey + l_partkey as plus from lineitem where plus = 4");
-    try {
-      assertTrue(res.next());
-      assertEquals(4, res.getInt(1));
-      assertFalse(res.next());
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testWhereCondWithAlias1() throws Exception {
-    ResultSet res = tpch.execute("select l_orderkey as orderkey, l_partkey from lineitem where orderkey = 1");
-    try {
-      assertTrue(res.next());
-      assertEquals(1, res.getInt(1));
-      assertTrue(res.next());
-      assertEquals(1, res.getInt(1));
-      assertFalse(res.next());
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testWhereCondWithAlias2() throws Exception {
-    ResultSet res = tpch.execute("select l_orderkey as orderkey from lineitem where l_orderkey = 1");
-    try {
-      assertTrue(res.next());
-      assertEquals(1, res.getInt(1));
-      assertTrue(res.next());
-      assertEquals(1, res.getInt(1));
-      assertFalse(res.next());
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testSelectAsterik() throws Exception {
-    ResultSet res = tpch.execute("select * from lineitem");
-    try {
-      res.next();
-      assertEquals(1, res.getInt(1));
-      assertEquals(1, res.getInt(2));
-      assertEquals(7706, res.getInt(3));
-      assertEquals(1, res.getInt(4));
-      assertTrue(17 == res.getFloat(5));
-      assertTrue(21168.23f == res.getFloat(6));
-      assertTrue(0.04f == res.getFloat(7));
-      assertTrue(0.02f == res.getFloat(8));
-      assertEquals("N",res.getString(9));
-      assertEquals("O",res.getString(10));
-      assertEquals("1996-03-13",res.getString(11));
-      assertEquals("1996-02-12",res.getString(12));
-      assertEquals("1996-03-22",res.getString(13));
-      assertEquals("DELIVER IN PERSON",res.getString(14));
-      assertEquals("TRUCK",res.getString(15));
-      assertEquals("egular courts above the",res.getString(16));
-
-      res.next();
-      assertEquals(1, res.getInt(1));
-      assertEquals(1, res.getInt(2));
-      assertEquals(7311, res.getInt(3));
-      assertEquals(2, res.getInt(4));
-      assertTrue(36 == res.getFloat(5));
-      assertTrue(45983.16f == res.getFloat(6));
-      assertTrue(0.09f == res.getFloat(7));
-      assertTrue(0.06f == res.getFloat(8));
-      assertEquals("N",res.getString(9));
-      assertEquals("O",res.getString(10));
-      assertEquals("1996-04-12",res.getString(11));
-      assertEquals("1996-02-28",res.getString(12));
-      assertEquals("1996-04-20",res.getString(13));
-      assertEquals("TAKE BACK RETURN",res.getString(14));
-      assertEquals("MAIL",res.getString(15));
-      assertEquals("ly final dependencies: slyly bold ",res.getString(16));
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testSelectDistinct() throws Exception {
-    Set<String> result1 = Sets.newHashSet();
-    result1.add("1,1");
-    result1.add("1,2");
-    result1.add("2,1");
-    result1.add("3,1");
-    result1.add("3,2");
-
-    ResultSet res = tpch.execute(
-        "select distinct l_orderkey, l_linenumber from lineitem");
-    try {
-      int cnt = 0;
-      while(res.next()) {
-        assertTrue(result1.contains(res.getInt(1) + "," + res.getInt(2)));
-        cnt++;
-      }
-      assertEquals(5, cnt);
-    } finally {
-      res.close();
-    }
-
-    res = tpch.execute("select distinct l_orderkey from lineitem");
-    try {
-      Set<Integer> result2 = Sets.newHashSet(1,2,3);
-      int cnt = 0;
-      while (res.next()) {
-        assertTrue(result2.contains(res.getInt(1)));
-        cnt++;
-      }
-      assertEquals(3,cnt);
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testLikeClause() throws Exception {
-    Set<String> result = Sets.newHashSet(
-        "ALGERIA", "ETHIOPIA", "INDIA", "INDONESIA", "ROMANIA", "SAUDI ARABIA", "RUSSIA");
-
-    ResultSet res = tpch.execute(
-        "SELECT n_name FROM nation WHERE n_name LIKE '%IA'");
-    try {
-      int cnt = 0;
-      while(res.next()) {
-        assertTrue(result.contains(res.getString(1)));
-        cnt++;
-      }
-      assertEquals(result.size(), cnt);
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testStringCompare() throws Exception {
-    Set<Integer> result = Sets.newHashSet(1, 3);
-
-    ResultSet res = tpch.execute(
-        "select l_orderkey from lineitem where l_shipdate <= '1996-03-22'");
-    try {
-      int cnt = 0;
-      while(res.next()) {
-        assertTrue(result.contains(res.getInt(1)));
-        cnt++;
-      }
-      assertEquals(3, cnt);
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testRealValueCompare() throws Exception {
-    ResultSet res = tpch.execute("select ps_supplycost from partsupp where ps_supplycost = 771.64");
-
-    try {
-      res.next();
-      assertTrue(771.64f == res.getFloat(1));
-      assertFalse(res.next());
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testCaseWhen() throws Exception {
-    ResultSet res = tpch.execute(
-        "select r_regionkey, " +
-            "case when r_regionkey = 1 then 'one' " +
-            "when r_regionkey = 2 then 'two' " +
-            "when r_regionkey = 3 then 'three' " +
-            "when r_regionkey = 4 then 'four' " +
-            "else 'zero' " +
-            "end as cond from region");
-
-    try {
-      Map<Integer, String> result = Maps.newHashMap();
-      result.put(0, "zero");
-      result.put(1, "one");
-      result.put(2, "two");
-      result.put(3, "three");
-      result.put(4, "four");
-      int cnt = 0;
-      while(res.next()) {
-        assertEquals(result.get(res.getInt(1)), res.getString(2));
-        cnt++;
-      }
-
-      assertEquals(5, cnt);
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testCaseWhenWithoutElse() throws Exception {
-    ResultSet res = tpch.execute("select r_regionkey, " +
-        "case when r_regionkey = 1 then 10 + r_regionkey  " +
-        "when r_regionkey = 2 then 10 + r_regionkey " +
-        "when r_regionkey = 3 then 10 + r_regionkey " +
-        "when r_regionkey = 4 then 10 + r_regionkey " +
-        "end as cond from region");
-
-    try {
-      Map<Integer, Integer> result = Maps.newHashMap();
-      result.put(0, 0);
-      result.put(1, 11);
-      result.put(2, 12);
-      result.put(3, 13);
-      result.put(4, 14);
-      int cnt = 0;
-      while(res.next()) {
-        assertTrue(result.get(res.getInt(1)) == res.getInt(2));
-        cnt++;
-      }
-
-      assertEquals(5, cnt);
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testNotEqual() throws Exception {
-    ResultSet res = tpch.execute(
-        "select l_orderkey from lineitem where l_orderkey != 1");
-    try {
-      assertTrue(res.next());
-      assertEquals(2, res.getInt(1));
-      assertTrue(res.next());
-      assertEquals(3, res.getInt(1));
-      assertTrue(res.next());
-      assertEquals(3, res.getInt(1));
-      assertFalse(res.next());
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testInClause() throws Exception {
-    ResultSet res = tpch.execute(
-        "select l_orderkey from lineitem where l_partkey in (2,3)");
-    try {
-      assertTrue(res.next());
-      assertEquals(2, res.getInt(1));
-      assertTrue(res.next());
-      assertEquals(3, res.getInt(1));
-      assertTrue(res.next());
-      assertEquals(3, res.getInt(1));
-      assertFalse(res.next());
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testInStrClause() throws Exception {
-    ResultSet res = tpch.execute(
-        "select l_orderkey from lineitem where l_returnflag in ('R', 'S')");
-    try {
-      assertTrue(res.next());
-      assertEquals(3, res.getInt(1));
-      assertTrue(res.next());
-      assertEquals(3, res.getInt(1));
-      assertFalse(res.next());
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testNotInStrClause() throws Exception {
-    ResultSet res = tpch.execute(
-        "select l_orderkey from lineitem where l_returnflag not in ('N', 'S')");
-    try {
-      assertTrue(res.next());
-      assertEquals(3, res.getInt(1));
-      assertTrue(res.next());
-      assertEquals(3, res.getInt(1));
-      assertFalse(res.next());
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testNotInClause() throws Exception {
-    ResultSet res = tpch.execute(
-        "select l_orderkey from lineitem where l_partkey not in (2,3)");
-    try {
-      assertTrue(res.next());
-      assertEquals(1, res.getInt(1));
-      assertTrue(res.next());
-      assertEquals(1, res.getInt(1));
-      assertFalse(res.next());
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testUnion1() throws Exception {
-    ResultSet res = tpch.execute(
-        "select o_custkey as num from orders union select c_custkey as num from customer");
-    try {
-      int count = 0;
-      for (;res.next();) {
-        count++;
-      }
-      assertEquals(8, count);
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testUnion2() throws Exception {
-    ResultSet res = tpch.execute(
-        "select l_orderkey from lineitem l1 union select l_orderkey from lineitem l2");
-    try {
-      int count = 0;
-      for (;res.next();) {
-        count++;
-      }
-      assertEquals(10, count);
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testCreateAfterSelect() throws Exception {
-    ResultSet res = tpch.execute(
+    ResultSet res = testingCluster.execute(
         "create table orderkeys as select l_orderkey from lineitem");
     res.close();
-    TajoTestingCluster cluster = tpch.getTestingCluster();
+    TajoTestingCluster cluster = testingCluster.getTestingCluster();
     CatalogService catalog = cluster.getMaster().getCatalog();
     assertTrue(catalog.existsTable("orderkeys"));
     TableDesc orderKeys = catalog.getTableDesc("orderkeys");
@@ -460,23 +187,8 @@ public class TestSelectQuery {
 
   @Test
   public final void testLimit() throws Exception {
-    ResultSet res = tpch.execute("select l_orderkey, l_suppkey from lineitem limit 3");
-
-    int result [][] = {
-        new int [] {1,7706},
-        new int [] {1,7311},
-        new int [] {2,1191},
-    };
-
-    try {
-      for (int i = 0; i < 3; i++) {
-        res.next();
-        assertTrue(res.getInt(1) == result[i][0]);
-        assertTrue(res.getInt(2) == result[i][1]);
-      }
-      assertFalse(res.next());
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestSortQuery.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestSortQuery.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestSortQuery.java
index 102414b..d915ea2 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestSortQuery.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestSortQuery.java
@@ -18,188 +18,62 @@
 
 package org.apache.tajo.engine.query;
 
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
+import org.apache.tajo.IntegrationTest;
+import org.apache.tajo.QueryTestCaseBase;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
-import org.apache.tajo.IntegrationTest;
-import org.apache.tajo.TpchTestBase;
 
-import java.io.IOException;
 import java.sql.ResultSet;
 
-import static org.junit.Assert.*;
-
 @Category(IntegrationTest.class)
-public class TestSortQuery {
-  static TpchTestBase tpch;
-  public TestSortQuery() throws IOException {
-    super();
-  }
-
-  @BeforeClass
-  public static void setUp() throws Exception {
-    tpch = TpchTestBase.getInstance();
-  }
-
-  @AfterClass
-  public static void tearDown() throws Exception {
-  }
+public class TestSortQuery extends QueryTestCaseBase {
 
   @Test
   public final void testSort() throws Exception {
-    ResultSet res = tpch.execute(
-        "select l_linenumber, l_orderkey from lineitem order by l_orderkey");
-    try {
-      int cnt = 0;
-      Long prev = null;
-      while(res.next()) {
-        if (prev == null) {
-          prev = res.getLong(2);
-        } else {
-          assertTrue(prev <= res.getLong(2));
-          prev = res.getLong(2);
-        }
-        cnt++;
-      }
-
-      assertEquals(5, cnt);
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testSortWithAliasKey() throws Exception {
-    ResultSet res = tpch.execute(
-        "select l_linenumber, l_orderkey as sortkey from lineitem order by sortkey");
-    try {
-      int cnt = 0;
-      Long prev = null;
-      while(res.next()) {
-        if (prev == null) {
-          prev = res.getLong(2);
-        } else {
-          assertTrue(prev <= res.getLong(2));
-          prev = res.getLong(2);
-        }
-        cnt++;
-      }
-
-      assertEquals(5, cnt);
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testSortWithAliasButOriginalName() throws Exception {
-    ResultSet res = tpch.execute(
-        "select l_linenumber, l_orderkey as sortkey from lineitem order by l_orderkey");
-    try {
-      int cnt = 0;
-      Long prev = null;
-      while(res.next()) {
-        if (prev == null) {
-          prev = res.getLong(2);
-        } else {
-          assertTrue(prev <= res.getLong(2));
-          prev = res.getLong(2);
-        }
-        cnt++;
-      }
-
-      assertEquals(5, cnt);
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testSortDesc() throws Exception {
-    ResultSet res = tpch.execute(
-        "select l_linenumber, l_orderkey from lineitem order by l_orderkey desc");
-    try {
-      int cnt = 0;
-      Long prev = null;
-      while(res.next()) {
-        if (prev == null) {
-          prev = res.getLong(2);
-        } else {
-          assertTrue(prev >= res.getLong(2));
-          prev = res.getLong(2);
-        }
-        cnt++;
-      }
-
-      assertEquals(5, cnt);
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testTopK() throws Exception {
-    ResultSet res = tpch.execute(
-        "select l_orderkey, l_linenumber from lineitem order by l_orderkey desc limit 3");
-    try {
-      assertTrue(res.next());
-      assertEquals(3, res.getLong(1));
-      assertTrue(res.next());
-      assertEquals(3, res.getLong(1));
-      assertTrue(res.next());
-      assertEquals(2, res.getLong(1));
-      assertFalse(res.next());
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testSortAfterGroupby() throws Exception {
-    ResultSet res = tpch.execute("select max(l_quantity), l_orderkey "
-        + "from lineitem group by l_orderkey order by l_orderkey");
-
-    try {
-      int cnt = 0;
-      Long prev = null;
-      while(res.next()) {
-        if (prev == null) {
-          prev = res.getLong(1);
-        } else {
-          assertTrue(prev <= res.getLong(1));
-          prev = res.getLong(1);
-        }
-        cnt++;
-      }
-
-      assertEquals(3, cnt);
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testSortAfterGroupbyWithAlias() throws Exception {
-    ResultSet res = tpch.execute("select max(l_quantity) as max_quantity, l_orderkey "
-        + "from lineitem group by l_orderkey order by max_quantity");
-
-    try {
-      int cnt = 0;
-      Long prev = null;
-      while(res.next()) {
-        if (prev == null) {
-          prev = res.getLong(1);
-        } else {
-          assertTrue(prev <= res.getLong(1));
-          prev = res.getLong(1);
-        }
-        cnt++;
-      }
-
-      assertEquals(3, cnt);
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestTablePartitions.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestTablePartitions.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestTablePartitions.java
index 4fb5b8a..d4e6e8c 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestTablePartitions.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestTablePartitions.java
@@ -229,7 +229,7 @@ public class TestTablePartitions {
 
   @Test
   public final void testColumnPartitionedTableByThreeColumnsWithCompression() throws Exception {
-    String tableName = "testColumnPartitionedTableNoMatchedPartition";
+    String tableName = "testColumnPartitionedTableByThreeColumnsWithCompression";
     ResultSet res = tpch.execute(
         "create table " + tableName + " (col4 text) USING csv " +
             "WITH ('csvfile.delimiter'='|','compression.codec'='org.apache.hadoop.io.compress.DeflateCodec') " +

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestTableSubQuery.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestTableSubQuery.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestTableSubQuery.java
index b24b03d..bbd533f 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestTableSubQuery.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestTableSubQuery.java
@@ -18,100 +18,38 @@
 
 package org.apache.tajo.engine.query;
 
-import org.apache.tajo.TpchTestBase;
-import org.junit.BeforeClass;
+import org.apache.tajo.QueryTestCaseBase;
 import org.junit.Test;
 
-import java.io.IOException;
 import java.sql.ResultSet;
-import java.util.HashMap;
-import java.util.Map;
 
-import static org.junit.Assert.*;
-
-public class TestTableSubQuery {
-  private static TpchTestBase tpch;
-  public TestTableSubQuery() throws IOException {
-    super();
-  }
-
-  @BeforeClass
-  public static void setUp() throws Exception {
-    tpch = TpchTestBase.getInstance();
-  }
+public class TestTableSubQuery extends QueryTestCaseBase {
 
   @Test
   public final void testTableSubquery1() throws Exception {
-    ResultSet res = tpch.execute(
-        "select l_orderkey from (select * from lineitem) as l");
-    try {
-      int count = 0;
-      for (;res.next();) {
-        count++;
-      }
-      assertEquals(5, count);
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testGroupBySubQuery() throws Exception {
-    ResultSet res = tpch.execute(
-        "select sum(l_extendedprice * l_discount) as revenue from (select * from lineitem) as l");
-    try {
-      assertNotNull(res);
-      assertTrue(res.next());
-      assertTrue(12908 == (int) res.getDouble("revenue"));
-      assertFalse(res.next());
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testJoinSubQuery() throws Exception {
-    ResultSet res = tpch.execute(
-        "SELECT A.n_regionkey, B.r_regionkey, A.n_name, B.r_name " +
-        "FROM\n" +
-        "(SELECT * FROM nation WHERE n_name LIKE 'A%') A " +
-        "JOIN region B ON A.n_regionkey=B.r_regionkey");
-
-    Map<String,String> expected = new HashMap<String, String>();
-    expected.put("ARGENTINA", "AMERICA");
-    expected.put("ALGERIA", "AFRICA");
-    try {
-      assertNotNull(res);
-      assertTrue(res.next());
-      assertTrue(expected.get(res.getString("n_name")).equals(res.getString("r_name")));
-      assertTrue(res.next());
-      assertTrue(expected.get(res.getString("n_name")).equals(res.getString("r_name")));
-      assertFalse(res.next());
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 
   @Test
   public final void testJoinSubQuery2() throws Exception {
-    ResultSet res = tpch.execute(
-        "SELECT A.n_regionkey, B.r_regionkey, A.n_name, B.r_name " +
-            "FROM\n" +
-            "(SELECT * FROM nation WHERE n_name LIKE 'A%') A " +
-            ", region B WHERE A.n_regionkey=B.r_regionkey");
-
-    Map<String,String> expected = new HashMap<String, String>();
-    expected.put("ARGENTINA", "AMERICA");
-    expected.put("ALGERIA", "AFRICA");
-    try {
-      assertNotNull(res);
-      assertTrue(res.next());
-      assertTrue(expected.get(res.getString("n_name")).equals(res.getString("r_name")));
-      assertTrue(res.next());
-      assertTrue(expected.get(res.getString("n_name")).equals(res.getString("r_name")));
-      assertFalse(res.next());
-    } finally {
-      res.close();
-    }
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
   }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/master/TestGlobalPlanner.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/master/TestGlobalPlanner.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/master/TestGlobalPlanner.java
index 0396f33..3cf69a7 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/master/TestGlobalPlanner.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/master/TestGlobalPlanner.java
@@ -118,11 +118,6 @@ public class TestGlobalPlanner {
   }
 
   @Test
-  public void testMultipleJoin() throws Exception {
-    buildPlan(FileUtil.readTextFile(new File("src/test/queries/tpch_q2_simplified.sql")));
-  }
-
-  @Test
   public void testUnion() throws IOException, PlanningException {
     buildPlan("select o_custkey as num from orders union select c_custkey as num from customer union select p_partkey as num from part");
   }
@@ -176,12 +171,12 @@ public class TestGlobalPlanner {
 
   @Test
   public void testComplexUnion1() throws Exception {
-    buildPlan(FileUtil.readTextFile(new File("src/test/queries/complex_union_1.sql")));
+    buildPlan(FileUtil.readTextFile(new File("src/test/resources/queries/default/complex_union_1.sql")));
   }
 
   @Test
   public void testComplexUnion2() throws Exception {
-    buildPlan(FileUtil.readTextFile(new File("src/test/queries/complex_union_2.sql")));
+    buildPlan(FileUtil.readTextFile(new File("src/test/resources/queries/default/complex_union_2.sql")));
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/complex_union_1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/complex_union_1.sql b/tajo-core/tajo-core-backend/src/test/queries/complex_union_1.sql
deleted file mode 100644
index 9020ad7..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/complex_union_1.sql
+++ /dev/null
@@ -1,29 +0,0 @@
-create table xdr_url as
-
-SELECT
-  l_orderkey,
-  l_partkey,
-  query
-FROM
-  (
-  SELECT
-    l_orderkey,
-    l_partkey,
-    'abc' as query
-  FROM
-    lineitem
-  WHERE
-    l_orderkey = 1
-
-  UNION ALL
-
-  SELECT
-    l_orderkey,
-    l_partkey,
-    'bbc' as query
-  FROM
-    lineitem
-  WHERE
-    l_orderkey = 1
-) result
-

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/complex_union_2.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/complex_union_2.sql b/tajo-core/tajo-core-backend/src/test/queries/complex_union_2.sql
deleted file mode 100644
index d54ed27..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/complex_union_2.sql
+++ /dev/null
@@ -1,35 +0,0 @@
-SELECT *
-FROM
-(
-    SELECT
-        l_orderkey,
-        l_partkey,
-        url
-    FROM
-        (
-          SELECT
-            l_orderkey,
-            l_partkey,
-            CASE
-              WHEN
-                l_partkey IS NOT NULL THEN ''
-              WHEN l_orderkey = 1 THEN '1'
-            ELSE
-              '2'
-            END AS url
-          FROM
-            lineitem
-        ) res1
-        JOIN
-        (
-          SELECT
-            *
-          FROM
-            part
-        ) res2
-        ON l_partkey = p_partkey
-) result
-
-
-
-

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/create_partitioned_table_as_select.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/create_partitioned_table_as_select.sql b/tajo-core/tajo-core-backend/src/test/queries/create_partitioned_table_as_select.sql
deleted file mode 100644
index 09b14eb..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/create_partitioned_table_as_select.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-CREATE TABLE sales ( col1 int, col2 int)
-PARTITION BY COLUMN (col3 int, col4 float, col5 text)
-AS SELECT col1, col2, col3, col4, col5 FROM sales_src
-   WHERE col1 > 16
-
-

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/create_table_1.hiveql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/create_table_1.hiveql b/tajo-core/tajo-core-backend/src/test/queries/create_table_1.hiveql
deleted file mode 100644
index c4dcc74..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/create_table_1.hiveql
+++ /dev/null
@@ -1 +0,0 @@
-create table name (name string, age int)

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/create_table_1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/create_table_1.sql b/tajo-core/tajo-core-backend/src/test/queries/create_table_1.sql
deleted file mode 100644
index 8875b0e..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/create_table_1.sql
+++ /dev/null
@@ -1 +0,0 @@
-create table name (name text, age int)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/create_table_10.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/create_table_10.sql b/tajo-core/tajo-core-backend/src/test/queries/create_table_10.sql
deleted file mode 100644
index 43314fa..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/create_table_10.sql
+++ /dev/null
@@ -1 +0,0 @@
-create external table table1 (name text, age int, earn bigint, score float) using csv location '/tmp/data'
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/create_table_11.hiveql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/create_table_11.hiveql b/tajo-core/tajo-core-backend/src/test/queries/create_table_11.hiveql
deleted file mode 100644
index 014bcbe..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/create_table_11.hiveql
+++ /dev/null
@@ -1,3 +0,0 @@
-create external table table1 (name string, age int)
-STORED as rcfile
-location '/user/hive/table1'
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/create_table_11.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/create_table_11.sql b/tajo-core/tajo-core-backend/src/test/queries/create_table_11.sql
deleted file mode 100644
index d6ca3ae..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/create_table_11.sql
+++ /dev/null
@@ -1,3 +0,0 @@
-create external table table1 (name text, age int)
-using rcfile
-location '/user/hive/table1'
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/create_table_12.hiveql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/create_table_12.hiveql b/tajo-core/tajo-core-backend/src/test/queries/create_table_12.hiveql
deleted file mode 100644
index e74d3e3..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/create_table_12.hiveql
+++ /dev/null
@@ -1,4 +0,0 @@
-create external table table1  (name string, age int)
-ROW FORMAT DELIMITED FIELDS TERMINATED BY '|'
-STORED as  textfile
-location '/user/hive/table1'
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/create_table_12.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/create_table_12.sql b/tajo-core/tajo-core-backend/src/test/queries/create_table_12.sql
deleted file mode 100644
index 0816084..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/create_table_12.sql
+++ /dev/null
@@ -1,3 +0,0 @@
-create external table table1 (name text, age int)
-USING csv WITH ('csvfile.delimiter'='|')
-location '/user/hive/table1'
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/create_table_2.hiveql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/create_table_2.hiveql b/tajo-core/tajo-core-backend/src/test/queries/create_table_2.hiveql
deleted file mode 100644
index a5cf55d..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/create_table_2.hiveql
+++ /dev/null
@@ -1 +0,0 @@
-create table name (name string, age int) STORED as  rcfile
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/create_table_2.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/create_table_2.sql b/tajo-core/tajo-core-backend/src/test/queries/create_table_2.sql
deleted file mode 100644
index 4580e82..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/create_table_2.sql
+++ /dev/null
@@ -1 +0,0 @@
-create table name (name text, age int) using rcfile
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/create_table_3.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/create_table_3.sql b/tajo-core/tajo-core-backend/src/test/queries/create_table_3.sql
deleted file mode 100644
index 5ab2af2..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/create_table_3.sql
+++ /dev/null
@@ -1 +0,0 @@
-create table name (name text, age int) using rcfile with ('rcfile.buffer'=4096)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/create_table_4.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/create_table_4.sql b/tajo-core/tajo-core-backend/src/test/queries/create_table_4.sql
deleted file mode 100644
index fe4d580..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/create_table_4.sql
+++ /dev/null
@@ -1 +0,0 @@
-create table name as select * from test
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/create_table_5.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/create_table_5.sql b/tajo-core/tajo-core-backend/src/test/queries/create_table_5.sql
deleted file mode 100644
index b22b841..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/create_table_5.sql
+++ /dev/null
@@ -1 +0,0 @@
-create table name (name text, age int) as select * from test
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/create_table_6.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/create_table_6.sql b/tajo-core/tajo-core-backend/src/test/queries/create_table_6.sql
deleted file mode 100644
index 27e06f2..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/create_table_6.sql
+++ /dev/null
@@ -1 +0,0 @@
-create table name (name text, age int) using rcfile as select * from test
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/create_table_7.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/create_table_7.sql b/tajo-core/tajo-core-backend/src/test/queries/create_table_7.sql
deleted file mode 100644
index 5c9bf35..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/create_table_7.sql
+++ /dev/null
@@ -1 +0,0 @@
-create table name (name text, age int) using rcfile with ('rcfile.buffer'= 4096) as select * from test
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/create_table_8.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/create_table_8.sql b/tajo-core/tajo-core-backend/src/test/queries/create_table_8.sql
deleted file mode 100644
index d6c2ae6..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/create_table_8.sql
+++ /dev/null
@@ -1,48 +0,0 @@
-create table widetable (
-  col0 bit,
-  col1 BIT(10),
-  col2 bit varying,
-  col3 bit VARYING(10),
-  col4 tinyint,
-  col5 smallInt,
-  col6 integer,
-  col7 biginT,
-  col8 real,
-  col9 float,
-  col10 float(53),
-  col11 double,
-  col12 doublE precision,
-  col13 numeric,
-  col14 numeric(10),
-  col15 numeric(10,2),
-  col16 decimal,
-  col17 decimal(10),
-  col18 decimal(10,2),
-  col19 char,
-  col20 character,
-  col21 chaR(10),
-  col22 character(10),
-  col23 varchar,
-  col24 character varying,
-  col25 varchar(255),
-  col26 character varying (255),
-  col27 nchar,
-  col28 nchar(255),
-  col29 national character,
-  col30 national character(255),
-  col31 nvarchar,
-  col32 nvarchar(255),
-  col33 natIonal character varying,
-  col34 national character varying (255),
-  col35 date,
-  col36 time,
-  col37 timetz,
-  col38 time With time zone,
-  col39 timesTamptz,
-  col40 timestamp with time zone,
-  col41 binary,
-  col42 binary(10),
-  col43 varbinary(10),
-  col44 binary Varying(10),
-  col45 blOb
-) as select * from test
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/create_table_9.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/create_table_9.sql b/tajo-core/tajo-core-backend/src/test/queries/create_table_9.sql
deleted file mode 100644
index 49e1e3c..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/create_table_9.sql
+++ /dev/null
@@ -1 +0,0 @@
-create table widetable (col1 float(10), col2 float) as select * from test
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/create_table_partition_by_column.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/create_table_partition_by_column.sql b/tajo-core/tajo-core-backend/src/test/queries/create_table_partition_by_column.sql
deleted file mode 100644
index 397e7ac..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/create_table_partition_by_column.sql
+++ /dev/null
@@ -1,4 +0,0 @@
-CREATE TABLE sales ( col1 int, col2 int)
-PARTITION BY COLUMN (col3 int, col4 float, col5 text);
-
-

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/create_table_partition_by_hash_1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/create_table_partition_by_hash_1.sql b/tajo-core/tajo-core-backend/src/test/queries/create_table_partition_by_hash_1.sql
deleted file mode 100644
index f13225a..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/create_table_partition_by_hash_1.sql
+++ /dev/null
@@ -1,3 +0,0 @@
-CREATE TABLE sales ( col1 int, col2 int)
-PARTITION BY HASH (col1)
-PARTITIONS 2;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/create_table_partition_by_hash_2.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/create_table_partition_by_hash_2.sql b/tajo-core/tajo-core-backend/src/test/queries/create_table_partition_by_hash_2.sql
deleted file mode 100644
index c8fe3c5..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/create_table_partition_by_hash_2.sql
+++ /dev/null
@@ -1,7 +0,0 @@
-CREATE TABLE sales ( col1 int, col2 int)
-PARTITION BY HASH (col1)
-(
-  PARTITION part1,
-  PARTITION part2,
-  PARTITION part3
-);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/create_table_partition_by_list.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/create_table_partition_by_list.sql b/tajo-core/tajo-core-backend/src/test/queries/create_table_partition_by_list.sql
deleted file mode 100644
index 9461e01..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/create_table_partition_by_list.sql
+++ /dev/null
@@ -1,8 +0,0 @@
-CREATE TABLE sales ( col1 int, col2 int)
-PARTITION BY LIST (col1)
- (
-  PARTITION col1 VALUES ('Seoul', '서울'),
-  PARTITION col2 VALUES ('Busan', '부산')
- );
-
-

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/create_table_partition_by_range.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/create_table_partition_by_range.sql b/tajo-core/tajo-core-backend/src/test/queries/create_table_partition_by_range.sql
deleted file mode 100644
index 65c4fdd..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/create_table_partition_by_range.sql
+++ /dev/null
@@ -1,9 +0,0 @@
-CREATE TABLE sales ( col1 int, col2 int)
-PARTITION BY RANGE (col1)
- (
-  PARTITION col1 VALUES LESS THAN (2),
-  PARTITION col1 VALUES LESS THAN (5),
-  PARTITION col1 VALUES LESS THAN (MAXVALUE)
- );
-
-

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/eaf0a585/tajo-core/tajo-core-backend/src/test/queries/create_table_various_types.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/queries/create_table_various_types.sql b/tajo-core/tajo-core-backend/src/test/queries/create_table_various_types.sql
deleted file mode 100644
index 92a4990..0000000
--- a/tajo-core/tajo-core-backend/src/test/queries/create_table_various_types.sql
+++ /dev/null
@@ -1,48 +0,0 @@
-create table various_types (
-  col0 bit,
-  col1 BIT(10),
-  col2 bit varying,
-  col3 bit VARYING(10),
-  col4 tinyint,
-  col5 smallInt,
-  col6 integer,
-  col7 biginT,
-  col8 real,
-  col9 float,
-  col10 float(53),
-  col11 double,
-  col12 doublE precision,
-  col13 numeric,
-  col14 numeric(10),
-  col15 numeric(10,2),
-  col16 decimal,
-  col17 decimal(10),
-  col18 decimal(10,2),
-  col19 char,
-  col20 character,
-  col21 chaR(10),
-  col22 character(10),
-  col23 varchar,
-  col24 character varying,
-  col25 varchar(255),
-  col26 character varying (255),
-  col27 nchar,
-  col28 nchar(255),
-  col29 national character,
-  col30 national character(255),
-  col31 nvarchar,
-  col32 nvarchar(255),
-  col33 natIonal character varying,
-  col34 national character varying (255),
-  col35 date,
-  col36 time,
-  col37 timetz,
-  col38 time With time zone,
-  col39 timesTamptz,
-  col40 timestamp with time zone,
-  col41 binary,
-  col42 binary(10),
-  col43 varbinary(10),
-  col44 binary Varying(10),
-  col45 blOb
-);
\ No newline at end of file