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:06 UTC

[27/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/dataset/TestSelectNestedRecord/tweets/sample1.json
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/dataset/TestSelectNestedRecord/tweets/sample1.json b/tajo-core-tests/src/test/resources/dataset/TestSelectNestedRecord/tweets/sample1.json
new file mode 100644
index 0000000..78a9071
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/dataset/TestSelectNestedRecord/tweets/sample1.json
@@ -0,0 +1,4 @@
+{"coordinates":null,"favorited":false,"truncated":false,"created_at":"Mon Sep 24 03:35:21 +0000 2012","id_str":"250075927172759552","entities":{"urls":[],"hashtags":[{"text":"freebandnames","indices":[20,34]}],"user_mentions":[]},"in_reply_to_user_id_str":null,"contributors":null,"text":"Aggressive Ponytail #freebandnames","metadata":{"iso_language_code":"en","result_type":"recent"},"retweet_count":1,"in_reply_to_status_id_str":null,"id":250075927172759552,"geo":null,"retweeted":false,"in_reply_to_user_id":null,"place":null,"user":{"profile_sidebar_fill_color":"DDEEF6","profile_sidebar_border_color":"C0DEED","profile_background_tile":false,"name":"Sean Cummings","profile_image_url":"http://a0.twimg.com/profile_images/2359746665/1v6zfgqo8g0d3mk7ii5s_normal.jpeg","created_at":"Mon Apr 26 06:01:55 +0000 2010","location":"LA, CA","follow_request_sent":null,"profile_link_color":"0084B4","is_translator":false,"id_str":"137238150","entities":{"url":{"urls":[{"expanded_url":null,"url":"","i
 ndices":[0,0]}]},"description":{"urls":[]}},"default_profile":true,"contributors_enabled":false,"favourites_count":0,"url":null,"profile_image_url_https":"https://si0.twimg.com/profile_images/2359746665/1v6zfgqo8g0d3mk7ii5s_normal.jpeg","utc_offset":-28800,"id":137238150,"profile_use_background_image":true,"listed_count":2,"profile_text_color":"333333","lang":"en","followers_count":70,"protected":false,"notifications":null,"profile_background_image_url_https":"https://si0.twimg.com/images/themes/theme1/bg.png","profile_background_color":"C0DEED","verified":false,"geo_enabled":true,"time_zone":"Pacific Time (US & Canada)","description":"Born 330 Live 310","default_profile_image":false,"profile_background_image_url":"http://a0.twimg.com/images/themes/theme1/bg.png","statuses_count":579,"friends_count":110,"following":null,"show_all_inline_media":false,"screen_name":"sean_cummings"},"in_reply_to_screen_name":null,"source":"<a>Twitter for Mac<\/a>","in_reply_to_status_id":null}
+{"coordinates":null,"favorited":false,"truncated":false,"created_at":"Fri Sep 21 23:40:54 +0000 2012","id_str":"249292149810667520","entities":{"urls":[],"hashtags":[{"text":"FreeBandNames","indices":[20,34]}],"user_mentions":[]},"in_reply_to_user_id_str":null,"contributors":null,"text":"Thee Namaste Nerdz. #FreeBandNames","metadata":{"iso_language_code":"pl","result_type":"recent"},"retweet_count":2,"in_reply_to_status_id_str":null,"id":249292149810667520,"geo":null,"retweeted":false,"in_reply_to_user_id":null,"place":null,"user":{"profile_sidebar_fill_color":"DDFFCC","profile_sidebar_border_color":"BDDCAD","profile_background_tile":true,"name":"Chaz Martenstein","profile_image_url":"http://a0.twimg.com/profile_images/447958234/Lichtenstein_normal.jpg","created_at":"Tue Apr 07 19:05:07 +0000 2009","location":"Durham, NC","follow_request_sent":null,"profile_link_color":"0084B4","is_translator":false,"id_str":"29516238","entities":{"url":{"urls":[{"expanded_url":null,"url":"http://bu
 llcityrecords.com/wnng/","indices":[0,32]}]},"description":{"urls":[]}},"default_profile":false,"contributors_enabled":false,"favourites_count":8,"url":"http://bullcityrecords.com/wnng/","profile_image_url_https":"https://si0.twimg.com/profile_images/447958234/Lichtenstein_normal.jpg","utc_offset":-18000,"id":29516238,"profile_use_background_image":true,"listed_count":118,"profile_text_color":"333333","lang":"en","followers_count":2052,"protected":false,"notifications":null,"profile_background_image_url_https":"https://si0.twimg.com/profile_background_images/9423277/background_tile.bmp","profile_background_color":"9AE4E8","verified":false,"geo_enabled":false,"time_zone":"Eastern Time (US & Canada)","description":"You will come to Durham, North Carolina. I will sell you some records then, here in Durham, North Carolina. Fun will happen.","default_profile_image":false,"profile_background_image_url":"http://a0.twimg.com/profile_background_images/9423277/background_tile.bmp","statuses_c
 ount":7579,"friends_count":348,"following":null,"show_all_inline_media":true,"screen_name":"bullcityrecords"},"in_reply_to_screen_name":null,"source":"web","in_reply_to_status_id":null}
+{"coordinates":null,"favorited":false,"truncated":false,"created_at":"Fri Sep 21 23:30:20 +0000 2012","id_str":"249289491129438208","entities":{"urls":[],"hashtags":[{"text":"freebandnames","indices":[29,43]}],"user_mentions":[]},"in_reply_to_user_id_str":null,"contributors":null,"text":"Mexican Heaven, Mexican Hell #freebandnames","metadata":{"iso_language_code":"en","result_type":"recent"},"retweet_count":3,"in_reply_to_status_id_str":null,"id":249289491129438208,"geo":null,"retweeted":false,"in_reply_to_user_id":null,"place":null,"user":{"profile_sidebar_fill_color":"99CC33","profile_sidebar_border_color":"829D5E","profile_background_tile":false,"name":"Thomas John Wakeman","profile_image_url":"http://a0.twimg.com/profile_images/2219333930/Froggystyle_normal.png","created_at":"Tue Sep 01 21:21:35 +0000 2009","location":"Kingston New York","follow_request_sent":null,"profile_link_color":"D02B55","is_translator":false,"id_str":"70789458","entities":{"url":{"urls":[{"expanded_url":n
 ull,"url":"","indices":[0,0]}]},"description":{"urls":[]}},"default_profile":false,"contributors_enabled":false,"favourites_count":19,"url":null,"profile_image_url_https":"https://si0.twimg.com/profile_images/2219333930/Froggystyle_normal.png","utc_offset":-18000,"id":70789458,"profile_use_background_image":true,"listed_count":1,"profile_text_color":"3E4415","lang":"en","followers_count":63,"protected":false,"notifications":null,"profile_background_image_url_https":"https://si0.twimg.com/images/themes/theme5/bg.gif","profile_background_color":"352726","verified":false,"geo_enabled":false,"time_zone":"Eastern Time (US & Canada)","description":"Science Fiction Writer, sort of. Likes Superheroes, Mole People, Alt. Timelines.","default_profile_image":false,"profile_background_image_url":"http://a0.twimg.com/images/themes/theme5/bg.gif","statuses_count":1048,"friends_count":63,"following":null,"show_all_inline_media":false,"screen_name":"MonkiesFist"},"in_reply_to_screen_name":null,"sour
 ce":"web","in_reply_to_status_id":null}
+{"coordinates":null,"favorited":false,"truncated":false,"created_at":"Fri Sep 21 22:51:18 +0000 2012","id_str":"249279667666817024","entities":{"urls":[],"hashtags":[{"text":"freebandnames","indices":[20,34]}],"user_mentions":[]},"in_reply_to_user_id_str":null,"contributors":null,"text":"The Foolish Mortals #freebandnames","metadata":{"iso_language_code":"en","result_type":"recent"},"retweet_count":4,"in_reply_to_status_id_str":null,"id":249279667666817024,"geo":null,"retweeted":false,"in_reply_to_user_id":null,"place":null,"user":{"profile_sidebar_fill_color":"BFAC83","profile_sidebar_border_color":"615A44","profile_background_tile":true,"name":"Marty Elmer","profile_image_url":"http://a0.twimg.com/profile_images/1629790393/shrinker_2000_trans_normal.png","created_at":"Mon May 04 00:05:00 +0000 2009","location":"Wisconsin, USA","follow_request_sent":null,"profile_link_color":"3B2A26","is_translator":false,"id_str":"37539828","entities":{"url":{"urls":[{"expanded_url":null,"url":"ht
 tp://www.omnitarian.me","indices":[0,24]}]},"description":{"urls":[]}},"default_profile":false,"contributors_enabled":false,"favourites_count":647,"url":"http://www.omnitarian.me","profile_image_url_https":"https://si0.twimg.com/profile_images/1629790393/shrinker_2000_trans_normal.png","utc_offset":-21600,"id":37539828,"profile_use_background_image":true,"listed_count":52,"profile_text_color":"000000","lang":"en","followers_count":608,"protected":false,"notifications":null,"profile_background_image_url_https":"https://si0.twimg.com/profile_background_images/106455659/rect6056-9.png","profile_background_color":"EEE3C4","verified":false,"geo_enabled":false,"time_zone":"Central Time (US & Canada)","description":"Cartoonist, Illustrator, and T-Shirt connoisseur","default_profile_image":false,"profile_background_image_url":"http://a0.twimg.com/profile_background_images/106455659/rect6056-9.png","statuses_count":3575,"friends_count":249,"following":null,"show_all_inline_media":true,"scree
 n_name":"Omnitarian"},"in_reply_to_screen_name":null,"source":"<a>Twitter for iPhone<\/a>","in_reply_to_status_id":null}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/dataset/TestSelectQuery/multibytes_delimiter1/table1.tbl
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/dataset/TestSelectQuery/multibytes_delimiter1/table1.tbl b/tajo-core-tests/src/test/resources/dataset/TestSelectQuery/multibytes_delimiter1/table1.tbl
new file mode 100644
index 0000000..5acccf6
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/dataset/TestSelectQuery/multibytes_delimiter1/table1.tbl
@@ -0,0 +1,5 @@
+1||ooo||1.1||a
+2||ppp||2.3||
+3||qqq||||
+4||||4.5||
+||xxx||5.6||e
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/dataset/TestSelectQuery/multibytes_delimiter2/table2.tbl
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/dataset/TestSelectQuery/multibytes_delimiter2/table2.tbl b/tajo-core-tests/src/test/resources/dataset/TestSelectQuery/multibytes_delimiter2/table2.tbl
new file mode 100644
index 0000000..b26cdfd
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/dataset/TestSelectQuery/multibytes_delimiter2/table2.tbl
@@ -0,0 +1,5 @@
+1ㅎoooㅎ1.1ㅎa
+2ㅎpppㅎ2.3ㅎ
+3ㅎqqqㅎㅎ
+4ㅎㅎ4.5ㅎ
+ㅎxxxㅎ5.6ㅎe
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/dataset/TestSelectQuery/timezoned/table1.tbl
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/dataset/TestSelectQuery/timezoned/table1.tbl b/tajo-core-tests/src/test/resources/dataset/TestSelectQuery/timezoned/table1.tbl
new file mode 100644
index 0000000..38e8bd9
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/dataset/TestSelectQuery/timezoned/table1.tbl
@@ -0,0 +1,3 @@
+1980-4-1 01:50:30.010|1980-04-01
+80/4/1 1:50:30 AM|80/4/1
+1980 April 1 1:50:30|1980-04-01
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/dataset/TestSortQuery/table1/table1.tbl
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/dataset/TestSortQuery/table1/table1.tbl b/tajo-core-tests/src/test/resources/dataset/TestSortQuery/table1/table1.tbl
new file mode 100644
index 0000000..a1ebde3
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/dataset/TestSortQuery/table1/table1.tbl
@@ -0,0 +1,5 @@
+1997-11-09 20:34:56|1996-04-12|15:34:56
+1997-11-09 20:34:56|1996-03-13|19:34:56
+1993-11-09 20:34:56|1997-01-28|08:34:56
+1995-11-09 20:34:56|1994-02-02|17:34:56
+1995-11-09 20:34:56|1993-11-09|20:34:56
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/dataset/TestSortQuery/table2/table2.tbl
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/dataset/TestSortQuery/table2/table2.tbl b/tajo-core-tests/src/test/resources/dataset/TestSortQuery/table2/table2.tbl
new file mode 100644
index 0000000..bc237af
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/dataset/TestSortQuery/table2/table2.tbl
@@ -0,0 +1,24 @@
+1,2132
+1,15635
+1,24027
+1,63700
+1,67310
+1,155190
+2,106170
+3,4297
+3,19036
+3,29380
+3,62143
+3,128449
+3,183095
+4,88035
+5,37531
+5,108570
+5,123927
+6,139636
+7,79251
+7,94780
+7,145243
+7,151894
+7,157238
+7,163073

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/dataset/TestTablePartitions/lineitemspecial.tbl
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/dataset/TestTablePartitions/lineitemspecial.tbl b/tajo-core-tests/src/test/resources/dataset/TestTablePartitions/lineitemspecial.tbl
new file mode 100644
index 0000000..2241213
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/dataset/TestTablePartitions/lineitemspecial.tbl
@@ -0,0 +1,5 @@
+1|DELIVER IN PERSON|TRUCK|
+1|TAKE BACK RETURN|MAIL|
+2|TAKE BACK RETURN|RAIL|
+3|NONE|AIR|
+3|TEST SPECIAL CHARS|RA:*?><I/L#%S|

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/dataset/TestTajoJdbc/table1/table1.tbl
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/dataset/TestTajoJdbc/table1/table1.tbl b/tajo-core-tests/src/test/resources/dataset/TestTajoJdbc/table1/table1.tbl
new file mode 100644
index 0000000..52fa2fe
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/dataset/TestTajoJdbc/table1/table1.tbl
@@ -0,0 +1,5 @@
+1997-11-09 20:34:56|1996-04-12|15:34:56
+1997-11-09 20:34:56|1996-03-13|19:34:56
+1993-11-09 20:34:56|1997-01-28|08:34:56
+1995-11-09 20:34:56|1994-02-02|17:34:56
+1995-11-09 20:34:56|1993-11-09|20:34:56

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/dataset/TestTruncateTable/truncate_table2/table2.tbl
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/dataset/TestTruncateTable/truncate_table2/table2.tbl b/tajo-core-tests/src/test/resources/dataset/TestTruncateTable/truncate_table2/table2.tbl
new file mode 100644
index 0000000..f99db9c
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/dataset/TestTruncateTable/truncate_table2/table2.tbl
@@ -0,0 +1,4 @@
+4|jkl1|7
+5|opq2|8
+6|stu3|9
+7|kkk4|10

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/log4j.properties b/tajo-core-tests/src/test/resources/log4j.properties
new file mode 100644
index 0000000..307608e
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/log4j.properties
@@ -0,0 +1,28 @@
+##
+# 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.
+#
+
+# log4j configuration used during build and unit tests
+
+log4j.rootLogger=info,stdout
+log4j.threshhold=INFO
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %p: %c (%M(%L)) - %m%n
+
+
+log4j.logger.org.apache.hadoop=WARN

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/python/__init__.py
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/python/__init__.py b/tajo-core-tests/src/test/resources/python/__init__.py
new file mode 100644
index 0000000..8093a2f
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/python/__init__.py
@@ -0,0 +1,17 @@
+#!/usr/bin/python
+
+############################################################################
+#  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.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/python/test_funcs.py
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/python/test_funcs.py b/tajo-core-tests/src/test/resources/python/test_funcs.py
new file mode 100644
index 0000000..1167afd
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/python/test_funcs.py
@@ -0,0 +1,33 @@
+############################################################################
+#  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.
+
+from tajo_util import output_type
+
+@output_type('int4')
+def return_one():
+    return 1
+
+@output_type("text")
+def helloworld():
+    return 'Hello, World'
+
+# No decorator - blob
+def concat_py(str):
+    return str+str
+
+@output_type('int4')
+def add_py(a,b):
+    return a+b

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/python/test_funcs2.py
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/python/test_funcs2.py b/tajo-core-tests/src/test/resources/python/test_funcs2.py
new file mode 100644
index 0000000..8a6f608
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/python/test_funcs2.py
@@ -0,0 +1,32 @@
+############################################################################
+#  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.
+
+from tajo_util import output_type
+
+#Percent- Percentage
+@output_type("float8")
+def percent(num, total):
+    return num * 100 / float(total)
+
+#commaFormat- format a number with commas, 12345-> 12,345
+@output_type("text")
+def comma_format(num):
+    return '{:,}'.format(num)
+
+#concatMultiple- concat multiple words
+@output_type("text")
+def concat4(word1, word2, word3, word4):
+    return word1 + " " + word2 + " " + word3 + " " + word4
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/python/test_udaf.py
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/python/test_udaf.py b/tajo-core-tests/src/test/resources/python/test_udaf.py
new file mode 100644
index 0000000..da5a3fd
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/python/test_udaf.py
@@ -0,0 +1,76 @@
+############################################################################
+#  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.
+
+from tajo_util import output_type
+
+
+class AvgPy:
+    sum = 0
+    cnt = 0
+
+    def __init__(self):
+        self.reset()
+
+    def reset(self):
+        self.sum = 0
+        self.cnt = 0
+
+    # eval at the first stage
+    def eval(self, item):
+        self.sum += item
+        self.cnt += 1
+
+    # get intermediate result
+    def get_partial_result(self):
+        return [self.sum, self.cnt]
+
+    # merge intermediate results
+    def merge(self, list):
+        self.sum += list[0]
+        self.cnt += list[1]
+
+    # get final result
+    @output_type('float8')
+    def get_final_result(self):
+        return self.sum / float(self.cnt)
+
+
+class CountPy:
+    cnt = 0
+
+    def __init__(self):
+        self.reset()
+
+    def reset(self):
+        self.cnt = 0
+
+    # eval at the first stage
+    def eval(self):
+        self.cnt += 1
+
+    # get intermediate result
+    def get_partial_result(self):
+        return self.cnt
+
+    # merge intermediate results
+    def merge(self, cnt):
+        self.cnt += cnt
+
+    # get final result
+    @output_type('int4')
+    def get_final_result(self):
+        return self.cnt
+

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestAlterTable/alter_table_add_new_column_ddl.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestAlterTable/alter_table_add_new_column_ddl.sql b/tajo-core-tests/src/test/resources/queries/TestAlterTable/alter_table_add_new_column_ddl.sql
new file mode 100644
index 0000000..567aed8
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestAlterTable/alter_table_add_new_column_ddl.sql
@@ -0,0 +1 @@
+ALTER TABLE EFG ADD COLUMN cool text;

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestAlterTable/alter_table_add_partition1.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestAlterTable/alter_table_add_partition1.sql b/tajo-core-tests/src/test/resources/queries/TestAlterTable/alter_table_add_partition1.sql
new file mode 100644
index 0000000..1154683
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestAlterTable/alter_table_add_partition1.sql
@@ -0,0 +1 @@
+ALTER TABLE partitioned_table ADD PARTITION (col3 = 1 , col4 = 2)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestAlterTable/alter_table_add_partition2.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestAlterTable/alter_table_add_partition2.sql b/tajo-core-tests/src/test/resources/queries/TestAlterTable/alter_table_add_partition2.sql
new file mode 100644
index 0000000..315ac47
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestAlterTable/alter_table_add_partition2.sql
@@ -0,0 +1 @@
+ALTER TABLE partitioned_table ADD IF NOT EXISTS PARTITION (col3 = 1 , col4 = 2)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestAlterTable/alter_table_drop_partition1.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestAlterTable/alter_table_drop_partition1.sql b/tajo-core-tests/src/test/resources/queries/TestAlterTable/alter_table_drop_partition1.sql
new file mode 100644
index 0000000..b5d672f
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestAlterTable/alter_table_drop_partition1.sql
@@ -0,0 +1 @@
+ALTER TABLE partitioned_table DROP PARTITION (col3 = 1 , col4 = 2)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestAlterTable/alter_table_drop_partition2.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestAlterTable/alter_table_drop_partition2.sql b/tajo-core-tests/src/test/resources/queries/TestAlterTable/alter_table_drop_partition2.sql
new file mode 100644
index 0000000..0d4c932
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestAlterTable/alter_table_drop_partition2.sql
@@ -0,0 +1 @@
+ALTER TABLE partitioned_table DROP IF EXISTS PARTITION (col3 = 1 , col4 = 2)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestAlterTable/alter_table_rename_column_ddl.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestAlterTable/alter_table_rename_column_ddl.sql b/tajo-core-tests/src/test/resources/queries/TestAlterTable/alter_table_rename_column_ddl.sql
new file mode 100644
index 0000000..7c326ff
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestAlterTable/alter_table_rename_column_ddl.sql
@@ -0,0 +1 @@
+ALTER TABLE XYZ RENAME COLUMN num TO renum;

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestAlterTable/alter_table_rename_table_ddl.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestAlterTable/alter_table_rename_table_ddl.sql b/tajo-core-tests/src/test/resources/queries/TestAlterTable/alter_table_rename_table_ddl.sql
new file mode 100644
index 0000000..1808eaa
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestAlterTable/alter_table_rename_table_ddl.sql
@@ -0,0 +1 @@
+ ALTER TABLE ABC RENAME TO "DEF";

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestAlterTable/alter_table_set_property_delimiter.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestAlterTable/alter_table_set_property_delimiter.sql b/tajo-core-tests/src/test/resources/queries/TestAlterTable/alter_table_set_property_delimiter.sql
new file mode 100644
index 0000000..031e700
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestAlterTable/alter_table_set_property_delimiter.sql
@@ -0,0 +1 @@
+ALTER TABLE ALTX SET PROPERTY 'text.delimiter'='|';

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestAlterTable/alter_table_set_property_timezone.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestAlterTable/alter_table_set_property_timezone.sql b/tajo-core-tests/src/test/resources/queries/TestAlterTable/alter_table_set_property_timezone.sql
new file mode 100644
index 0000000..24b237e
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestAlterTable/alter_table_set_property_timezone.sql
@@ -0,0 +1 @@
+ALTER TABLE ALTY SET PROPERTY 'timezone'='GMT-7';

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

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestAlterTable/table1_ddl.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestAlterTable/table1_ddl.sql b/tajo-core-tests/src/test/resources/queries/TestAlterTable/table1_ddl.sql
new file mode 100644
index 0000000..f00f593
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestAlterTable/table1_ddl.sql
@@ -0,0 +1 @@
+CREATE EXTERNAL TABLE ${0} (id int, str text, num int) using text location ${table.path};

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestAlterTable/table2_ddl.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestAlterTable/table2_ddl.sql b/tajo-core-tests/src/test/resources/queries/TestAlterTable/table2_ddl.sql
new file mode 100644
index 0000000..887029d
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestAlterTable/table2_ddl.sql
@@ -0,0 +1 @@
+CREATE EXTERNAL TABLE ${0} (xx text, yy text, zz text) USING TEXT WITH('text.delimiter'='+') LOCATION ${table.path};

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestAlterTable/testAlterTableSetProperty.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestAlterTable/testAlterTableSetProperty.sql b/tajo-core-tests/src/test/resources/queries/TestAlterTable/testAlterTableSetProperty.sql
new file mode 100644
index 0000000..dd0bd83
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestAlterTable/testAlterTableSetProperty.sql
@@ -0,0 +1 @@
+select * from ALTX;

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestAlterTable/testAlterTableSetProperty2.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestAlterTable/testAlterTableSetProperty2.sql b/tajo-core-tests/src/test/resources/queries/TestAlterTable/testAlterTableSetProperty2.sql
new file mode 100644
index 0000000..2e854aa
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestAlterTable/testAlterTableSetProperty2.sql
@@ -0,0 +1 @@
+select * from ALTY;

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testAvgDouble.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testAvgDouble.sql b/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testAvgDouble.sql
new file mode 100644
index 0000000..a9afc5c
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testAvgDouble.sql
@@ -0,0 +1 @@
+select l_orderkey, avg(l_discount) as revenue from lineitem group by l_orderkey order 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/TestBuiltinFunctions/testAvgInt.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testAvgInt.sql b/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testAvgInt.sql
new file mode 100644
index 0000000..4983563
--- /dev/null
+++ b/tajo-core-tests/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/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testAvgLong.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testAvgLong.sql b/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testAvgLong.sql
new file mode 100644
index 0000000..324c6cd
--- /dev/null
+++ b/tajo-core-tests/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/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testAvgLongOverflow.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testAvgLongOverflow.sql b/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testAvgLongOverflow.sql
new file mode 100644
index 0000000..51a2ac1
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testAvgLongOverflow.sql
@@ -0,0 +1 @@
+select avg(cast(l_quantity * 25264513 as INT4)) as avg from lineitem where l_quantity > 0;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testCount.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testCount.sql b/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testCount.sql
new file mode 100644
index 0000000..1773e38
--- /dev/null
+++ b/tajo-core-tests/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/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testMaxLong.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testMaxLong.sql b/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testMaxLong.sql
new file mode 100644
index 0000000..0566377
--- /dev/null
+++ b/tajo-core-tests/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/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testMaxString.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testMaxString.sql b/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testMaxString.sql
new file mode 100644
index 0000000..f594017
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testMaxString.sql
@@ -0,0 +1 @@
+select max(l_orderkey::text) as total_max 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/TestBuiltinFunctions/testMinLong.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testMinLong.sql b/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testMinLong.sql
new file mode 100644
index 0000000..0f3cfee
--- /dev/null
+++ b/tajo-core-tests/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/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testMinString.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testMinString.sql b/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testMinString.sql
new file mode 100644
index 0000000..9cc6629
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testMinString.sql
@@ -0,0 +1 @@
+select min(l_orderkey::text) as total_min 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/TestBuiltinFunctions/testRandom.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testRandom.sql b/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testRandom.sql
new file mode 100644
index 0000000..9f2a456
--- /dev/null
+++ b/tajo-core-tests/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/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testSplitPart.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testSplitPart.sql b/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testSplitPart.sql
new file mode 100644
index 0000000..528d60c
--- /dev/null
+++ b/tajo-core-tests/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/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testSplitPartByString.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testSplitPartByString.sql b/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testSplitPartByString.sql
new file mode 100644
index 0000000..cd6a664
--- /dev/null
+++ b/tajo-core-tests/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/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testSplitPartNested.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testSplitPartNested.sql b/tajo-core-tests/src/test/resources/queries/TestBuiltinFunctions/testSplitPartNested.sql
new file mode 100644
index 0000000..b7add04
--- /dev/null
+++ b/tajo-core-tests/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/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestCTASQuery/CtasWithGroupby.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCTASQuery/CtasWithGroupby.sql b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/CtasWithGroupby.sql
new file mode 100644
index 0000000..c2d7604
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/CtasWithGroupby.sql
@@ -0,0 +1,2 @@
+create table testCtasWithGroupby (col1 float, col2 float) partition by column(key float8) as
+select sum(l_orderkey) as total1, avg(l_partkey) as total2, l_quantity as key from lineitem group by l_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/TestCTASQuery/CtasWithLimit.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCTASQuery/CtasWithLimit.sql b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/CtasWithLimit.sql
new file mode 100644
index 0000000..fb4eba3
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/CtasWithLimit.sql
@@ -0,0 +1,13 @@
+create table testCtasWithLimit (col1 float, col2 float) partition by column(key float8) as
+select
+  sum(l_orderkey) as total1,
+  avg(l_partkey) as total2,
+  l_quantity as key
+from
+  lineitem
+group by
+  l_quantity
+order by
+  l_quantity
+limit
+  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/TestCTASQuery/CtasWithManagedTable.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCTASQuery/CtasWithManagedTable.sql b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/CtasWithManagedTable.sql
new file mode 100644
index 0000000..1dd5e90
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/CtasWithManagedTable.sql
@@ -0,0 +1,12 @@
+create table "MANAGED_TABLE1" (col1 float, col2 float) using rcfile as
+select
+  sum(l_orderkey) as total1,
+  avg(l_partkey) as total2
+from
+  lineitem
+group by
+  l_quantity
+order by
+  l_quantity
+limit
+  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/TestCTASQuery/CtasWithMultipleUnions.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCTASQuery/CtasWithMultipleUnions.sql b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/CtasWithMultipleUnions.sql
new file mode 100644
index 0000000..7176a2a
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/CtasWithMultipleUnions.sql
@@ -0,0 +1,12 @@
+create table testCtasWithMultipleUnions as
+select * from
+   (select c_custkey, c_nationkey from customer where c_nationkey < 0
+   union all
+   select c_custkey, c_nationkey from customer where c_nationkey > 0
+) a
+union all
+select * from
+   (select c_custkey, c_nationkey from customer where c_nationkey < 0
+   union all
+   select c_custkey, c_nationkey from customer where c_nationkey > 0
+) b;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestCTASQuery/CtasWithOptions.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCTASQuery/CtasWithOptions.sql b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/CtasWithOptions.sql
new file mode 100644
index 0000000..b7dde15
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/CtasWithOptions.sql
@@ -0,0 +1,13 @@
+create table testCtasWithOptions (col1 float, col2 float)
+using text with ('text.delimiter'='\u0001') as
+select
+  sum(l_orderkey) as total1,
+  avg(l_partkey) as total2
+from
+  lineitem
+group by
+  l_quantity
+order by
+  l_quantity
+limit
+  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/TestCTASQuery/CtasWithOrderby.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCTASQuery/CtasWithOrderby.sql b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/CtasWithOrderby.sql
new file mode 100644
index 0000000..686d2e1
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/CtasWithOrderby.sql
@@ -0,0 +1,11 @@
+create table testCtasWithOrderby (col1 float, col2 float) partition by column(key float8) as
+select
+  sum(l_orderkey) as total1,
+  avg(l_partkey) as total2,
+  l_quantity as key
+from
+  lineitem
+group by
+  l_quantity
+order by
+  l_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/TestCTASQuery/CtasWithStoreType.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCTASQuery/CtasWithStoreType.sql b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/CtasWithStoreType.sql
new file mode 100644
index 0000000..bee1a89
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/CtasWithStoreType.sql
@@ -0,0 +1,12 @@
+create table testCtasWithStoreType (col1 float, col2 float) using rcfile as
+select
+  sum(l_orderkey) as total1,
+  avg(l_partkey) as total2
+from
+  lineitem
+group by
+  l_quantity
+order by
+  l_quantity
+limit
+  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/TestCTASQuery/CtasWithTextFile.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCTASQuery/CtasWithTextFile.sql b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/CtasWithTextFile.sql
new file mode 100644
index 0000000..5581d16
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/CtasWithTextFile.sql
@@ -0,0 +1,12 @@
+create table testCtasWithTextFile (col1 float, col2 float) using text as
+select
+  sum(l_orderkey) as total1,
+  avg(l_partkey) as total2
+from
+  lineitem
+group by
+  l_quantity
+order by
+  l_quantity
+limit
+  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/TestCTASQuery/CtasWithUnion.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCTASQuery/CtasWithUnion.sql b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/CtasWithUnion.sql
new file mode 100644
index 0000000..739f23f
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/CtasWithUnion.sql
@@ -0,0 +1,35 @@
+create table testCtasWithUnion (col1 float, col2 float) partition by column(key float8) as
+
+select
+  *
+from (
+
+select
+  sum(l_orderkey) as total1,
+  avg(l_partkey) as total2,
+  l_quantity as key
+from
+  lineitem
+group by
+  l_quantity
+order by
+  l_quantity
+limit
+  3
+
+union
+
+select
+  sum(l_orderkey) as total1,
+  avg(l_partkey) as total2,
+  l_quantity as key
+from
+  lineitem
+group by
+  l_quantity
+order by
+  l_quantity
+limit
+  3
+
+) t1;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestCTASQuery/check1.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCTASQuery/check1.sql b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/check1.sql
new file mode 100644
index 0000000..3fb90bb
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/check1.sql
@@ -0,0 +1 @@
+select distinct * from testCtasWithoutTableDefinition where (key = 45.0 or key = 38.0);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestCTASQuery/check2.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCTASQuery/check2.sql b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/check2.sql
new file mode 100644
index 0000000..1b354b7
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/check2.sql
@@ -0,0 +1 @@
+select distinct * from testCtasWithColumnedPartition where (key = 45.0 or key = 38.0);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestCTASQuery/testCtasWithColumnedPartition.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCTASQuery/testCtasWithColumnedPartition.sql b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/testCtasWithColumnedPartition.sql
new file mode 100644
index 0000000..76b852a
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/testCtasWithColumnedPartition.sql
@@ -0,0 +1,2 @@
+create table testCtasWithColumnedPartition (col1 float, col2 float) partition by column(key float8) as
+select l_orderkey as col1, l_partkey as col2, l_quantity as 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/TestCTASQuery/testCtasWithGroupby.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCTASQuery/testCtasWithGroupby.sql b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/testCtasWithGroupby.sql
new file mode 100644
index 0000000..bf16e63
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/testCtasWithGroupby.sql
@@ -0,0 +1 @@
+select * from testCtasWithGroupby order by 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/TestCTASQuery/testCtasWithLimit.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCTASQuery/testCtasWithLimit.sql b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/testCtasWithLimit.sql
new file mode 100644
index 0000000..fa0fbd7
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/testCtasWithLimit.sql
@@ -0,0 +1 @@
+select * from testCtasWithLimit order by 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/TestCTASQuery/testCtasWithMultipleUnions.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCTASQuery/testCtasWithMultipleUnions.sql b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/testCtasWithMultipleUnions.sql
new file mode 100644
index 0000000..71b7034
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/testCtasWithMultipleUnions.sql
@@ -0,0 +1 @@
+select * from testCtasWithMultipleUnions;
\ No newline at end of file

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

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestCTASQuery/testCtasWithOrderby.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCTASQuery/testCtasWithOrderby.sql b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/testCtasWithOrderby.sql
new file mode 100644
index 0000000..7013b39
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/testCtasWithOrderby.sql
@@ -0,0 +1 @@
+select * from testCtasWithOrderby order by 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/TestCTASQuery/testCtasWithStoreType.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCTASQuery/testCtasWithStoreType.sql b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/testCtasWithStoreType.sql
new file mode 100644
index 0000000..9e7e337
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/testCtasWithStoreType.sql
@@ -0,0 +1 @@
+select * from testCtasWithStoreType;
\ No newline at end of file

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

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestCTASQuery/testCtasWithUnion.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCTASQuery/testCtasWithUnion.sql b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/testCtasWithUnion.sql
new file mode 100644
index 0000000..933e18a
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/testCtasWithUnion.sql
@@ -0,0 +1 @@
+select * from testCtasWithUnion order by 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/TestCTASQuery/testCtasWithoutTableDefinition.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCTASQuery/testCtasWithoutTableDefinition.sql b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/testCtasWithoutTableDefinition.sql
new file mode 100644
index 0000000..e30f261
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCTASQuery/testCtasWithoutTableDefinition.sql
@@ -0,0 +1,2 @@
+create table testCtasWithoutTableDefinition partition by column(key float8) as
+select l_orderkey as col1, l_partkey as col2, l_quantity as 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/TestCaseByCases/testTAJO1224Case1.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCaseByCases/testTAJO1224Case1.sql b/tajo-core-tests/src/test/resources/queries/TestCaseByCases/testTAJO1224Case1.sql
new file mode 100644
index 0000000..d05a563
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCaseByCases/testTAJO1224Case1.sql
@@ -0,0 +1 @@
+select count(*) from tajo1224;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestCaseByCases/testTAJO415Case.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCaseByCases/testTAJO415Case.sql b/tajo-core-tests/src/test/resources/queries/TestCaseByCases/testTAJO415Case.sql
new file mode 100644
index 0000000..4b915d3
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCaseByCases/testTAJO415Case.sql
@@ -0,0 +1,36 @@
+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)
+
+order by
+  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/TestCaseByCases/testTAJO418Case.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCaseByCases/testTAJO418Case.sql b/tajo-core-tests/src/test/resources/queries/TestCaseByCases/testTAJO418Case.sql
new file mode 100644
index 0000000..2e62923
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCaseByCases/testTAJO418Case.sql
@@ -0,0 +1,29 @@
+SELECT
+  l_returnflag,
+  l_linestatus
+
+FROM (
+  SELECT
+    *
+  FROM
+    lineitem
+  WHERE
+    l_returnflag = 'N'
+
+  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/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestCaseByCases/testTAJO619Case.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCaseByCases/testTAJO619Case.sql b/tajo-core-tests/src/test/resources/queries/TestCaseByCases/testTAJO619Case.sql
new file mode 100644
index 0000000..15355b8
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCaseByCases/testTAJO619Case.sql
@@ -0,0 +1,4 @@
+select
+  count(1)
+from
+  lineitem as l1 join lineitem as l2 on l1.l_returnflag = l2.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/TestCaseByCases/testTAJO718Case.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCaseByCases/testTAJO718Case.sql b/tajo-core-tests/src/test/resources/queries/TestCaseByCases/testTAJO718Case.sql
new file mode 100644
index 0000000..73e9f6a
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCaseByCases/testTAJO718Case.sql
@@ -0,0 +1,10 @@
+SELECT
+  "lineitem".l_orderkey AS l_orderkey,
+  "lineitem".l_orderkey AS l_orderkey1,
+  COUNT ("lineitem".l_orderkey) AS T57801e5322bc50
+FROM
+  "lineitem"
+GROUP BY
+  l_orderkey, l_orderkey1
+ORDER BY
+  l_orderkey, l_orderkey1;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestCaseByCases/testTAJO739Case.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCaseByCases/testTAJO739Case.sql b/tajo-core-tests/src/test/resources/queries/TestCaseByCases/testTAJO739Case.sql
new file mode 100644
index 0000000..3525621
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCaseByCases/testTAJO739Case.sql
@@ -0,0 +1,5 @@
+select nation.n_nationkey as n_nationkey,
+       nation.n_name as n_name
+from nation
+inner join (select c_nationkey as n_nationkey from customer) a
+on nation.n_nationkey = a.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/TestCaseByCases/testTAJO914Case1.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCaseByCases/testTAJO914Case1.sql b/tajo-core-tests/src/test/resources/queries/TestCaseByCases/testTAJO914Case1.sql
new file mode 100644
index 0000000..765110a
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCaseByCases/testTAJO914Case1.sql
@@ -0,0 +1,10 @@
+select
+  l_orderkey,
+  '##' as col1
+from
+  lineitem
+  join orders on l_orderkey = o_orderkey
+group by
+  l_orderkey
+order 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/TestCaseByCases/testTAJO914Case2.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCaseByCases/testTAJO914Case2.sql b/tajo-core-tests/src/test/resources/queries/TestCaseByCases/testTAJO914Case2.sql
new file mode 100644
index 0000000..f404088
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCaseByCases/testTAJO914Case2.sql
@@ -0,0 +1,9 @@
+select
+  l_orderkey,
+  '##' as col1
+from
+  lineitem join orders on l_orderkey = o_orderkey
+group by
+  l_orderkey, col1
+order 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/TestCaseByCases/testTAJO914Case3.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCaseByCases/testTAJO914Case3.sql b/tajo-core-tests/src/test/resources/queries/TestCaseByCases/testTAJO914Case3.sql
new file mode 100644
index 0000000..f9ee355
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCaseByCases/testTAJO914Case3.sql
@@ -0,0 +1,10 @@
+insert OVERWRITE into T3
+  select
+    l_orderkey,
+    '##' as col1
+  from
+    lineitem join orders on l_orderkey = o_orderkey
+  group by
+    l_orderkey, col1
+  order 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/TestCaseByCases/testTAJO914Case4.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCaseByCases/testTAJO914Case4.sql b/tajo-core-tests/src/test/resources/queries/TestCaseByCases/testTAJO914Case4.sql
new file mode 100644
index 0000000..ba99b70
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCaseByCases/testTAJO914Case4.sql
@@ -0,0 +1,10 @@
+  select
+    l_orderkey,
+    '##' as col1,
+    sum(l_orderkey) as s1
+  from
+    lineitem join orders o1 on l_orderkey = o1.o_orderkey join orders o2 on l_orderkey = o2.o_orderkey
+  group by
+    l_orderkey, col1
+  order 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/TestCaseByCases/testTAJO917Case1.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCaseByCases/testTAJO917Case1.sql b/tajo-core-tests/src/test/resources/queries/TestCaseByCases/testTAJO917Case1.sql
new file mode 100644
index 0000000..5b3039c
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCaseByCases/testTAJO917Case1.sql
@@ -0,0 +1,13 @@
+select
+    temp.r_regionkey as r_regionkey
+from
+    (
+    select
+        region.r_regionkey as r_regionkey
+    from
+        region
+    ) temp
+join
+    region b
+on
+    temp.r_regionkey = b.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/TestCreateIndex/testCreateIndex.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCreateIndex/testCreateIndex.sql b/tajo-core-tests/src/test/resources/queries/TestCreateIndex/testCreateIndex.sql
new file mode 100644
index 0000000..1cb8936
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCreateIndex/testCreateIndex.sql
@@ -0,0 +1 @@
+create index l_orderkey_idx on lineitem (l_orderkey asc null first);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestCreateIndex/testCreateIndexOnExpression.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCreateIndex/testCreateIndexOnExpression.sql b/tajo-core-tests/src/test/resources/queries/TestCreateIndex/testCreateIndexOnExpression.sql
new file mode 100644
index 0000000..0d19cb3
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCreateIndex/testCreateIndexOnExpression.sql
@@ -0,0 +1 @@
+create index l_orderkey_100_lt10_idx on lineitem (l_orderkey*100 asc null first) where l_orderkey*100 > 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/TestCreateIndex/testCreateIndexOnLocation.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCreateIndex/testCreateIndexOnLocation.sql b/tajo-core-tests/src/test/resources/queries/TestCreateIndex/testCreateIndexOnLocation.sql
new file mode 100644
index 0000000..1cb8936
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCreateIndex/testCreateIndexOnLocation.sql
@@ -0,0 +1 @@
+create index l_orderkey_idx on lineitem (l_orderkey asc null first);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestCreateIndex/testCreateIndexOnMultiAttrs.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCreateIndex/testCreateIndexOnMultiAttrs.sql b/tajo-core-tests/src/test/resources/queries/TestCreateIndex/testCreateIndexOnMultiAttrs.sql
new file mode 100644
index 0000000..3487d2e
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCreateIndex/testCreateIndexOnMultiAttrs.sql
@@ -0,0 +1 @@
+create index l_orderkey_partkey_idx on lineitem (l_orderkey asc, l_partkey desc null last);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestCreateIndex/testCreateIndexOnMultiExprs.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCreateIndex/testCreateIndexOnMultiExprs.sql b/tajo-core-tests/src/test/resources/queries/TestCreateIndex/testCreateIndexOnMultiExprs.sql
new file mode 100644
index 0000000..7938005
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCreateIndex/testCreateIndexOnMultiExprs.sql
@@ -0,0 +1 @@
+create index l_orderkey_100_l_linenumber_10_lt10_idx on lineitem (l_orderkey*100-l_linenumber*10 asc null first) where l_orderkey*100 > 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/TestCreateIndex/testCreateIndexWithCondition.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCreateIndex/testCreateIndexWithCondition.sql b/tajo-core-tests/src/test/resources/queries/TestCreateIndex/testCreateIndexWithCondition.sql
new file mode 100644
index 0000000..ad4ee47
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCreateIndex/testCreateIndexWithCondition.sql
@@ -0,0 +1 @@
+create index l_orderkey_partkey_lt10_idx on lineitem (l_orderkey asc, l_partkey desc) where l_partkey > 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/TestCreateTable/create_table_various_types.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCreateTable/create_table_various_types.sql b/tajo-core-tests/src/test/resources/queries/TestCreateTable/create_table_various_types.sql
new file mode 100644
index 0000000..891a139
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCreateTable/create_table_various_types.sql
@@ -0,0 +1,50 @@
+-- Some types were commented out due to Hive meta test.
+
+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/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestCreateTable/create_table_various_types_for_hive_catalog.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCreateTable/create_table_various_types_for_hive_catalog.sql b/tajo-core-tests/src/test/resources/queries/TestCreateTable/create_table_various_types_for_hive_catalog.sql
new file mode 100644
index 0000000..3eda994
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCreateTable/create_table_various_types_for_hive_catalog.sql
@@ -0,0 +1,50 @@
+-- Some types were commented out due to Hive meta test.
+
+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/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_1.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_1.sql b/tajo-core-tests/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_1.sql
new file mode 100644
index 0000000..2084456
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_1.sql
@@ -0,0 +1 @@
+SELECT "aGe", "teXt", "Number" FROM "TABLE1";
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_2.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_2.sql b/tajo-core-tests/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_2.sql
new file mode 100644
index 0000000..4b05657
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_2.sql
@@ -0,0 +1 @@
+SELECT "tb1"."aGe" as "AgE", "tb1"."teXt" as "TEXT", "Number" as "NUMBER" FROM "TABLE1" "tb1";
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_3.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_3.sql b/tajo-core-tests/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_3.sql
new file mode 100644
index 0000000..fbb00a0
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_3.sql
@@ -0,0 +1,22 @@
+SELECT
+  *
+FROM (
+  SELECT
+    "tb1"."aGe",
+    "tb1"."teXt",
+    "Number"
+  FROM
+    "TABLE1" "tb1"
+
+  UNION
+
+  SELECT
+    "aGe",
+    "teXt",
+    "Number"
+  FROM
+    "tablE1"
+) T1
+ORDER BY
+  "aGe";
+

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_ddl_1.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_ddl_1.sql b/tajo-core-tests/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_ddl_1.sql
new file mode 100644
index 0000000..d8293d0
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_ddl_1.sql
@@ -0,0 +1 @@
+CREATE EXTERNAL TABLE ${0} ("aGe" int, "teXt" text, "Number" int) using text location ${table.path};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_ddl_2.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_ddl_2.sql b/tajo-core-tests/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_ddl_2.sql
new file mode 100644
index 0000000..d8293d0
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_ddl_2.sql
@@ -0,0 +1 @@
+CREATE EXTERNAL TABLE ${0} ("aGe" int, "teXt" text, "Number" int) using text location ${table.path};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestCreateTable/quoted_identifier_non_ascii_1.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCreateTable/quoted_identifier_non_ascii_1.sql b/tajo-core-tests/src/test/resources/queries/TestCreateTable/quoted_identifier_non_ascii_1.sql
new file mode 100644
index 0000000..39a7bfa
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCreateTable/quoted_identifier_non_ascii_1.sql
@@ -0,0 +1 @@
+SELECT "아이디", "텍스트", "숫자" FROM "테이블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/TestCreateTable/quoted_identifier_non_ascii_2.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCreateTable/quoted_identifier_non_ascii_2.sql b/tajo-core-tests/src/test/resources/queries/TestCreateTable/quoted_identifier_non_ascii_2.sql
new file mode 100644
index 0000000..f51364d
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCreateTable/quoted_identifier_non_ascii_2.sql
@@ -0,0 +1 @@
+SELECT "아이디" as "진짜아이디", "텍스트" as text, "숫자" FROM "테이블1" as "테이블 별명"
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestCreateTable/quoted_identifier_non_ascii_3.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCreateTable/quoted_identifier_non_ascii_3.sql b/tajo-core-tests/src/test/resources/queries/TestCreateTable/quoted_identifier_non_ascii_3.sql
new file mode 100644
index 0000000..7e8b64c
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCreateTable/quoted_identifier_non_ascii_3.sql
@@ -0,0 +1 @@
+SELECT "아이디" "진짜아이디", char_length("텍스트") as "길이", "숫자" * 2 FROM "테이블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/TestCreateTable/quoted_identifier_non_ascii_ddl.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCreateTable/quoted_identifier_non_ascii_ddl.sql b/tajo-core-tests/src/test/resources/queries/TestCreateTable/quoted_identifier_non_ascii_ddl.sql
new file mode 100644
index 0000000..1706d80
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCreateTable/quoted_identifier_non_ascii_ddl.sql
@@ -0,0 +1 @@
+CREATE EXTERNAL TABLE ${0} ("아이디" int, "텍스트" text, "숫자" int) using text location ${table.path};
\ No newline at end of file

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

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestCreateTable/testNestedRecord1.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCreateTable/testNestedRecord1.sql b/tajo-core-tests/src/test/resources/queries/TestCreateTable/testNestedRecord1.sql
new file mode 100644
index 0000000..d147361
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCreateTable/testNestedRecord1.sql
@@ -0,0 +1 @@
+CREATE TABLE D9.nested_table (f1 int, nested_field record (f2 int4, f3 int8), f3 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/TestCreateTable/testNestedRecord2.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestCreateTable/testNestedRecord2.sql b/tajo-core-tests/src/test/resources/queries/TestCreateTable/testNestedRecord2.sql
new file mode 100644
index 0000000..f794d21
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestCreateTable/testNestedRecord2.sql
@@ -0,0 +1 @@
+CREATE TABLE D9.nested_table2 (f1 int, nf1 record (f1 int4, f3 double), nf2 record (f1 int4, nf1 record (f1 int4, f2 text), nf2 record (f1 int4, f2 text), f2 double), f2 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/TestDropTable/drop_table_ddl.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestDropTable/drop_table_ddl.sql b/tajo-core-tests/src/test/resources/queries/TestDropTable/drop_table_ddl.sql
new file mode 100644
index 0000000..c58f459
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestDropTable/drop_table_ddl.sql
@@ -0,0 +1 @@
+DROP TABLE abc PURGE;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestDropTable/table1_ddl.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestDropTable/table1_ddl.sql b/tajo-core-tests/src/test/resources/queries/TestDropTable/table1_ddl.sql
new file mode 100644
index 0000000..0d56ec8
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestDropTable/table1_ddl.sql
@@ -0,0 +1 @@
+CREATE TABLE ${0} (id int, str text, num int);

http://git-wip-us.apache.org/repos/asf/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testComplexParameter.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testComplexParameter.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testComplexParameter.sql
new file mode 100644
index 0000000..8d5de04
--- /dev/null
+++ b/tajo-core-tests/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/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testComplexParameter2.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testComplexParameter2.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testComplexParameter2.sql
new file mode 100644
index 0000000..d72dc99
--- /dev/null
+++ b/tajo-core-tests/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/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testComplexParameterWithSubQuery.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testComplexParameterWithSubQuery.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testComplexParameterWithSubQuery.sql
new file mode 100644
index 0000000..6f2c77c
--- /dev/null
+++ b/tajo-core-tests/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/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testComplexTargetWithPythonUdaf.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testComplexTargetWithPythonUdaf.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testComplexTargetWithPythonUdaf.sql
new file mode 100644
index 0000000..551655f
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testComplexTargetWithPythonUdaf.sql
@@ -0,0 +1 @@
+select countpy() + max(l_orderkey) as merged 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/testDistinctAggregation1.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation1.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation1.sql
new file mode 100644
index 0000000..6fe604e
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation1.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/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation2.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation2.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation2.sql
new file mode 100644
index 0000000..6bf8a8a
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation2.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/tajo/blob/a4106883/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation3.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation3.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation3.sql
new file mode 100644
index 0000000..0156bef
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation3.sql
@@ -0,0 +1 @@
+select count(*), count(distinct l_orderkey), sum(distinct l_orderkey) 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/testDistinctAggregation4.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation4.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation4.sql
new file mode 100644
index 0000000..0e6e14a
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation4.sql
@@ -0,0 +1 @@
+select l_linenumber, count(*), count(distinct l_orderkey), sum(distinct l_orderkey) 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/testDistinctAggregation5.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation5.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation5.sql
new file mode 100644
index 0000000..a4d1472
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation5.sql
@@ -0,0 +1 @@
+select sum(distinct l_orderkey), l_linenumber, count(distinct l_orderkey), 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/testDistinctAggregation6.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation6.sql b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation6.sql
new file mode 100644
index 0000000..242eb18
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation6.sql
@@ -0,0 +1,9 @@
+select
+  count(distinct l_orderkey) as v0,
+  sum(l_orderkey) as v1,
+  sum(l_linenumber) as v2,
+  count(*) as v4
+from
+  lineitem
+group by
+  l_orderkey;
\ No newline at end of file