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 2015/08/14 16:30:05 UTC

[26/51] [partial] tajo git commit: TAJO-1761: Separate an integration unit test kit into an independent module.

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation7.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation7.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation7.sql
new file mode 100644
index 0000000..75b3eea
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation7.sql
@@ -0,0 +1,6 @@
+select
+    count(*),
+    count(distinct c_nationkey),
+    count(distinct c_mktsegment)
+from
+    customer
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation8.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation8.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation8.sql
new file mode 100644
index 0000000..0553d06
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation8.sql
@@ -0,0 +1,9 @@
+select
+  sum(distinct l_orderkey),
+  l_linenumber, l_returnflag, l_linestatus, l_shipdate,
+  count(distinct l_partkey),
+  sum(l_orderkey)
+from
+  lineitem
+group by
+  l_linenumber, l_returnflag, l_linestatus, l_shipdate;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregationCaseByCase3.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregationCaseByCase3.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregationCaseByCase3.sql
new file mode 100644
index 0000000..925cadd
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregationCaseByCase3.sql
@@ -0,0 +1,8 @@
+select
+  col1,
+  count(distinct col2) as cnt1,
+  count(distinct case when col3 is not null then col2 else null end) as cnt2
+from
+  table10
+group by
+  col1;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregationCaseByCase4.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregationCaseByCase4.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregationCaseByCase4.sql
new file mode 100644
index 0000000..5941c19
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregationCaseByCase4.sql
@@ -0,0 +1,7 @@
+select
+  col1,
+  count(distinct col2) as cnt
+from
+  testDistinctAggregationCaseByCase4
+group by
+  col1;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregationWithHaving1.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregationWithHaving1.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregationWithHaving1.sql
new file mode 100644
index 0000000..8fc33ae
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregationWithHaving1.sql
@@ -0,0 +1 @@
+select l_linenumber, count(*), count(distinct l_orderkey), sum(distinct l_orderkey) from lineitem group by l_linenumber having sum(distinct l_orderkey) = 6;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregationWithUnion1.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregationWithUnion1.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregationWithUnion1.sql
new file mode 100644
index 0000000..a14f982
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregationWithUnion1.sql
@@ -0,0 +1,21 @@
+select
+  sum(distinct l_orderkey),
+  l_linenumber,
+  count(distinct l_orderkey),
+  count(*) as total
+from
+  (
+    select
+      *
+    from
+      lineitem
+
+    union all
+
+    select
+      *
+    from
+      lineitem
+  ) t1
+group by
+  l_linenumber;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case1.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case1.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case1.sql
new file mode 100644
index 0000000..4f01904
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case1.sql
@@ -0,0 +1,7 @@
+select
+    sum(l_quantity) as quantity,
+    count(distinct l_suppkey) suppkey,
+    l_returnflag
+from
+    lineitem
+group by l_returnflag
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case10.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case10.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case10.sql
new file mode 100644
index 0000000..6ab7c25
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case10.sql
@@ -0,0 +1,5 @@
+select sum(cnt1), sum(sum2)
+from (
+  select o_orderdate, count(distinct o_orderpriority), count(distinct o_orderkey) cnt1, sum(o_totalprice) sum2
+  from orders group by o_orderdate
+) a
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case2.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case2.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case2.sql
new file mode 100644
index 0000000..10f1970
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case2.sql
@@ -0,0 +1,8 @@
+select
+    sum(l_quantity) as quantity,
+    count(distinct l_partkey) as partkey,
+    count(distinct l_suppkey) as suppkey,
+    l_returnflag
+from
+    lineitem
+group by l_returnflag
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case3.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case3.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case3.sql
new file mode 100644
index 0000000..e585d42
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case3.sql
@@ -0,0 +1,9 @@
+select
+    sum(l_quantity) as quantity,
+    count(distinct l_partkey) as partkey,
+    count(distinct l_suppkey),
+    max(l_quantity),
+    l_returnflag
+from
+    lineitem
+group by l_returnflag
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case4.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case4.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case4.sql
new file mode 100644
index 0000000..e8f05de
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case4.sql
@@ -0,0 +1,10 @@
+select
+    l_orderkey,
+    sum(l_quantity) as quantity,
+    count(distinct l_partkey) as partkey,
+    count(distinct l_suppkey),
+    max(l_quantity),
+    l_returnflag
+from
+    lineitem
+group by l_returnflag, l_orderkey
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case5.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case5.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case5.sql
new file mode 100644
index 0000000..9a4d4eb
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case5.sql
@@ -0,0 +1,10 @@
+select
+    l_orderkey,
+    sum(l_quantity) as quantity,
+    count(distinct l_partkey) as partkey,
+    count(distinct l_suppkey),
+    max(l_quantity),
+    l_returnflag
+from
+    (select * from lineitem) as litem
+group by l_returnflag, l_orderkey
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case6.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case6.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case6.sql
new file mode 100644
index 0000000..0a30fe3
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case6.sql
@@ -0,0 +1,12 @@
+select * from (
+select
+    l_orderkey,
+    sum(l_quantity) as quantity,
+    count(distinct l_partkey) as partkey,
+    count(distinct l_suppkey),
+    max(l_quantity),
+    l_returnflag
+from
+    lineitem
+group by l_returnflag, l_orderkey
+) a
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case7.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case7.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case7.sql
new file mode 100644
index 0000000..e08c829
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case7.sql
@@ -0,0 +1,9 @@
+select
+    count(distinct l_orderkey),
+    sum(l_quantity) as quantity,
+    count(distinct l_partkey) as partkey,
+    count(distinct l_suppkey),
+    max(l_quantity)
+from
+    lineitem
+group by l_orderkey
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case8.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case8.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case8.sql
new file mode 100644
index 0000000..ed8e363
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case8.sql
@@ -0,0 +1,10 @@
+select
+    lineitem.l_orderkey as l_orderkey,
+    lineitem.l_partkey as l_partkey,
+    count(distinct lineitem.l_partkey) as cnt1,
+    count(distinct lineitem.l_suppkey) as cnt2,
+    sum(lineitem.l_quantity) as sum1
+from
+    lineitem
+group by
+    lineitem.l_orderkey, lineitem.l_partkey
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case9.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case9.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case9.sql
new file mode 100644
index 0000000..6265599
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation_case9.sql
@@ -0,0 +1,11 @@
+select
+    lineitem.l_orderkey as l_orderkey,
+    count(distinct lineitem.l_partkey) as cnt1,
+    sum(lineitem.l_quantity + lineitem.l_linenumber)/count(distinct lineitem.l_suppkey) as value2,
+    lineitem.l_partkey as l_partkey,
+    avg(lineitem.l_quantity) as avg1,
+    count(distinct lineitem.l_suppkey) as cnt2
+from
+    lineitem
+group by
+    lineitem.l_orderkey, lineitem.l_partkey
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctPythonUdafWithUnion1.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctPythonUdafWithUnion1.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctPythonUdafWithUnion1.sql
new file mode 100644
index 0000000..73e9579
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctPythonUdafWithUnion1.sql
@@ -0,0 +1,21 @@
+select
+  sum(distinct l_orderkey),
+  l_linenumber,
+  count(distinct l_orderkey),
+  countpy() as total
+from
+  (
+    select
+      *
+    from
+      lineitem
+
+    union
+
+    select
+      *
+    from
+      lineitem
+  ) t1
+group by
+  l_linenumber;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupBy.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupBy.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupBy.sql
new file mode 100644
index 0000000..1c6751a
--- /dev/null
+++ b/tajo-core-tests/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/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupBy2.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupBy2.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupBy2.sql
new file mode 100644
index 0000000..7aeab38
--- /dev/null
+++ b/tajo-core-tests/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/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupBy3.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupBy3.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupBy3.sql
new file mode 100644
index 0000000..1e97435
--- /dev/null
+++ b/tajo-core-tests/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/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupBy4.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupBy4.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupBy4.sql
new file mode 100644
index 0000000..4f2c63a
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupBy4.sql
@@ -0,0 +1,9 @@
+select
+  l_orderkey as gkey,
+  count(1) as unique_key
+from
+  lineitem
+group by
+  lineitem.l_orderkey
+order by
+  gkey;
\ No newline at end of file

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

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

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByNested2.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByNested2.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByNested2.sql
new file mode 100644
index 0000000..eb86ce0
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByNested2.sql
@@ -0,0 +1,10 @@
+select * from (
+select
+  sum(l_orderkey) + sum(l_partkey) as total
+from
+  lineitem
+group by
+  l_orderkey + l_partkey
+) t1
+order by
+  total;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithConstantKeys1.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithConstantKeys1.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithConstantKeys1.sql
new file mode 100644
index 0000000..52541aa
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithConstantKeys1.sql
@@ -0,0 +1 @@
+select 123 as key, count(1) as total from lineitem group by key order by key, total;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithConstantKeys2.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithConstantKeys2.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithConstantKeys2.sql
new file mode 100644
index 0000000..5a2892d
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithConstantKeys2.sql
@@ -0,0 +1 @@
+select l_partkey as a, timestamp '2014-07-07 04:28:31.561' as b, '##' as c, count(*) d from lineitem group by a, b, c order by l_partkey;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithConstantKeys3.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithConstantKeys3.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithConstantKeys3.sql
new file mode 100644
index 0000000..568009d
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithConstantKeys3.sql
@@ -0,0 +1,8 @@
+select
+  timestamp '2014-07-07 04:28:31.561' as b,
+  '##' as c,
+  count(*) d
+from
+  lineitem
+group by
+  b, c;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithConstantKeys4.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithConstantKeys4.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithConstantKeys4.sql
new file mode 100644
index 0000000..4de4dda
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithConstantKeys4.sql
@@ -0,0 +1,12 @@
+select
+  'day',
+  l_orderkey,
+  count(*) as sum
+from
+  lineitem
+group by
+  'day',
+  l_orderkey
+order by
+  'day',
+  l_orderkey;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithConstantKeys5.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithConstantKeys5.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithConstantKeys5.sql
new file mode 100644
index 0000000..4132d37
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithConstantKeys5.sql
@@ -0,0 +1,13 @@
+select
+  'day',
+  'day' as key,
+  l_orderkey,
+  count(*) as sum
+from
+  lineitem
+group by
+  'day',
+  l_orderkey
+order by
+  'day',
+  l_orderkey;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithExpressionKeys1.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithExpressionKeys1.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithExpressionKeys1.sql
new file mode 100644
index 0000000..4dbc2ce
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithExpressionKeys1.sql
@@ -0,0 +1 @@
+select upper(lower(l_orderkey::text)) as key, count(1) as total from lineitem group by key order by upper(lower(l_orderkey::text)), total;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithExpressionKeys2.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithExpressionKeys2.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithExpressionKeys2.sql
new file mode 100644
index 0000000..c98c121
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithExpressionKeys2.sql
@@ -0,0 +1 @@
+select upper(lower(l_orderkey::text)) as key, count(1) as total from lineitem group by upper(lower(l_orderkey::text)) order by upper(lower(l_orderkey::text)), total;
\ No newline at end of file

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

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData10.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData10.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData10.sql
new file mode 100644
index 0000000..98546db
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData10.sql
@@ -0,0 +1,3 @@
+select count(distinct l_linenumber) as unique_key, count(distinct l_returnflag || l_linestatus) flag
+from lineitem
+where l_orderkey = 1000
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData11.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData11.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData11.sql
new file mode 100644
index 0000000..3fae412
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData11.sql
@@ -0,0 +1,5 @@
+select l_orderkey, count(distinct l_linenumber) as unique_key
+, count(distinct l_returnflag || l_linestatus) flag
+from lineitem
+where l_orderkey = 1000
+group by l_orderkey;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData12.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData12.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData12.sql
new file mode 100644
index 0000000..3a94d82
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData12.sql
@@ -0,0 +1,29 @@
+select
+	s.s_acctbal,
+	s.s_name,
+	n.t_name,
+	p.p_partkey,
+	p.p_mfgr,
+	s.s_address,
+	s.s_phone,
+	s.s_comment
+from (
+   select n_name as t_name, n_nationkey as t_nationkey
+    , n_regionkey as t_regionkey
+    , count(distinct n_comment) as cnt
+    , count(distinct n_nationkey / n_regionkey) as diff
+   from nation
+   where n_nationkey > 10000
+   group by n_name, n_nationkey, n_regionkey, n_regionkey
+) n
+join region r on (n.t_regionkey = r.r_regionkey)
+join supplier s on (s.s_nationkey = n.t_nationkey)
+join partsupp ps on (s.s_suppkey = ps.ps_suppkey)
+join part p on (p.p_partkey = ps.ps_partkey)
+where n.t_regionkey = ps.ps_suppkey
+and n.cnt > 0
+order by
+  s.s_acctbal,
+  s.s_name,
+  n.t_name,
+  p.p_partkey;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData2.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData2.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData2.sql
new file mode 100644
index 0000000..84351af
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData2.sql
@@ -0,0 +1 @@
+select count(1) as unique_key, max(l_orderkey) as max_key from lineitem where l_orderkey = 1000;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData3.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData3.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData3.sql
new file mode 100644
index 0000000..c6c23c6
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData3.sql
@@ -0,0 +1,3 @@
+select max(l_orderkey) as maximum, count(l_linenumber) as unique_key
+from lineitem
+where l_orderkey = 1000
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData4.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData4.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData4.sql
new file mode 100644
index 0000000..ee345f9
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData4.sql
@@ -0,0 +1,3 @@
+select max(l_orderkey) as maximum, count(distinct l_linenumber) as unique_key
+from lineitem
+where l_orderkey = 1000
\ No newline at end of file

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

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData6.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData6.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData6.sql
new file mode 100644
index 0000000..0e87731
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData6.sql
@@ -0,0 +1 @@
+select count(distinct age) as unique_key, max(point) as maximum from testGroupByWithNullData6;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData7.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData7.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData7.sql
new file mode 100644
index 0000000..1127bee
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData7.sql
@@ -0,0 +1 @@
+select max(point) as maximum, count(distinct age) as unique_key from testGroupByWithNullData7 where age > 100;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData8.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData8.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData8.sql
new file mode 100644
index 0000000..74c83fc
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData8.sql
@@ -0,0 +1 @@
+select max(point) as maximum, count(age) as unique_key from testGroupByWithNullData8;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData9.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData9.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData9.sql
new file mode 100644
index 0000000..56fb65c
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithNullData9.sql
@@ -0,0 +1,4 @@
+select l_orderkey, count(distinct l_linenumber) as unique_key
+from lineitem
+where l_orderkey = 1000
+group by l_orderkey
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithSameConstantKeys1.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithSameConstantKeys1.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithSameConstantKeys1.sql
new file mode 100644
index 0000000..c8c3db7
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithSameConstantKeys1.sql
@@ -0,0 +1 @@
+select l_partkey as a, '##' as b, '##' as c, count(*) d from lineitem group by a, b, c order by a;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithSameExprs1.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithSameExprs1.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithSameExprs1.sql
new file mode 100644
index 0000000..a04745e
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithSameExprs1.sql
@@ -0,0 +1,8 @@
+select
+  sum(l_orderkey) + sum(l_orderkey) as total
+from
+  lineitem
+group by
+  l_orderkey + l_partkey
+order by
+  l_orderkey + l_partkey;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithSameExprs2.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithSameExprs2.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithSameExprs2.sql
new file mode 100644
index 0000000..074e252
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupByWithSameExprs2.sql
@@ -0,0 +1,8 @@
+select
+  sum(l_orderkey) as total1 , sum(l_orderkey) as total2
+from
+  lineitem
+group by
+  l_orderkey + l_partkey
+order by
+  total1, total2;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupbyWithJson.json
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupbyWithJson.json b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupbyWithJson.json
new file mode 100644
index 0000000..072cf9b
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupbyWithJson.json
@@ -0,0 +1,127 @@
+// select l_orderkey, avg(l_partkey) total, sum(l_linenumber) as num from lineitem group by l_orderkey
+// having total >= 2 or num = 3;
+{
+    "IsDistinct": false,
+    "Projections": [
+        {
+            "Expr": {
+                "ColumnName": "l_orderkey",
+                "OpType": "Column"
+            },
+            "OpType": "Target"
+        },
+        {
+            "AliasName": "total",
+            "Expr": {
+                "IsDistinct": false,
+                "Signature": "avg",
+                "FuncParams": [
+                    {
+                        "ColumnName": "l_partkey",
+                        "OpType": "Column"
+                    }
+                ],
+                "OpType": "GeneralSetFunction"
+            },
+            "OpType": "Target"
+        },
+        {
+            "AliasName": "num",
+            "Expr": {
+                "IsDistinct": false,
+                "Signature": "sum",
+                "FuncParams": [
+                    {
+                        "ColumnName": "l_linenumber",
+                        "OpType": "Column"
+                    }
+                ],
+                "OpType": "GeneralSetFunction"
+            },
+            "OpType": "Target"
+        }
+    ],
+    "Expr": {
+        "SortSpecs": [
+            {
+                "SortKey": {
+                    "ColumnName": "l_orderkey",
+                    "OpType": "Column"
+                },
+                "IsAsc": true,
+                "IsNullFirst": false
+            },
+            {
+                "SortKey": {
+                    "ColumnName": "total",
+                    "OpType": "Column"
+                },
+                "IsAsc": true,
+                "IsNullFirst": false
+            },
+            {
+                "SortKey": {
+                    "ColumnName": "num",
+                    "OpType": "Column"
+                },
+                "IsAsc": true,
+                "IsNullFirst": false
+            }
+        ],
+        "Expr": {
+            "HavingCondition": {
+                "LeftExpr": {
+                    "LeftExpr": {
+                        "ColumnName": "total",
+                        "OpType": "Column"
+                    },
+                    "RightExpr": {
+                        "Value": "2",
+                        "ValueType": "Unsigned_Integer",
+                        "OpType": "Literal"
+                    },
+                    "OpType": "GreaterThanOrEquals"
+                },
+                "RightExpr": {
+                    "LeftExpr": {
+                        "ColumnName": "num",
+                        "OpType": "Column"
+                    },
+                    "RightExpr": {
+                        "Value": "3",
+                        "ValueType": "Unsigned_Integer",
+                        "OpType": "Literal"
+                    },
+                    "OpType": "Equals"
+                },
+                "OpType": "Or"
+            },
+            "Expr": {
+                "Groups": [
+                    {
+                        "GroupType": "OrdinaryGroup",
+                        "Dimensions": [
+                            {
+                                "ColumnName": "l_orderkey",
+                                "OpType": "Column"
+                            }
+                        ]
+                    }
+                ],
+                "Expr": {
+                    "Relations": [
+                        {
+                            "TableName": "lineitem",
+                            "OpType": "Relation"
+                        }
+                    ],
+                    "OpType": "RelationList"
+                },
+                "OpType": "Aggregation"
+            },
+            "OpType": "Having"
+        },
+        "OpType": "Sort"
+    },
+    "OpType": "Projection"
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupbyWithLimit1.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupbyWithLimit1.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupbyWithLimit1.sql
new file mode 100644
index 0000000..06d96af
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupbyWithLimit1.sql
@@ -0,0 +1 @@
+select sum(l_linenumber) from lineitem limit 1;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupbyWithLimit2.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupbyWithLimit2.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupbyWithLimit2.sql
new file mode 100644
index 0000000..1ddb171
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupbyWithLimit2.sql
@@ -0,0 +1 @@
+select sum(l_linenumber) from lineitem limit 10;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupbyWithLimit3.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupbyWithLimit3.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupbyWithLimit3.sql
new file mode 100644
index 0000000..fd1e5fb
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupbyWithLimit3.sql
@@ -0,0 +1 @@
+select l_orderkey, sum(l_linenumber) from lineitem group by l_orderkey order by l_orderkey limit 1;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupbyWithPythonFunc.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupbyWithPythonFunc.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupbyWithPythonFunc.sql
new file mode 100644
index 0000000..8100f11
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupbyWithPythonFunc.sql
@@ -0,0 +1 @@
+select count(*) from nation where add_py(n_nationkey, 1) > 2 group by n_regionkey
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupbyWithPythonFunc2.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupbyWithPythonFunc2.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupbyWithPythonFunc2.sql
new file mode 100644
index 0000000..bcfce13
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testGroupbyWithPythonFunc2.sql
@@ -0,0 +1 @@
+select n_regionkey, count(*) as cnt from nation group by n_regionkey having percent(cnt, 25) > 10
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testHavingWithAggFunction.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testHavingWithAggFunction.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testHavingWithAggFunction.sql
new file mode 100644
index 0000000..9103ffc
--- /dev/null
+++ b/tajo-core-tests/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/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testHavingWithNamedTarget.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testHavingWithNamedTarget.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testHavingWithNamedTarget.sql
new file mode 100644
index 0000000..87a784f
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testHavingWithNamedTarget.sql
@@ -0,0 +1,13 @@
+select
+  l_orderkey,
+  avg(l_partkey) total,
+  sum(l_linenumber) as num
+from
+  lineitem
+group by
+  l_orderkey
+having
+  total >= 2 or num = 3
+order by
+  l_orderkey,
+  total;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testPythonUdaf.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testPythonUdaf.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testPythonUdaf.sql
new file mode 100644
index 0000000..e29816b
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testPythonUdaf.sql
@@ -0,0 +1 @@
+select avgpy(n_nationkey), avg(n_nationkey), countpy() from nation;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testPythonUdaf2.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testPythonUdaf2.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testPythonUdaf2.sql
new file mode 100644
index 0000000..b08ff1e
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testPythonUdaf2.sql
@@ -0,0 +1 @@
+select countpy(), count(*) from lineitem group by l_linenumber
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testPythonUdaf3.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testPythonUdaf3.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testPythonUdaf3.sql
new file mode 100644
index 0000000..406442f
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testPythonUdaf3.sql
@@ -0,0 +1 @@
+select avgpy(o_totalprice), countpy(), avg(o_totalprice), count(*) from orders group by o_custkey, o_orderdate
\ No newline at end of file

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

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testPythonUdafWithNullData.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testPythonUdafWithNullData.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testPythonUdafWithNullData.sql
new file mode 100644
index 0000000..56fb65c
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testPythonUdafWithNullData.sql
@@ -0,0 +1,4 @@
+select l_orderkey, count(distinct l_linenumber) as unique_key
+from lineitem
+where l_orderkey = 1000
+group by l_orderkey
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInSubquery/testInAndNotInSubQuery.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInSubquery/testInAndNotInSubQuery.sql b/tajo-core-tests/src/test/resources/queries/TestInSubquery/testInAndNotInSubQuery.sql
new file mode 100644
index 0000000..8ef5077
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInSubquery/testInAndNotInSubQuery.sql
@@ -0,0 +1,3 @@
+select n_name from nation
+where n_regionkey in (select r_regionkey from region)
+  and n_nationkey not in (select s_nationkey from supplier)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInSubquery/testInSubQuery.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInSubquery/testInSubQuery.sql b/tajo-core-tests/src/test/resources/queries/TestInSubquery/testInSubQuery.sql
new file mode 100644
index 0000000..48928a1
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInSubquery/testInSubQuery.sql
@@ -0,0 +1 @@
+select n_name from nation where n_regionkey in (select r_regionkey from region)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInSubquery/testInSubQuery2.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInSubquery/testInSubQuery2.sql b/tajo-core-tests/src/test/resources/queries/TestInSubquery/testInSubQuery2.sql
new file mode 100644
index 0000000..eff1e7b
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInSubquery/testInSubQuery2.sql
@@ -0,0 +1,2 @@
+select n_name from nation
+where n_nationkey in (select count(*) from region)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInSubquery/testInSubQueryWithJoin.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInSubquery/testInSubQueryWithJoin.sql b/tajo-core-tests/src/test/resources/queries/TestInSubquery/testInSubQueryWithJoin.sql
new file mode 100644
index 0000000..178b601
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInSubquery/testInSubQueryWithJoin.sql
@@ -0,0 +1,2 @@
+select n_name from nation, supplier
+where n_regionkey in (select r_regionkey from region) and n_nationkey = s_nationkey
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInSubquery/testInSubQueryWithOtherConditions.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInSubquery/testInSubQueryWithOtherConditions.sql b/tajo-core-tests/src/test/resources/queries/TestInSubquery/testInSubQueryWithOtherConditions.sql
new file mode 100644
index 0000000..47a23fa
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInSubquery/testInSubQueryWithOtherConditions.sql
@@ -0,0 +1,2 @@
+select n_name from nation where n_regionkey in (
+  select r_regionkey from region) and n_nationkey > 1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInSubquery/testInSubQueryWithTableSubQuery.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInSubquery/testInSubQueryWithTableSubQuery.sql b/tajo-core-tests/src/test/resources/queries/TestInSubquery/testInSubQueryWithTableSubQuery.sql
new file mode 100644
index 0000000..8645df1
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInSubquery/testInSubQueryWithTableSubQuery.sql
@@ -0,0 +1,2 @@
+select n_name from (select * from nation where n_nationkey > 1 and n_nationkey < 10) as T
+where n_regionkey in (select r_regionkey from region where r_regionkey > 1 and r_regionkey < 3);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInSubquery/testMultipleInSubQuery.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInSubquery/testMultipleInSubQuery.sql b/tajo-core-tests/src/test/resources/queries/TestInSubquery/testMultipleInSubQuery.sql
new file mode 100644
index 0000000..b93041f
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInSubquery/testMultipleInSubQuery.sql
@@ -0,0 +1,5 @@
+select n_name from nation
+where
+  n_regionkey in (select r_regionkey from region)
+  and
+  n_nationkey in (select s_nationkey from supplier)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInSubquery/testMultipleNotInSubQuery.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInSubquery/testMultipleNotInSubQuery.sql b/tajo-core-tests/src/test/resources/queries/TestInSubquery/testMultipleNotInSubQuery.sql
new file mode 100644
index 0000000..bd85ded
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInSubquery/testMultipleNotInSubQuery.sql
@@ -0,0 +1,3 @@
+select n_name from nation
+where n_nationkey not in (select r_regionkey from region)
+  and n_nationkey not in (select s_nationkey from supplier)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInSubquery/testNestedInAndNotInSubQuery.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInSubquery/testNestedInAndNotInSubQuery.sql b/tajo-core-tests/src/test/resources/queries/TestInSubquery/testNestedInAndNotInSubQuery.sql
new file mode 100644
index 0000000..8e4c6ba
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInSubquery/testNestedInAndNotInSubQuery.sql
@@ -0,0 +1,5 @@
+select c_name from customer
+  where c_nationkey in (
+    select n_nationkey from nation where n_name like 'C%' and n_regionkey
+    not in (
+      select count(*) from region where r_regionkey > 0 and r_regionkey < 3))
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInSubquery/testNestedInSubQuery.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInSubquery/testNestedInSubQuery.sql b/tajo-core-tests/src/test/resources/queries/TestInSubquery/testNestedInSubQuery.sql
new file mode 100644
index 0000000..902dfd7
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInSubquery/testNestedInSubQuery.sql
@@ -0,0 +1,4 @@
+select c_name from customer
+where c_nationkey in (
+  select n_nationkey from nation where n_name like 'C%' and n_regionkey in (
+    select r_regionkey from region where r_regionkey > 0 and r_regionkey < 3))
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInSubquery/testNestedInSubQuery2.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInSubquery/testNestedInSubQuery2.sql b/tajo-core-tests/src/test/resources/queries/TestInSubquery/testNestedInSubQuery2.sql
new file mode 100644
index 0000000..4965ec2
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInSubquery/testNestedInSubQuery2.sql
@@ -0,0 +1,4 @@
+select c_name from customer
+  where c_nationkey in (
+    select n_nationkey from nation where n_name like 'C%' and n_regionkey in (
+    select count(*) - 1 from region where r_regionkey > 0 and r_regionkey < 3))
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInSubquery/testNestedNotInSubQuery.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInSubquery/testNestedNotInSubQuery.sql b/tajo-core-tests/src/test/resources/queries/TestInSubquery/testNestedNotInSubQuery.sql
new file mode 100644
index 0000000..a2cea67
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInSubquery/testNestedNotInSubQuery.sql
@@ -0,0 +1,4 @@
+select c_name from customer
+where c_nationkey not in (
+  select n_nationkey from nation where n_name like 'C%' and n_regionkey not in (
+    select r_regionkey from region where r_regionkey > 0 and r_regionkey < 3))
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInSubquery/testNotInSubQuery.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInSubquery/testNotInSubQuery.sql b/tajo-core-tests/src/test/resources/queries/TestInSubquery/testNotInSubQuery.sql
new file mode 100644
index 0000000..cb05624
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInSubquery/testNotInSubQuery.sql
@@ -0,0 +1 @@
+select n_name from nation where n_nationkey not in (select r_regionkey from region)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInSubquery/testSameKeyNameOfOuterAndInnerQueries.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInSubquery/testSameKeyNameOfOuterAndInnerQueries.sql b/tajo-core-tests/src/test/resources/queries/TestInSubquery/testSameKeyNameOfOuterAndInnerQueries.sql
new file mode 100644
index 0000000..c8d3bf4
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInSubquery/testSameKeyNameOfOuterAndInnerQueries.sql
@@ -0,0 +1,22 @@
+select
+  n_regionkey, count(*)
+from
+  customer, lineitem, orders, supplier, nation
+where
+  l_orderkey = o_orderkey and
+  c_custkey = o_custkey and
+  l_linenumber = s_suppkey and
+  l_partkey in (
+    select
+      l_partkey
+    from
+      lineitem
+    where
+      l_linenumber in (1, 3, 5, 7, 9)
+  ) and
+  n_nationkey = c_nationkey
+group by
+  n_regionkey
+order by
+  n_regionkey
+limit 100;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInSubquery/testWithAsteriskAndJoin.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInSubquery/testWithAsteriskAndJoin.sql b/tajo-core-tests/src/test/resources/queries/TestInSubquery/testWithAsteriskAndJoin.sql
new file mode 100644
index 0000000..d5e2bfa
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInSubquery/testWithAsteriskAndJoin.sql
@@ -0,0 +1,7 @@
+select
+  *
+from
+  lineitem, orders
+where
+  l_orderkey = o_orderkey and
+  l_partkey in (select l_partkey from lineitem where l_linenumber in (1, 3, 5, 7, 9))
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInnerJoinQuery/testBroadcastTwoPartJoin.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInnerJoinQuery/testBroadcastTwoPartJoin.sql b/tajo-core-tests/src/test/resources/queries/TestInnerJoinQuery/testBroadcastTwoPartJoin.sql
new file mode 100644
index 0000000..36c53cd
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInnerJoinQuery/testBroadcastTwoPartJoin.sql
@@ -0,0 +1,19 @@
+select
+    l_orderkey,
+    p_name,
+    n_name
+from
+    lineitem,
+    orders,
+    part,
+    customer,
+    nation
+where
+    l_orderkey = o_orderkey
+    and l_partkey = p_partkey
+    and o_custkey = c_custkey
+    and c_nationkey = n_nationkey
+order by
+    l_orderkey,
+    p_name,
+    n_name

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInnerJoinQuery/testCrossJoinAndCaseWhen.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInnerJoinQuery/testCrossJoinAndCaseWhen.sql b/tajo-core-tests/src/test/resources/queries/TestInnerJoinQuery/testCrossJoinAndCaseWhen.sql
new file mode 100644
index 0000000..d058aba
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInnerJoinQuery/testCrossJoinAndCaseWhen.sql
@@ -0,0 +1,18 @@
+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
+order by
+  r_regionkey,
+  n_regionkey
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInnerJoinQuery/testCrossJoinWithAsterisk1.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInnerJoinQuery/testCrossJoinWithAsterisk1.sql b/tajo-core-tests/src/test/resources/queries/TestInnerJoinQuery/testCrossJoinWithAsterisk1.sql
new file mode 100644
index 0000000..111a371
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInnerJoinQuery/testCrossJoinWithAsterisk1.sql
@@ -0,0 +1 @@
+select region.*, customer.* from region, customer order by r_regionkey,r_name,c_custkey;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInnerJoinQuery/testCrossJoinWithAsterisk2.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInnerJoinQuery/testCrossJoinWithAsterisk2.sql b/tajo-core-tests/src/test/resources/queries/TestInnerJoinQuery/testCrossJoinWithAsterisk2.sql
new file mode 100644
index 0000000..ca1672e
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInnerJoinQuery/testCrossJoinWithAsterisk2.sql
@@ -0,0 +1 @@
+select region.*, customer.* from customer, region order by r_regionkey,r_name,c_custkey;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInnerJoinQuery/testCrossJoinWithAsterisk3.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInnerJoinQuery/testCrossJoinWithAsterisk3.sql b/tajo-core-tests/src/test/resources/queries/TestInnerJoinQuery/testCrossJoinWithAsterisk3.sql
new file mode 100644
index 0000000..fd44916
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInnerJoinQuery/testCrossJoinWithAsterisk3.sql
@@ -0,0 +1 @@
+select * from customer, region order by c_custkey,c_name,r_regionkey;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInnerJoinQuery/testCrossJoinWithAsterisk4.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInnerJoinQuery/testCrossJoinWithAsterisk4.sql b/tajo-core-tests/src/test/resources/queries/TestInnerJoinQuery/testCrossJoinWithAsterisk4.sql
new file mode 100644
index 0000000..fc5b1c3
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInnerJoinQuery/testCrossJoinWithAsterisk4.sql
@@ -0,0 +1 @@
+select length(r_comment) as len, *, c_custkey*10 from customer, region order by len,r_regionkey,r_name,c_custkey;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInnerJoinWithSubQuery/testBroadcastSubquery.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInnerJoinWithSubQuery/testBroadcastSubquery.sql b/tajo-core-tests/src/test/resources/queries/TestInnerJoinWithSubQuery/testBroadcastSubquery.sql
new file mode 100644
index 0000000..88e1f72
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInnerJoinWithSubQuery/testBroadcastSubquery.sql
@@ -0,0 +1,12 @@
+select
+    l_orderkey,
+    a.o_custkey,
+    p_name
+from
+    lineitem,
+    part,
+    (select o_orderkey, o_custkey from orders) a
+where
+    l_partkey = p_partkey
+    and l_orderkey = a.o_orderkey
+order by l_orderkey, o_custkey, p_name
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInnerJoinWithSubQuery/testBroadcastSubquery2.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInnerJoinWithSubQuery/testBroadcastSubquery2.sql b/tajo-core-tests/src/test/resources/queries/TestInnerJoinWithSubQuery/testBroadcastSubquery2.sql
new file mode 100644
index 0000000..f3b0995
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInnerJoinWithSubQuery/testBroadcastSubquery2.sql
@@ -0,0 +1,19 @@
+select sum(b.l_quantity)
+from (
+      select a.l_orderkey, a.l_quantity, a.l_linenumber
+        from lineitem a
+        join part on a.l_partkey = p_partkey) b
+join orders c on c.o_orderkey = b.l_orderkey
+join (
+      select e.l_orderkey, avg(e.l_quantity) avg_quantity
+      from (
+          select d.l_orderkey, d.l_quantity
+            from lineitem d
+            join part on d.l_partkey = p_partkey
+      ) e
+      group by e.l_orderkey
+) f
+on c.o_orderkey = f.l_orderkey
+where
+  c.o_orderkey > 0 and
+  b.l_quantity > f.avg_quantity
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInnerJoinWithSubQuery/testThetaJoinKeyPairs.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInnerJoinWithSubQuery/testThetaJoinKeyPairs.sql b/tajo-core-tests/src/test/resources/queries/TestInnerJoinWithSubQuery/testThetaJoinKeyPairs.sql
new file mode 100644
index 0000000..802e2b0
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInnerJoinWithSubQuery/testThetaJoinKeyPairs.sql
@@ -0,0 +1,20 @@
+select
+  n_nationkey, n_name, n_regionkey, t.cnt
+from
+  nation n
+  join
+  (
+    select
+      r_regionkey, count(*) as cnt
+    from
+      nation n
+      join
+      region r
+    on (n.n_regionkey = r.r_regionkey)
+    group by
+      r_regionkey
+  ) t
+on
+  (n.n_regionkey = t.r_regionkey) and n.n_nationkey > t.cnt
+order by
+  n_nationkey
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInsertQuery/full_table_csv_ddl.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInsertQuery/full_table_csv_ddl.sql b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/full_table_csv_ddl.sql
new file mode 100644
index 0000000..729ca83
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/full_table_csv_ddl.sql
@@ -0,0 +1 @@
+create table full_table_csv as select * from default.lineitem
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInsertQuery/full_table_parquet_ddl.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInsertQuery/full_table_parquet_ddl.sql b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/full_table_parquet_ddl.sql
new file mode 100644
index 0000000..1025b3b
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/full_table_parquet_ddl.sql
@@ -0,0 +1 @@
+create table full_table_parquet using parquet as select * from default.lineitem;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInsertQuery/lineitem_year_month_ddl.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInsertQuery/lineitem_year_month_ddl.sql b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/lineitem_year_month_ddl.sql
new file mode 100644
index 0000000..fb18ad8
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/lineitem_year_month_ddl.sql
@@ -0,0 +1,18 @@
+create table lineitem_year_month (
+ l_orderkey bigint,
+ l_partkey bigint,
+ l_suppkey bigint,
+ l_linenumber int,
+ l_quantity float8,
+ l_extendedprice float8,
+ l_discount float8,
+ l_tax float8,
+ l_returnflag text,
+ l_linestatus text,
+ l_shipdate text,
+ l_commitdate text,
+ l_receiptdate text,
+ l_shipinstruct text,
+ l_shipmode text,
+ l_comment text
+) PARTITION BY COLUMN (year TEXT, MONTH TEXT);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInsertQuery/load_to_lineitem_year_month.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInsertQuery/load_to_lineitem_year_month.sql b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/load_to_lineitem_year_month.sql
new file mode 100644
index 0000000..601af12
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/load_to_lineitem_year_month.sql
@@ -0,0 +1 @@
+INSERT INTO lineitem_year_month SELECT *, SUBSTR(l_shipdate, 1,4) as year, SUBSTR(l_shipdate, 6, 2) as month FROM default.lineitem;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInsertQuery/nation_diff_col_order.ddl
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInsertQuery/nation_diff_col_order.ddl b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/nation_diff_col_order.ddl
new file mode 100644
index 0000000..6998304
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/nation_diff_col_order.ddl
@@ -0,0 +1 @@
+create table nation_diff (n_nationkey int8, n_name text, n_regionkey int8, n_comment text);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInsertQuery/table1_ddl.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInsertQuery/table1_ddl.sql b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/table1_ddl.sql
new file mode 100644
index 0000000..b8333c4
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/table1_ddl.sql
@@ -0,0 +1 @@
+create table table1 (col1 int4, col2 int4, col3 float8)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInsertQuery/test1_ddl.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInsertQuery/test1_ddl.sql b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/test1_ddl.sql
new file mode 100644
index 0000000..c02b080
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/test1_ddl.sql
@@ -0,0 +1 @@
+create table test1 (col1 char(5));
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInsertQuery/test1_nolength_ddl.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInsertQuery/test1_nolength_ddl.sql b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/test1_nolength_ddl.sql
new file mode 100644
index 0000000..cbe3654
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/test1_nolength_ddl.sql
@@ -0,0 +1 @@
+create table test1 (col1 char);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertInto.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertInto.sql b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertInto.sql
new file mode 100644
index 0000000..9656694
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertInto.sql
@@ -0,0 +1 @@
+insert into table1 select l_orderkey, l_partkey, l_quantity from default.lineitem;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertIntoSelectWithFixedSizeChar.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertIntoSelectWithFixedSizeChar.sql b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertIntoSelectWithFixedSizeChar.sql
new file mode 100644
index 0000000..f7ec11c
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertIntoSelectWithFixedSizeChar.sql
@@ -0,0 +1,4 @@
+insert into test1 select 'a';
+insert into test1 select 'abc';
+insert into test1 select 'abcde';
+select * from test1;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertIntoSelectWithFixedSizeCharWithNoLength.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertIntoSelectWithFixedSizeCharWithNoLength.sql b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertIntoSelectWithFixedSizeCharWithNoLength.sql
new file mode 100644
index 0000000..02a1d6c
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertIntoSelectWithFixedSizeCharWithNoLength.sql
@@ -0,0 +1,2 @@
+insert into test1 select 'a';
+select * from test1;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwrite.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwrite.sql b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwrite.sql
new file mode 100644
index 0000000..db18c0e
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwrite.sql
@@ -0,0 +1 @@
+insert overwrite into table1 select l_orderkey, l_partkey, l_quantity from default.lineitem;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteLocation.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteLocation.sql b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteLocation.sql
new file mode 100644
index 0000000..28ac95c
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteLocation.sql
@@ -0,0 +1 @@
+insert overwrite into location '/tajo-data/testInsertOverwriteCapitalTableName' select * from default.lineitem where l_orderkey = 3;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteLocationWithCompression.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteLocationWithCompression.sql b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteLocationWithCompression.sql
new file mode 100644
index 0000000..3582403
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteLocationWithCompression.sql
@@ -0,0 +1 @@
+insert overwrite into location '/tajo-data/testInsertOverwriteLocationWithCompression' USING text WITH ('text.delimiter'='|','compression.codec'='org.apache.hadoop.io.compress.DeflateCodec') select * from default.lineitem where l_orderkey = 3;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteLocationWithUnion.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteLocationWithUnion.sql b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteLocationWithUnion.sql
new file mode 100644
index 0000000..65bab10
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteLocationWithUnion.sql
@@ -0,0 +1,4 @@
+insert overwrite into location '/tajo-data/testInsertOverwriteLocationWithUnion'
+select l_orderkey as col1, l_partkey as col2, l_quantity as col3 from default.lineitem
+union all
+select o_orderkey as col1, o_custkey as col2, o_totalprice as col3 from default.orders
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteLocationWithUnionDifferenceAlias.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteLocationWithUnionDifferenceAlias.sql b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteLocationWithUnionDifferenceAlias.sql
new file mode 100644
index 0000000..cbd7a94
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteLocationWithUnionDifferenceAlias.sql
@@ -0,0 +1,4 @@
+insert overwrite into location '/tajo-data/testInsertOverwriteLocationWithUnionDifferenceAlias'
+select l_orderkey as col1, l_partkey as col2, l_quantity as col3 from default.lineitem
+union all
+select o_orderkey as col4, o_custkey as col5, o_totalprice as col6 from default.orders
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteSmallerColumns.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteSmallerColumns.sql b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteSmallerColumns.sql
new file mode 100644
index 0000000..ce3fc0d
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteSmallerColumns.sql
@@ -0,0 +1 @@
+insert overwrite into table1 select l_orderkey from default.lineitem;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteWithAsterisk.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteWithAsterisk.sql b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteWithAsterisk.sql
new file mode 100644
index 0000000..4856e18
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteWithAsterisk.sql
@@ -0,0 +1 @@
+insert overwrite into full_table_csv select * from default.lineitem where l_orderkey = 3;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteWithAsteriskAndMore.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteWithAsteriskAndMore.sql b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteWithAsteriskAndMore.sql
new file mode 100644
index 0000000..07c904d
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteWithAsteriskAndMore.sql
@@ -0,0 +1 @@
+select * from lineitem_year_month;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteWithCompression.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteWithCompression.sql b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteWithCompression.sql
new file mode 100644
index 0000000..8157c1d
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteWithCompression.sql
@@ -0,0 +1 @@
+insert overwrite into testInsertOverwriteWithCompression select  l_orderkey, l_partkey, l_quantity from default.lineitem where l_orderkey = 3;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteWithCompression_ddl.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteWithCompression_ddl.sql b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteWithCompression_ddl.sql
new file mode 100644
index 0000000..8e76b9e
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteWithCompression_ddl.sql
@@ -0,0 +1,4 @@
+create table
+  testInsertOverwriteWithCompression (col1 int4, col2 int4, col3 float8)
+USING text
+WITH ('text.delimiter'='|','compression.codec'='org.apache.hadoop.io.compress.DeflateCodec');
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteWithDatabase.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteWithDatabase.sql b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteWithDatabase.sql
new file mode 100644
index 0000000..db18c0e
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteWithDatabase.sql
@@ -0,0 +1 @@
+insert overwrite into table1 select l_orderkey, l_partkey, l_quantity from default.lineitem;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteWithTargetColumns.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteWithTargetColumns.sql b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteWithTargetColumns.sql
new file mode 100644
index 0000000..67f9773
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteWithTargetColumns.sql
@@ -0,0 +1 @@
+insert overwrite into table1 (col1, col3) select l_orderkey, l_quantity from default.lineitem;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteWithUnion.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteWithUnion.sql b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteWithUnion.sql
new file mode 100644
index 0000000..843d24c
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteWithUnion.sql
@@ -0,0 +1,4 @@
+insert overwrite into table1
+select l_orderkey as col1, l_partkey as col2, l_quantity as col3 from default.lineitem
+union all
+select o_orderkey as col1, o_custkey as col2, o_totalprice as col3 from default.orders
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteWithUnionDifferentAlias.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteWithUnionDifferentAlias.sql b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteWithUnionDifferentAlias.sql
new file mode 100644
index 0000000..1660eb5
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertOverwriteWithUnionDifferentAlias.sql
@@ -0,0 +1,4 @@
+insert overwrite into table1
+select l_orderkey as col1, l_partkey as col2, l_quantity as col3 from default.lineitem
+union all
+select o_orderkey as col4, o_custkey as col5, o_totalprice as col6 from default.orders
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertWithDifferentColumnOrder.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertWithDifferentColumnOrder.sql b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertWithDifferentColumnOrder.sql
new file mode 100644
index 0000000..ad360f9
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestInsertQuery/testInsertWithDifferentColumnOrder.sql
@@ -0,0 +1 @@
+insert overwrite into nation_diff (n_comment, n_name) select n_comment, n_name from default.nation;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestJoinOnPartitionedTables/selfJoinOfPartitionedTable.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestJoinOnPartitionedTables/selfJoinOfPartitionedTable.sql b/tajo-core-tests/src/test/resources/queries/TestJoinOnPartitionedTables/selfJoinOfPartitionedTable.sql
new file mode 100644
index 0000000..988c0e9
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestJoinOnPartitionedTables/selfJoinOfPartitionedTable.sql
@@ -0,0 +1,9 @@
+select
+  t1.c_nationkey,
+  t2.c_nationkey
+from
+  customer_parts t1, customer_parts t2
+where
+  t1.c_nationkey = t2.c_nationkey
+order by
+  t1.c_nationkey desc;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestJoinOnPartitionedTables/testBroadcastPartitionTable.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestJoinOnPartitionedTables/testBroadcastPartitionTable.sql b/tajo-core-tests/src/test/resources/queries/TestJoinOnPartitionedTables/testBroadcastPartitionTable.sql
new file mode 100644
index 0000000..8d555a7
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestJoinOnPartitionedTables/testBroadcastPartitionTable.sql
@@ -0,0 +1,16 @@
+select
+  c_custkey,
+  c_name,
+  c_nationkey,
+  n_nationkey,
+  o_orderkey
+from
+  customer_broad_parts,
+  nation_multifile,
+  orders
+where
+  c_nationkey = n_nationkey
+and
+  o_custkey = c_custkey
+order by
+  c_custkey;
\ No newline at end of file