You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tajo.apache.org by hy...@apache.org on 2014/04/18 13:44:53 UTC
[50/57] [abbrv] [partial] TAJO-752: Escalate sub modules in tajo-core
into the top-level modules. (hyunsik)
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index ffe96cc..1bc79c9 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -649,6 +649,9 @@ Release 0.8.0 - unreleased
TASKS
+ TAJO-752: Escalate sub modules in tajo-core into the top-level modules.
+ (hyunsik)
+
TAJO-753: Clean up of maven dependencies. (jinho)
TAJO-730: Update Tajo site to reflect graduation. (hyunsik)
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index bd3358a..964d984 100644
--- a/pom.xml
+++ b/pom.xml
@@ -88,6 +88,7 @@
<module>tajo-jdbc</module>
<module>tajo-dist</module>
<module>tajo-storage</module>
+ <module>tajo-yarn-pullserver</module>
</modules>
<build>
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-client/pom.xml
----------------------------------------------------------------------
diff --git a/tajo-client/pom.xml b/tajo-client/pom.xml
index 6a14382..5662678 100644
--- a/tajo-client/pom.xml
+++ b/tajo-client/pom.xml
@@ -114,7 +114,7 @@
<argument>-Isrc/main/proto/</argument>
<argument>--proto_path=../tajo-common/src/main/proto</argument>
<argument>--proto_path=../tajo-catalog/tajo-catalog-common/src/main/proto</argument>
- <argument>--proto_path=../tajo-core/tajo-core-backend/src/main/proto</argument>
+ <argument>--proto_path=../tajo-core/src/main/proto</argument>
<argument>--java_out=target/generated-sources/proto</argument>
<argument>src/main/proto/ClientProtos.proto</argument>
<argument>src/main/proto/TajoMasterClientProtocol.proto</argument>
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-client/src/main/java/org/apache/tajo/client/TajoDump.java
----------------------------------------------------------------------
diff --git a/tajo-client/src/main/java/org/apache/tajo/client/TajoDump.java b/tajo-client/src/main/java/org/apache/tajo/client/TajoDump.java
index 05a921e..52711c9 100644
--- a/tajo-client/src/main/java/org/apache/tajo/client/TajoDump.java
+++ b/tajo-client/src/main/java/org/apache/tajo/client/TajoDump.java
@@ -110,14 +110,15 @@ public class TajoDump {
}
PrintWriter writer = new PrintWriter(System.out);
- dump(client, userInfo, baseDatabaseName, isDumpingAllDatabases, writer);
+ dump(client, userInfo, baseDatabaseName, isDumpingAllDatabases, true, writer);
System.exit(0);
}
public static void dump(TajoClient client, UserGroupInformation userInfo, String baseDatabaseName,
- boolean isDumpingAllDatabases, PrintWriter out) throws SQLException, ServiceException {
- printHeader(out, userInfo);
+ boolean isDumpingAllDatabases, boolean includeDate, PrintWriter out)
+ throws SQLException, ServiceException {
+ printHeader(out, userInfo, includeDate);
if (isDumpingAllDatabases) {
// sort database names in an ascending lexicographic order of the names.
@@ -133,12 +134,14 @@ public class TajoDump {
out.flush();
}
- private static void printHeader(PrintWriter writer, UserGroupInformation userInfo) {
+ private static void printHeader(PrintWriter writer, UserGroupInformation userInfo, boolean includeDate) {
writer.write("--\n");
writer.write("-- Tajo database dump\n");
writer.write("--\n");
writer.write("-- Dump user: " + userInfo.getUserName() + "\n");
- writer.write("-- Dump date: " + toDateString() + "\n");
+ if (includeDate) {
+ writer.write("-- Dump date: " + toDateString() + "\n");
+ }
writer.write("--\n");
writer.write("\n");
}
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-common/src/main/java/org/apache/tajo/util/FileUtil.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/util/FileUtil.java b/tajo-common/src/main/java/org/apache/tajo/util/FileUtil.java
index 6bbce04..9aa6af9 100644
--- a/tajo-common/src/main/java/org/apache/tajo/util/FileUtil.java
+++ b/tajo-common/src/main/java/org/apache/tajo/util/FileUtil.java
@@ -23,6 +23,7 @@ import org.apache.hadoop.fs.*;
import org.apache.hadoop.io.IOUtils;
import java.io.*;
+import java.net.URL;
import java.nio.charset.Charset;
public class FileUtil {
@@ -81,6 +82,10 @@ public class FileUtil {
return new File(path);
}
+ public static URL getResourcePath(String resource) throws IOException {
+ return ClassLoader.getSystemResource(resource);
+ }
+
public static String readTextFileFromResource(String resource) throws IOException {
StringBuilder fileData = new StringBuilder(1000);
InputStream inputStream = ClassLoader.getSystemResourceAsStream(resource);
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-core/benchmark/simple/groupby1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/benchmark/simple/groupby1.sql b/tajo-core/benchmark/simple/groupby1.sql
new file mode 100644
index 0000000..cb6ff09
--- /dev/null
+++ b/tajo-core/benchmark/simple/groupby1.sql
@@ -0,0 +1,6 @@
+select
+ l_orderkey, sum(l_quantity) as sum_qty, max(l_quantity) as max_qty, min(l_quantity) as min_qty
+from
+ lineitem
+group by
+ l_orderkey
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-core/benchmark/simple/groupby2.sql
----------------------------------------------------------------------
diff --git a/tajo-core/benchmark/simple/groupby2.sql b/tajo-core/benchmark/simple/groupby2.sql
new file mode 100644
index 0000000..7178e20
--- /dev/null
+++ b/tajo-core/benchmark/simple/groupby2.sql
@@ -0,0 +1,6 @@
+select
+ l_orderkey, l_linenumber, sum(l_quantity) as sum_qty, max(l_quantity) as max_qty, min(l_quantity) as min_qty
+from
+ lineitem
+group by
+ l_orderkey, l_linenumber
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-core/benchmark/simple/selection1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/benchmark/simple/selection1.sql b/tajo-core/benchmark/simple/selection1.sql
new file mode 100644
index 0000000..e5fd404
--- /dev/null
+++ b/tajo-core/benchmark/simple/selection1.sql
@@ -0,0 +1,5 @@
+select
+ *
+from
+ lineitem
+
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-core/benchmark/simple/selection2.sql
----------------------------------------------------------------------
diff --git a/tajo-core/benchmark/simple/selection2.sql b/tajo-core/benchmark/simple/selection2.sql
new file mode 100644
index 0000000..0c120d8
--- /dev/null
+++ b/tajo-core/benchmark/simple/selection2.sql
@@ -0,0 +1,5 @@
+select
+ l_orderkey, l_linenumber
+from
+ lineitem
+
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-core/benchmark/simple/selection3.sql
----------------------------------------------------------------------
diff --git a/tajo-core/benchmark/simple/selection3.sql b/tajo-core/benchmark/simple/selection3.sql
new file mode 100644
index 0000000..f415c4e
--- /dev/null
+++ b/tajo-core/benchmark/simple/selection3.sql
@@ -0,0 +1,7 @@
+select
+ l_orderkey, l_linenumber
+from
+ lineitem
+where
+ l_shipdate <= '1998-12-01'
+
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-core/benchmark/tpch/customer.schema
----------------------------------------------------------------------
diff --git a/tajo-core/benchmark/tpch/customer.schema b/tajo-core/benchmark/tpch/customer.schema
new file mode 100644
index 0000000..9df7c38
--- /dev/null
+++ b/tajo-core/benchmark/tpch/customer.schema
@@ -0,0 +1,9 @@
+create table customer (
+ c_custkey long,
+ c_name string,
+ c_nationkey long,
+ c_phone string,
+ c_acctbal double,
+ c_mktsegment string,
+ c_comment string
+)
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-core/benchmark/tpch/lineitem.schema
----------------------------------------------------------------------
diff --git a/tajo-core/benchmark/tpch/lineitem.schema b/tajo-core/benchmark/tpch/lineitem.schema
new file mode 100644
index 0000000..c90c11e
--- /dev/null
+++ b/tajo-core/benchmark/tpch/lineitem.schema
@@ -0,0 +1,19 @@
+create table lineitem (
+ l_orderkey long,
+ l_partkey long,
+ l_suppkey long,
+ l_linenumber int,
+ l_quantity double,
+ l_extendedprice double,
+ l_discount double,
+ l_tax double,
+ l_returnflag string,
+ l_linestatus string,
+ l_shipdate string,
+ l_commitdate string,
+ l_receiptdate string,
+ l_shipinstruct string,
+ l_shipmode string,
+ l_comment string
+ /* primary key (l_orderkey, l_linenumber) */
+)
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-core/benchmark/tpch/nation.schema
----------------------------------------------------------------------
diff --git a/tajo-core/benchmark/tpch/nation.schema b/tajo-core/benchmark/tpch/nation.schema
new file mode 100644
index 0000000..7dd9623
--- /dev/null
+++ b/tajo-core/benchmark/tpch/nation.schema
@@ -0,0 +1,6 @@
+create table nation (
+ n_nationkey long /* primary key */,
+ n_name string,
+ n_regionkey long,
+ n_comment string
+)
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-core/benchmark/tpch/orders.schema
----------------------------------------------------------------------
diff --git a/tajo-core/benchmark/tpch/orders.schema b/tajo-core/benchmark/tpch/orders.schema
new file mode 100644
index 0000000..62cb45b
--- /dev/null
+++ b/tajo-core/benchmark/tpch/orders.schema
@@ -0,0 +1,11 @@
+create table orders (
+ o_orderkey long, /* primary key */
+ o_custkey long,
+ o_orderstatus string,
+ o_totalprice double,
+ o_orderdate string,
+ o_orderpriority string,
+ o_clerk string,
+ o_shippriority int,
+ o_comment string
+)
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-core/benchmark/tpch/part.schema
----------------------------------------------------------------------
diff --git a/tajo-core/benchmark/tpch/part.schema b/tajo-core/benchmark/tpch/part.schema
new file mode 100644
index 0000000..dad053b
--- /dev/null
+++ b/tajo-core/benchmark/tpch/part.schema
@@ -0,0 +1,11 @@
+create table part (
+ p_partkey long /* primary key */,
+ p_name string,
+ p_mfgr string,
+ p_brand string,
+ p_type string,
+ p_size int,
+ p_container string,
+ p_retailprice double,
+ p_comment string
+)
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-core/benchmark/tpch/partsupp.schema
----------------------------------------------------------------------
diff --git a/tajo-core/benchmark/tpch/partsupp.schema b/tajo-core/benchmark/tpch/partsupp.schema
new file mode 100644
index 0000000..4732392
--- /dev/null
+++ b/tajo-core/benchmark/tpch/partsupp.schema
@@ -0,0 +1,8 @@
+create table partsupp (
+ ps_partkey long,
+ ps_suppkey long,
+ ps_availqty int,
+ ps_supplycost double,
+ ps_comment string
+ /* primary key (ps_partkey, ps_suppkey) */
+)
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-core/benchmark/tpch/q1.sql
----------------------------------------------------------------------
diff --git a/tajo-core/benchmark/tpch/q1.sql b/tajo-core/benchmark/tpch/q1.sql
new file mode 100644
index 0000000..3c1f6bb
--- /dev/null
+++ b/tajo-core/benchmark/tpch/q1.sql
@@ -0,0 +1,21 @@
+select
+ l_returnflag,
+ l_linestatus,
+ sum(l_quantity) as sum_qty,
+ sum(l_extendedprice) as sum_base_price,
+ sum(l_extendedprice*(1-l_discount)) as sum_disc_price,
+ sum(l_extendedprice*(1-l_discount)*(1+l_tax)) as sum_charge,
+ avg(l_quantity) as avg_qty,
+ avg(l_extendedprice) as avg_price,
+ avg(l_discount) as avg_disc,
+ count(*) as count_order
+from
+ lineitem
+where
+ l_shipdate <= '1998-09-01'
+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/6594ac1c/tajo-core/benchmark/tpch/q10.sql
----------------------------------------------------------------------
diff --git a/tajo-core/benchmark/tpch/q10.sql b/tajo-core/benchmark/tpch/q10.sql
new file mode 100644
index 0000000..73111c3
--- /dev/null
+++ b/tajo-core/benchmark/tpch/q10.sql
@@ -0,0 +1,31 @@
+select
+ c_custkey,
+ c_name,
+ sum(l_extendedprice * (1 - l_discount)) as revenue,
+ c_acctbal,
+ n_name,
+ c_address,
+ c_phone,
+ c_comment
+from
+ customer,
+ orders,
+ lineitem,
+ nation
+where
+ c_custkey = o_custkey and
+ l_orderkey = o_orderkey and
+ o_orderdate >= '1993-10-01' and
+ o_orderdate < '1994-01-01' and
+ l_returnflag = 'R' and
+ c_nationkey = n_nationkey
+group by
+ c_custkey,
+ c_name,
+ c_acctbal,
+ c_phone,
+ n_name,
+ c_address,
+ c_comment
+order by
+ revenue desc
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-core/benchmark/tpch/q11.sql
----------------------------------------------------------------------
diff --git a/tajo-core/benchmark/tpch/q11.sql b/tajo-core/benchmark/tpch/q11.sql
new file mode 100644
index 0000000..a36cb66
--- /dev/null
+++ b/tajo-core/benchmark/tpch/q11.sql
@@ -0,0 +1,27 @@
+select
+ ps_partkey,
+ sum(ps_supplycost * ps_availqty) as value
+from
+ partsupp,
+ supplier,
+ nation
+where
+ ps_suppkey = s_suppkey
+ and s_nationkey = n_nationkey
+ and n_name = 'GERMANY'
+group by
+ ps_partkey having
+ sum(ps_supplycost * ps_availqty) > (
+ select
+ sum(ps_supplycost * ps_availqty) * 0.0001
+ from
+ partsupp,
+ supplier,
+ nation
+ where
+ ps_suppkey = s_suppkey
+ and s_nationkey = n_nationkey
+ and n_name = '[NATION]'
+ )
+order by
+ value desc
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-core/benchmark/tpch/q12.sql
----------------------------------------------------------------------
diff --git a/tajo-core/benchmark/tpch/q12.sql b/tajo-core/benchmark/tpch/q12.sql
new file mode 100644
index 0000000..2f26ee9
--- /dev/null
+++ b/tajo-core/benchmark/tpch/q12.sql
@@ -0,0 +1,24 @@
+select
+ l_shipmode,
+ sum(case when o_orderpriority ='1-URGENT' or o_orderpriority ='2-HIGH'
+ then 1
+ else 0
+ end) as high_line_count,
+ sum(case when o_orderpriority != '1-URGENT' and o_orderpriority != '2-HIGH'
+ then 1
+ else 0
+ end) as low_line_count
+from
+ orders,
+ lineitem
+where
+ o_orderkey = l_orderkey and
+ (l_shipmode = 'MAIL' or l_shipmode = 'SHIP') and
+ l_commitdate < l_receiptdate and
+ l_shipdate < l_commitdate and
+ l_receiptdate >= '1994-01-01' and
+ l_receiptdate < '1995-01-01'
+group by
+ l_shipmode
+order by
+ l_shipmode
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-core/benchmark/tpch/q13.sql
----------------------------------------------------------------------
diff --git a/tajo-core/benchmark/tpch/q13.sql b/tajo-core/benchmark/tpch/q13.sql
new file mode 100644
index 0000000..2ee0102
--- /dev/null
+++ b/tajo-core/benchmark/tpch/q13.sql
@@ -0,0 +1,18 @@
+select
+ c_count, count(*) as custdist
+from (
+ select
+ c_custkey,
+ count(o_orderkey)
+ from
+ customer left outer join orders on
+ c_custkey = o_custkey
+ and o_comment not like '%special%requests%'
+ group by
+ c_custkey
+ ) as c_orders (c_custkey, c_count)
+group by
+ c_count
+order by
+ custdist desc,
+ c_count desc
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-core/benchmark/tpch/q14.sql
----------------------------------------------------------------------
diff --git a/tajo-core/benchmark/tpch/q14.sql b/tajo-core/benchmark/tpch/q14.sql
new file mode 100644
index 0000000..f00e469
--- /dev/null
+++ b/tajo-core/benchmark/tpch/q14.sql
@@ -0,0 +1,13 @@
+select
+ 100.00 * sum(case
+ when p_type like 'PROMO%'
+ then l_extendedprice*(1-l_discount)
+ else 0
+ end) / sum(l_extendedprice * (1 - l_discount)) as promo_revenue
+from
+ lineitem,
+ part
+where
+ l_partkey = p_partkey and
+ l_shipdate >= '1995-09-01' and
+ l_shipdate < '1995-10-01';
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-core/benchmark/tpch/q15.sql
----------------------------------------------------------------------
diff --git a/tajo-core/benchmark/tpch/q15.sql b/tajo-core/benchmark/tpch/q15.sql
new file mode 100644
index 0000000..fc95929
--- /dev/null
+++ b/tajo-core/benchmark/tpch/q15.sql
@@ -0,0 +1,32 @@
+create view revenue[STREAM_ID] (supplier_no, total_revenue) as
+ select
+ l_suppkey,
+ sum(l_extendedprice * (1 - l_discount))
+ from
+ lineitem
+ where
+ l_shipdate >= date '1996-01-01'
+ and l_shipdate < date '1996-01-01' + interval '3' month
+ group by
+ l_suppkey;
+
+select
+ s_suppkey,
+ s_name,
+ s_address,
+ s_phone,
+ total_revenue
+from
+ supplier,
+ revenue[STREAM_ID]
+where
+ s_suppkey = supplier_no
+ and total_revenue = (
+ select
+ max(total_revenue)
+ from
+ revenue[STREAM_ID]
+ )
+order by
+ s_suppkey;
+ drop view revenue[STREAM_ID];
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-core/benchmark/tpch/q16.sql
----------------------------------------------------------------------
diff --git a/tajo-core/benchmark/tpch/q16.sql b/tajo-core/benchmark/tpch/q16.sql
new file mode 100644
index 0000000..18713e4
--- /dev/null
+++ b/tajo-core/benchmark/tpch/q16.sql
@@ -0,0 +1,30 @@
+select
+ p_brand,
+ p_type,
+ p_size,
+ count(distinct ps_suppkey) as supplier_cnt
+from
+ partsupp,
+ part
+where
+ p_partkey = ps_partkey
+ and p_brand <> 'Brand#45'
+ and p_type not like 'MEDIUM POLISHED%'
+ and p_size in (49, 14, 23, 45, 19, 3, 36, 9)
+ and ps_suppkey not in (
+ select
+ s_suppkey
+ from
+ supplier
+ where
+ s_comment like '%Customer%Complaints%'
+ )
+group by
+ p_brand,
+ p_type,
+ p_size
+order by
+ supplier_cnt desc,
+ p_brand,
+ p_type,
+ p_size;
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-core/benchmark/tpch/q17.sql
----------------------------------------------------------------------
diff --git a/tajo-core/benchmark/tpch/q17.sql b/tajo-core/benchmark/tpch/q17.sql
new file mode 100644
index 0000000..d67a399
--- /dev/null
+++ b/tajo-core/benchmark/tpch/q17.sql
@@ -0,0 +1,17 @@
+select
+ sum(l_extendedprice) / 7.0 as avg_yearly
+from
+ lineitem,
+ part
+where
+ p_partkey = l_partkey
+ and p_brand = 'Brand#23'
+ and p_container = 'MED BOX'
+ and l_quantity < (
+ select
+ 0.2 * avg(l_quantity)
+ from
+ lineitem
+ where
+ l_partkey = p_partkey
+ )
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-core/benchmark/tpch/q18.sql
----------------------------------------------------------------------
diff --git a/tajo-core/benchmark/tpch/q18.sql b/tajo-core/benchmark/tpch/q18.sql
new file mode 100644
index 0000000..43b2787
--- /dev/null
+++ b/tajo-core/benchmark/tpch/q18.sql
@@ -0,0 +1,33 @@
+select
+ c_name,
+ c_custkey,
+ o_orderkey,
+ o_orderdate,
+ o_totalprice,
+ sum(l_quantity)
+from
+ customer,
+ orders,
+ lineitem
+where
+ o_orderkey in (
+ select
+ l_orderkey
+ from
+ lineitem
+ group by
+ l_orderkey
+ having
+ sum(l_quantity) > [QUANTITY]
+ )
+ and c_custkey = o_custkey
+ and o_orderkey = l_orderkey
+group by
+ c_name,
+ c_custkey,
+ o_orderkey,
+ o_orderdate,
+ o_totalprice
+order by
+ o_totalprice desc,
+ o_orderdate
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-core/benchmark/tpch/q19.sql
----------------------------------------------------------------------
diff --git a/tajo-core/benchmark/tpch/q19.sql b/tajo-core/benchmark/tpch/q19.sql
new file mode 100644
index 0000000..7760e46
--- /dev/null
+++ b/tajo-core/benchmark/tpch/q19.sql
@@ -0,0 +1,35 @@
+select
+ sum(l_extendedprice * (1 - l_discount) ) as revenue
+from
+ lineitem,
+ part
+where
+ (
+ p_partkey = l_partkey
+ and p_brand = 'Brand#12'
+ and p_container in ( 'SM CASE', 'SM BOX', 'SM PACK', 'SM PKG')
+ and l_quantity >= 1 and l_quantity <= 1 + 10
+ and p_size between 1 and 5
+ and l_shipmode in ('AIR', 'AIR REG')
+ and l_shipinstruct = 'DELIVER IN PERSON'
+ )
+or
+ (
+ p_partkey = l_partkey
+ and p_brand = 'Brand#23'
+ and p_container in ('MED BAG', 'MED BOX', 'MED PKG', 'MED PACK')
+ and l_quantity >= 10 and l_quantity <= 10 + 10
+ and p_size between 1 and 10
+ and l_shipmode in ('AIR', 'AIR REG')
+ and l_shipinstruct = 'DELIVER IN PERSON'
+ )
+or
+ (
+ p_partkey = l_partkey
+ and p_brand = 'Brand#34'
+ and p_container in ( 'LG CASE', 'LG BOX', 'LG PACK', 'LG PKG')
+ and l_quantity >= 20 and l_quantity <= 20 + 10
+ and p_size between 1 and 15
+ and l_shipmode in ('AIR', 'AIR REG')
+ and l_shipinstruct = 'DELIVER IN PERSON'
+ )
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-core/benchmark/tpch/q2.sql
----------------------------------------------------------------------
diff --git a/tajo-core/benchmark/tpch/q2.sql b/tajo-core/benchmark/tpch/q2.sql
new file mode 100644
index 0000000..b7a7cd8
--- /dev/null
+++ b/tajo-core/benchmark/tpch/q2.sql
@@ -0,0 +1,38 @@
+select
+ s_acctbal,
+ s_name,
+ n_name,
+ p_partkey,
+ p_mfgr,
+ s_address,
+ s_phone,
+ s_comment
+from
+ part,
+ supplier,
+ partsupp,
+ nation,
+ region
+where
+ p_partkey = ps_partkey
+ and s_suppkey = ps_suppkey
+ and p_size = 15
+ and p_type like '%BRASS'
+ and s_nationkey = n_nationkey
+ and n_regionkey = r_regionkey
+ and r_name = 'c'
+ and ps_supplycost =
+ (
+ select min(ps_supplycost) from partsupp, supplier, nation, region
+ where
+ p_partkey = ps_partkey
+ and s_suppkey = ps_suppkey
+ and s_nationkey = n_nationkey
+ and n_regionkey = r_regionkey
+ and r_name = 'EUROPE'
+ )
+order by
+ s_acctbal desc,
+ n_name,
+ s_name,
+ p_partkey
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-core/benchmark/tpch/q20.sql
----------------------------------------------------------------------
diff --git a/tajo-core/benchmark/tpch/q20.sql b/tajo-core/benchmark/tpch/q20.sql
new file mode 100644
index 0000000..11f9919
--- /dev/null
+++ b/tajo-core/benchmark/tpch/q20.sql
@@ -0,0 +1,36 @@
+select
+ s_name,
+ s_address
+from
+ supplier, nation
+ where
+ s_suppkey in (
+ select
+ ps_suppkey
+ from
+ partsupp
+ where
+ ps_partkey in (
+ select
+ p_partkey
+ from
+ part
+ where
+ p_name like 'forest%'
+ )
+ and ps_availqty > (
+ select
+ 0.5 * sum(l_quantity)
+ from
+ lineitem
+ where
+ l_partkey = ps_partkey
+ and l_suppkey = ps_suppkey
+ and l_shipdate >= date('1994-01-01')
+ and l_shipdate < date('1994-01-01') + interval '1' year
+ )
+ )
+ and s_nationkey = n_nationkey
+ and n_name = 'CANADA'
+order by
+ s_name
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-core/benchmark/tpch/q21.sql
----------------------------------------------------------------------
diff --git a/tajo-core/benchmark/tpch/q21.sql b/tajo-core/benchmark/tpch/q21.sql
new file mode 100644
index 0000000..66cb0d4
--- /dev/null
+++ b/tajo-core/benchmark/tpch/q21.sql
@@ -0,0 +1,39 @@
+select
+ s_name,
+ count(*) as numwait
+from
+ supplier,
+ lineitem l1,
+ orders,
+ nation
+where
+ s_suppkey = l1.l_suppkey
+ and o_orderkey = l1.l_orderkey
+ and o_orderstatus = 'F'
+ and l1.l_receiptdate > l1.l_commitdate
+ and exists (
+ select
+ *
+ from
+ lineitem l2
+ where
+ l2.l_orderkey = l1.l_orderkey
+ and l2.l_suppkey <> l1.l_suppkey
+ )
+ and not exists (
+ select
+ *
+ from
+ lineitem l3
+ where
+ l3.l_orderkey = l1.l_orderkey
+ and l3.l_suppkey <> l1.l_suppkey
+ and l3.l_receiptdate > l3.l_commitdate
+ )
+ and s_nationkey = n_nationkey
+ and n_name = 'SAUDI ARABIA'
+group by
+ s_name
+order by
+ numwait desc,
+ s_name
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-core/benchmark/tpch/q22.sql
----------------------------------------------------------------------
diff --git a/tajo-core/benchmark/tpch/q22.sql b/tajo-core/benchmark/tpch/q22.sql
new file mode 100644
index 0000000..d315e48
--- /dev/null
+++ b/tajo-core/benchmark/tpch/q22.sql
@@ -0,0 +1,36 @@
+select
+ cntrycode,
+ count(*) as numcust,
+ sum(c_acctbal) as totacctbal
+from (
+ select
+ substring(c_phone from 1 for 2) as cntrycode,
+ c_acctbal
+ from
+ customer
+ where
+ substring(c_phone from 1 for 2) in
+ ('13','31','23','29','30','18','17')
+ and c_acctbal > (
+ select
+ avg(c_acctbal)
+ from
+ customer
+ where
+ c_acctbal > 0.00
+ and substring (c_phone from 1 for 2) in
+ ('13','31','23','29','30','18','17')
+ )
+ and not exists (
+ select
+ *
+ from
+ orders
+ where
+ o_custkey = c_custkey
+ )
+ ) as custsale
+group by
+ cntrycode
+order by
+ cntrycode
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-core/benchmark/tpch/q3.sql
----------------------------------------------------------------------
diff --git a/tajo-core/benchmark/tpch/q3.sql b/tajo-core/benchmark/tpch/q3.sql
new file mode 100644
index 0000000..60c8fdb
--- /dev/null
+++ b/tajo-core/benchmark/tpch/q3.sql
@@ -0,0 +1,22 @@
+select
+ l_orderkey,
+ sum(l_extendedprice*(1-l_discount)) as revenue,
+ o_orderdate,
+ o_shippriority
+from
+ customer,
+ orders,
+ lineitem
+where
+ c_mktsegment = 'BUILDING' and
+ c_custkey = o_custkey and
+ l_orderkey = o_orderkey and
+ o_orderdate < '1995-03-15' and
+ l_shipdate > '1995-03-15'
+group by
+ l_orderkey,
+ o_orderdate,
+ o_shippriority
+order by
+ revenue desc,
+ o_orderdate
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-core/benchmark/tpch/q4.sql
----------------------------------------------------------------------
diff --git a/tajo-core/benchmark/tpch/q4.sql b/tajo-core/benchmark/tpch/q4.sql
new file mode 100644
index 0000000..2ab4598
--- /dev/null
+++ b/tajo-core/benchmark/tpch/q4.sql
@@ -0,0 +1,21 @@
+select
+ o_orderpriority,
+ count(*) as order_count
+from
+ orders
+where
+ o_orderdate >= '1993-07-01'
+ and o_orderdate < '1993-10-01'
+ and exists (
+ select
+ *
+ from
+ lineitem
+ where
+ l_orderkey = o_orderkey
+ and l_commitdate < l_receiptdate
+ )
+group by
+ o_orderpriority
+order by
+ o_orderpriority;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-core/benchmark/tpch/q5.sql
----------------------------------------------------------------------
diff --git a/tajo-core/benchmark/tpch/q5.sql b/tajo-core/benchmark/tpch/q5.sql
new file mode 100644
index 0000000..e7d3d56
--- /dev/null
+++ b/tajo-core/benchmark/tpch/q5.sql
@@ -0,0 +1,24 @@
+select
+ n_name,
+ sum(l_extendedprice * (1 - l_discount)) as revenue
+from
+ customer,
+ orders,
+ lineitem,
+ supplier,
+ nation,
+ region
+where
+ c_custkey = o_custkey and
+ l_orderkey = o_orderkey and
+ l_suppkey = s_suppkey and
+ c_nationkey = s_nationkey and
+ s_nationkey = n_nationkey and
+ n_regionkey = r_regionkey and
+ r_name = 'ASIA' and
+ o_orderdate >= '1994-01-01' and
+ o_orderdate < '1995-01-01'
+group by
+ n_name
+order by
+ revenue desc
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-core/benchmark/tpch/q6.sql
----------------------------------------------------------------------
diff --git a/tajo-core/benchmark/tpch/q6.sql b/tajo-core/benchmark/tpch/q6.sql
new file mode 100644
index 0000000..6427ca7
--- /dev/null
+++ b/tajo-core/benchmark/tpch/q6.sql
@@ -0,0 +1,10 @@
+select
+ sum(l_extendedprice*l_discount) as revenue
+from
+ lineitem
+where
+ l_shipdate >= '1994-01-01' and
+ l_shipdate < '1995-01-01' and
+ l_discount >= 0.05 and
+ l_discount <= 0.07 and
+ l_quantity < 24
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-core/benchmark/tpch/q7.sql
----------------------------------------------------------------------
diff --git a/tajo-core/benchmark/tpch/q7.sql b/tajo-core/benchmark/tpch/q7.sql
new file mode 100644
index 0000000..a7d0f79
--- /dev/null
+++ b/tajo-core/benchmark/tpch/q7.sql
@@ -0,0 +1,38 @@
+select
+ supp_nation,
+ cust_nation,
+ l_year,
+ sum(volume) as revenue
+from (
+ select
+ n1.n_name as supp_nation,
+ n2.n_name as cust_nation,
+ l_shipdate as l_year,
+ l_extendedprice * (1 - l_discount) as volume
+ from
+ supplier,
+ lineitem,
+ orders,
+ customer,
+ nation n1,
+ nation n2
+ where
+ s_suppkey = l_suppkey
+ and o_orderkey = l_orderkey
+ and c_custkey = o_custkey
+ and s_nationkey = n1.n_nationkey
+ and c_nationkey = n2.n_nationkey
+ and (
+ (n1.n_name = 'FRANCE' and n2.n_name = 'GERMANY')
+ or (n1.n_name = 'GERMANY' and n2.n_name = 'FRANCE')
+ )
+ and '1995-01-01' < l_shipdate and l_shipdate < '1996-12-31'
+ ) as shipping
+group by
+ supp_nation,
+ cust_nation,
+ l_year
+order by
+ supp_nation,
+ cust_nation,
+ l_year;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-core/benchmark/tpch/q8.sql
----------------------------------------------------------------------
diff --git a/tajo-core/benchmark/tpch/q8.sql b/tajo-core/benchmark/tpch/q8.sql
new file mode 100644
index 0000000..9e96d4d
--- /dev/null
+++ b/tajo-core/benchmark/tpch/q8.sql
@@ -0,0 +1,37 @@
+select
+ o_year,
+ sum(case
+ when nation = 'BRAZIL'
+ then volume
+ else 0
+ end) / sum(volume) as mkt_share
+from (
+ select
+ o_orderdate as o_year,
+ l_extendedprice * (1-l_discount) as volume,
+ n2.n_name as nation
+ from
+ part,
+ supplier,
+ lineitem,
+ orders,
+ customer,
+ nation n1,
+ nation n2,
+ region
+ where
+ p_partkey = l_partkey
+ and s_suppkey = l_suppkey
+ and l_orderkey = o_orderkey
+ and o_custkey = c_custkey
+ and c_nationkey = n1.n_nationkey
+ and n1.n_regionkey = r_regionkey
+ and r_name = 'AMERICA'
+ and s_nationkey = n2.n_nationkey
+ and '1995-01-01' < o_orderdate and o_orderdate <'1996-12-31'
+ and p_type = 'ECONOMY ANODIZED STEEL'
+ ) as all_nations
+group by
+ o_year
+order by
+ o_year;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-core/benchmark/tpch/q9.sql
----------------------------------------------------------------------
diff --git a/tajo-core/benchmark/tpch/q9.sql b/tajo-core/benchmark/tpch/q9.sql
new file mode 100644
index 0000000..06c69ed
--- /dev/null
+++ b/tajo-core/benchmark/tpch/q9.sql
@@ -0,0 +1,31 @@
+select
+ nation,
+ o_year,
+ sum(amount) as sum_profit
+ from (
+ select
+ n_name as nation,
+ o_orderdate as o_year,
+ l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity as amount
+ from
+ part,
+ supplier,
+ lineitem,
+ partsupp,
+ orders,
+ nation
+ where
+ s_suppkey = l_suppkey
+ and ps_suppkey = l_suppkey
+ and ps_partkey = l_partkey
+ and p_partkey = l_partkey
+ and o_orderkey = l_orderkey
+ and s_nationkey = n_nationkey
+ and p_name like 'green'
+ ) as profit
+group by
+ nation,
+ o_year
+order by
+ nation,
+ o_year desc;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-core/benchmark/tpch/region.schema
----------------------------------------------------------------------
diff --git a/tajo-core/benchmark/tpch/region.schema b/tajo-core/benchmark/tpch/region.schema
new file mode 100644
index 0000000..e9a0057
--- /dev/null
+++ b/tajo-core/benchmark/tpch/region.schema
@@ -0,0 +1,5 @@
+create table region (
+ r_regionkey long /* primary key */,
+ r_name string,
+ r_comment string
+)
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-core/benchmark/tpch/supplier.schema
----------------------------------------------------------------------
diff --git a/tajo-core/benchmark/tpch/supplier.schema b/tajo-core/benchmark/tpch/supplier.schema
new file mode 100644
index 0000000..4fca98b
--- /dev/null
+++ b/tajo-core/benchmark/tpch/supplier.schema
@@ -0,0 +1,9 @@
+create table supplier (
+ s_suppkey long /* primary key */,
+ s_name string,
+ s_address string,
+ s_nationkey long,
+ s_phone string,
+ s_acctbal double,
+ s_comment string
+)
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-core/pom.xml
----------------------------------------------------------------------
diff --git a/tajo-core/pom.xml b/tajo-core/pom.xml
index 709390d..2f38e92 100644
--- a/tajo-core/pom.xml
+++ b/tajo-core/pom.xml
@@ -1,8 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Licensed 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
+ 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
@@ -14,7 +18,7 @@
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>tajo-project</artifactId>
@@ -23,19 +27,27 @@
<relativePath>../tajo-project</relativePath>
</parent>
<artifactId>tajo-core</artifactId>
- <packaging>pom</packaging>
+ <packaging>jar</packaging>
<name>Tajo Core</name>
<version>0.8.0-SNAPSHOT</version>
-
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ <antlr4.visitor>true</antlr4.visitor>
+ <antlr4.listener>true</antlr4.listener>
+ <metrics.version>3.0.1</metrics.version>
</properties>
- <modules>
- <module>tajo-core-backend</module>
- <module>tajo-core-pullserver</module>
- </modules>
+ <repositories>
+ <repository>
+ <id>repository.jboss.org</id>
+ <url>https://repository.jboss.org/nexus/content/repositories/releases/
+ </url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
<build>
<plugins>
@@ -49,6 +61,88 @@
</configuration>
</plugin>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.12.4</version>
+ <configuration>
+ <systemProperties>
+ <tajo.test>TRUE</tajo.test>
+ </systemProperties>
+ <argLine>-Xms512m -Xmx1024m -XX:MaxPermSize=128m -Dfile.encoding=UTF-8</argLine>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.antlr</groupId>
+ <artifactId>antlr4-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>antlr4</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>create-protobuf-generated-sources-directory</id>
+ <phase>initialize</phase>
+ <configuration>
+ <target>
+ <mkdir dir="target/generated-sources/proto" />
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>1.2</version>
+ <executions>
+ <execution>
+ <id>generate-sources</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <executable>protoc</executable>
+ <arguments>
+ <argument>-Isrc/main/proto/</argument>
+ <argument>--proto_path=../tajo-common/src/main/proto</argument>
+ <argument>--proto_path=../tajo-catalog/tajo-catalog-common/src/main/proto</argument>
+ <argument>--proto_path=../tajo-client/src/main/proto</argument>
+ <argument>--java_out=target/generated-sources/proto</argument>
+ <argument>src/main/proto/ResourceTrackerProtocol.proto</argument>
+ <argument>src/main/proto/QueryMasterProtocol.proto</argument>
+ <argument>src/main/proto/TajoMasterProtocol.proto</argument>
+ <argument>src/main/proto/TajoWorkerProtocol.proto</argument>
+ <argument>src/main/proto/InternalTypes.proto</argument>
+ </arguments>
+ </configuration>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.5</version>
@@ -69,122 +163,517 @@
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-report-plugin</artifactId>
- <version>2.15</version>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-dependencies</id>
+ <phase>package</phase>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <configuration>
+ <includeScope>runtime</includeScope>
+ <outputDirectory>${project.build.directory}/lib</outputDirectory>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>false</overWriteSnapshots>
+ <overWriteIfNewer>true</overWriteIfNewer>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ <version>2.7.1</version>
</plugin>
</plugins>
</build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tajo</groupId>
+ <artifactId>tajo-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tajo</groupId>
+ <artifactId>tajo-algebra</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tajo</groupId>
+ <artifactId>tajo-catalog-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tajo</groupId>
+ <artifactId>tajo-catalog-client</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tajo</groupId>
+ <artifactId>tajo-catalog-server</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tajo</groupId>
+ <artifactId>tajo-storage</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tajo</groupId>
+ <artifactId>tajo-yarn-pullserver</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tajo</groupId>
+ <artifactId>tajo-client</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tajo</groupId>
+ <artifactId>tajo-jdbc</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tajo</groupId>
+ <artifactId>tajo-rpc</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-common</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-minicluster</artifactId>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-el</groupId>
+ <artifactId>commons-el</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>tomcat</groupId>
+ <artifactId>jasper-runtime</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>tomcat</groupId>
+ <artifactId>jasper-compiler</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jsp-2.1-jetty</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.sun.jersey.jersey-test-framework</groupId>
+ <artifactId>jersey-test-framework-grizzly2</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-hdfs</artifactId>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-el</groupId>
+ <artifactId>commons-el</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>tomcat</groupId>
+ <artifactId>jasper-runtime</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>tomcat</groupId>
+ <artifactId>jasper-compiler</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jsp-2.1-jetty</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.sun.jersey.jersey-test-framework</groupId>
+ <artifactId>jersey-test-framework-grizzly2</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-yarn-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-yarn-common</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-yarn-client</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-yarn-server-nodemanager</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-yarn-server-resourcemanager</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-yarn-server-common</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-mapreduce-client-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-yarn-server-tests</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.protobuf</groupId>
+ <artifactId>protobuf-java</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.antlr</groupId>
+ <artifactId>antlr4</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.dspace.dependencies</groupId>
+ <artifactId>dspace-geoip</artifactId>
+ <version>1.2.3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jdt</groupId>
+ <artifactId>core</artifactId>
+ <version>3.1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty</artifactId>
+ <version>6.1.14</version>
+ </dependency>
+ <dependency>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jsp-2.1</artifactId>
+ <version>6.1.14</version>
+ </dependency>
+ <dependency>
+ <groupId>com.codahale.metrics</groupId>
+ <artifactId>metrics-core</artifactId>
+ <version>${metrics.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.codahale.metrics</groupId>
+ <artifactId>metrics-jvm</artifactId>
+ <version>${metrics.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>info.ganglia.gmetric4j</groupId>
+ <artifactId>gmetric4j</artifactId>
+ <version>1.0.3</version>
+ </dependency>
+ </dependencies>
+
<profiles>
<profile>
- <id>src</id>
+ <id>docs</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
- <artifactId>maven-source-plugin</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
- <id>attach-sources</id>
+ <!-- build javadoc jars per jar for publishing to maven -->
+ <id>module-javadocs</id>
+ <phase>package</phase>
<goals>
- <!-- avoid warning about recursion -->
- <goal>jar-no-fork</goal>
+ <goal>jar</goal>
</goals>
+ <configuration>
+ <destDir>${project.build.directory}</destDir>
+ </configuration>
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ <version>2.15</version>
+ <configuration>
+ <aggregate>true</aggregate>
+ </configuration>
+ </plugin>
</plugins>
</build>
</profile>
<profile>
- <id>dist</id>
+ <id>src</id>
<activation>
<activeByDefault>false</activeByDefault>
- <property>
- <name>tar|rpm|deb</name>
- </property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>copy-dependencies</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <configuration>
- <includeScope>runtime</includeScope>
- <excludeGroupIds>org.apache.tajo</excludeGroupIds>
- <outputDirectory>${project.build.directory}/lib</outputDirectory>
- <overWriteReleases>false</overWriteReleases>
- <overWriteSnapshots>false</overWriteSnapshots>
- <overWriteIfNewer>true</overWriteIfNewer>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
+ <artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
- <id>dist</id>
- <phase>prepare-package</phase>
+ <!-- builds source jars and attaches them to the project for publishing -->
+ <id>hadoop-java-sources</id>
+ <phase>package</phase>
<goals>
- <goal>run</goal>
+ <goal>jar-no-fork</goal>
</goals>
- <configuration>
- <target>
- <echo file="${project.build.directory}/dist-layout-stitching.sh">
- run() {
- echo "\$ ${@}"
- "${@}"
- res=$?
- if [ $res != 0 ]; then
- echo
- echo "Failed!"
- echo
- exit $res
- fi
- }
-
- ROOT=`cd ${basedir}/..;pwd`
- echo
- echo "Current directory `pwd`"
- echo
- run rm -rf ${project.artifactId}-${project.version}
- run mkdir ${project.artifactId}-${project.version}
- run cd ${project.artifactId}-${project.version}
- run cp -r ${basedir}/${project.artifactId}-pullserver/target/${project.artifactId}-pullserver-${project.version}*.jar .
- run cp -r ${basedir}/${project.artifactId}-backend/target/${project.artifactId}-backend-${project.version}*.jar .
- run cp -r ${basedir}/${project.artifactId}-backend/target/lib .
- echo
- echo "Tajo Core dist layout available at: ${project.build.directory}/${project.artifactId}-${project.version}"
- echo
- </echo>
- <exec executable="sh" dir="${project.build.directory}" failonerror="true">
- <arg line="./dist-layout-stitching.sh"/>
- </exec>
- </target>
- </configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
+ <profile>
+ <id>hcatalog-0.12.0</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.thrift</groupId>
+ <artifactId>libfb303</artifactId>
+ <version>0.9.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.thrift</groupId>
+ <artifactId>libthrift</artifactId>
+ <version>0.9.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tajo</groupId>
+ <artifactId>tajo-hcatalog</artifactId>
+ <scope>test</scope>
+ <version>${tajo.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>com.google.protobuf</groupId>
+ <artifactId>protobuf-java</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-exec</artifactId>
+ <version>0.12.0</version>
+ <scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-common</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-contrib</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-hbase-handler</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-metastore</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-serde</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-shims</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-testutils</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.thrift</groupId>
+ <artifactId>libfb303</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.thrift</groupId>
+ <artifactId>libthrift</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.jolbox</groupId>
+ <artifactId>bonecp</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.google.protobuf</groupId>
+ <artifactId>protobuf-java</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-metastore</artifactId>
+ <version>0.12.0</version>
+ <scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-common</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-serde</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-shimss</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.thrift</groupId>
+ <artifactId>libfb303</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.thrift</groupId>
+ <artifactId>libthrift</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.jolbox</groupId>
+ <artifactId>bonecp</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.google.protobuf</groupId>
+ <artifactId>protobuf-java</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-cli</artifactId>
+ <version>0.12.0</version>
+ <scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-common</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-exec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-metastore</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-serde</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-service</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-shims</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.jolbox</groupId>
+ <artifactId>bonecp</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.google.protobuf</groupId>
+ <artifactId>protobuf-java</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jline</groupId>
+ <artifactId>jline</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hive.hcatalog</groupId>
+ <artifactId>hcatalog-core</artifactId>
+ <version>0.12.0</version>
+ <scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-cli</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-common</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-exec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-metastore</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-serde</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-service</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-shims</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.jolbox</groupId>
+ <artifactId>bonecp</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.google.protobuf</groupId>
+ <artifactId>protobuf-java</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+ </profile>
</profiles>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ <version>2.4</version>
+ <configuration>
+ <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.15</version>
</plugin>
http://git-wip-us.apache.org/repos/asf/tajo/blob/6594ac1c/tajo-core/src/main/antlr4/org/apache/tajo/engine/parser/HiveQLLexer.g4
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/antlr4/org/apache/tajo/engine/parser/HiveQLLexer.g4 b/tajo-core/src/main/antlr4/org/apache/tajo/engine/parser/HiveQLLexer.g4
new file mode 100644
index 0000000..f7b76ef
--- /dev/null
+++ b/tajo-core/src/main/antlr4/org/apache/tajo/engine/parser/HiveQLLexer.g4
@@ -0,0 +1,390 @@
+/**
+ 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.
+*/
+lexer grammar HiveQLLexer;
+
+
+// Keywords
+
+KW_TRUE : 'TRUE';
+KW_FALSE : 'FALSE';
+KW_ALL : 'ALL';
+KW_AND : 'AND';
+KW_OR : 'OR';
+KW_NOT : 'NOT' | '!';
+KW_LIKE : 'LIKE';
+
+KW_IF : 'IF';
+KW_EXISTS : 'EXISTS';
+
+KW_ASC : 'ASC';
+KW_DESC : 'DESC';
+KW_ORDER : 'ORDER';
+KW_GROUP : 'GROUP';
+KW_BY : 'BY';
+KW_HAVING : 'HAVING';
+KW_WHERE : 'WHERE';
+KW_FROM : 'FROM';
+KW_AS : 'AS';
+KW_SELECT : 'SELECT';
+KW_DISTINCT : 'DISTINCT';
+KW_INSERT : 'INSERT';
+KW_OVERWRITE : 'OVERWRITE';
+KW_OUTER : 'OUTER';
+KW_UNIQUEJOIN : 'UNIQUEJOIN';
+KW_PRESERVE : 'PRESERVE';
+KW_JOIN : 'JOIN';
+KW_LEFT : 'LEFT';
+KW_RIGHT : 'RIGHT';
+KW_FULL : 'FULL';
+KW_ON : 'ON';
+KW_PARTITION : 'PARTITION';
+KW_PARTITIONS : 'PARTITIONS';
+KW_TABLE: 'TABLE';
+KW_TABLES: 'TABLES';
+KW_COLUMNS: 'COLUMNS';
+KW_INDEX: 'INDEX';
+KW_INDEXES: 'INDEXES';
+KW_REBUILD: 'REBUILD';
+KW_FUNCTIONS: 'FUNCTIONS';
+KW_SHOW: 'SHOW';
+KW_MSCK: 'MSCK';
+KW_REPAIR: 'REPAIR';
+KW_DIRECTORY: 'DIRECTORY';
+KW_LOCAL: 'LOCAL';
+KW_TRANSFORM : 'TRANSFORM';
+KW_USING: 'USING';
+KW_CLUSTER: 'CLUSTER';
+KW_DISTRIBUTE: 'DISTRIBUTE';
+KW_SORT: 'SORT';
+KW_UNION: 'UNION';
+KW_LOAD: 'LOAD';
+KW_EXPORT: 'EXPORT';
+KW_IMPORT: 'IMPORT';
+KW_DATA: 'DATA';
+KW_INPATH: 'INPATH';
+KW_IS: 'IS';
+KW_NULL: 'NULL';
+KW_CREATE: 'CREATE';
+KW_EXTERNAL: 'EXTERNAL';
+KW_ALTER: 'ALTER';
+KW_CHANGE: 'CHANGE';
+KW_COLUMN: 'COLUMN';
+KW_FIRST: 'FIRST';
+KW_AFTER: 'AFTER';
+KW_DESCRIBE: 'DESCRIBE';
+KW_DROP: 'DROP';
+KW_RENAME: 'RENAME';
+KW_IGNORE: 'IGNORE';
+KW_PROTECTION: 'PROTECTION';
+KW_TO: 'TO';
+KW_COMMENT: 'COMMENT';
+KW_BOOLEAN: 'BOOLEAN';
+KW_TINYINT: 'TINYINT';
+KW_SMALLINT: 'SMALLINT';
+KW_INT: 'INT';
+KW_BIGINT: 'BIGINT';
+KW_FLOAT: 'FLOAT';
+KW_DOUBLE: 'DOUBLE';
+KW_DATE: 'DATE';
+KW_DATETIME: 'DATETIME';
+KW_TIMESTAMP: 'TIMESTAMP';
+KW_DECIMAL: 'DECIMAL';
+KW_STRING: 'STRING';
+KW_ARRAY: 'ARRAY';
+KW_STRUCT: 'STRUCT';
+KW_MAP: 'MAP';
+KW_UNIONTYPE: 'UNIONTYPE';
+KW_REDUCE: 'REDUCE';
+KW_PARTITIONED: 'PARTITIONED';
+KW_CLUSTERED: 'CLUSTERED';
+KW_SORTED: 'SORTED';
+KW_INTO: 'INTO';
+KW_BUCKETS: 'BUCKETS';
+KW_ROW: 'ROW';
+KW_ROWS: 'ROWS';
+KW_FORMAT: 'FORMAT';
+KW_DELIMITED: 'DELIMITED';
+KW_FIELDS: 'FIELDS';
+KW_TERMINATED: 'TERMINATED';
+KW_ESCAPED: 'ESCAPED';
+KW_COLLECTION: 'COLLECTION';
+KW_ITEMS: 'ITEMS';
+KW_KEYS: 'KEYS';
+KW_KEY_TYPE: '$KEY$';
+KW_LINES: 'LINES';
+KW_STORED: 'STORED';
+KW_FILEFORMAT: 'FILEFORMAT';
+KW_SEQUENCEFILE: 'SEQUENCEFILE';
+KW_TEXTFILE: 'TEXTFILE';
+KW_RCFILE: 'RCFILE';
+KW_ORCFILE: 'ORC';
+KW_INPUTFORMAT: 'INPUTFORMAT';
+KW_OUTPUTFORMAT: 'OUTPUTFORMAT';
+KW_INPUTDRIVER: 'INPUTDRIVER';
+KW_OUTPUTDRIVER: 'OUTPUTDRIVER';
+KW_OFFLINE: 'OFFLINE';
+KW_ENABLE: 'ENABLE';
+KW_DISABLE: 'DISABLE';
+KW_READONLY: 'READONLY';
+KW_NO_DROP: 'NO_DROP';
+KW_LOCATION: 'LOCATION';
+KW_TABLESAMPLE: 'TABLESAMPLE';
+KW_BUCKET: 'BUCKET';
+KW_OUT: 'OUT';
+KW_OF: 'OF';
+KW_PERCENT: 'PERCENT';
+KW_CAST: 'CAST';
+KW_ADD: 'ADD';
+KW_REPLACE: 'REPLACE';
+KW_RLIKE: 'RLIKE';
+KW_REGEXP: 'REGEXP';
+KW_TEMPORARY: 'TEMPORARY';
+KW_FUNCTION: 'FUNCTION';
+KW_EXPLAIN: 'EXPLAIN';
+KW_EXTENDED: 'EXTENDED';
+KW_FORMATTED: 'FORMATTED';
+KW_PRETTY: 'PRETTY';
+KW_DEPENDENCY: 'DEPENDENCY';
+KW_SERDE: 'SERDE';
+KW_WITH: 'WITH';
+KW_DEFERRED: 'DEFERRED';
+KW_SERDEPROPERTIES: 'SERDEPROPERTIES';
+KW_DBPROPERTIES: 'DBPROPERTIES';
+KW_LIMIT: 'LIMIT';
+KW_SET: 'SET';
+KW_UNSET: 'UNSET';
+KW_TBLPROPERTIES: 'TBLPROPERTIES';
+KW_IDXPROPERTIES: 'IDXPROPERTIES';
+KW_VALUE_TYPE: '$VALUE$';
+KW_ELEM_TYPE: '$ELEM$';
+KW_CASE: 'CASE';
+KW_WHEN: 'WHEN';
+KW_THEN: 'THEN';
+KW_ELSE: 'ELSE';
+KW_END: 'END';
+KW_MAPJOIN: 'MAPJOIN';
+KW_STREAMTABLE: 'STREAMTABLE';
+KW_HOLD_DDLTIME: 'HOLD_DDLTIME';
+KW_CLUSTERSTATUS: 'CLUSTERSTATUS';
+KW_UTC: 'UTC';
+KW_UTCTIMESTAMP: 'UTC_TMESTAMP';
+KW_LONG: 'LONG';
+KW_DELETE: 'DELETE';
+KW_PLUS: 'PLUS';
+KW_MINUS: 'MINUS';
+KW_FETCH: 'FETCH';
+KW_INTERSECT: 'INTERSECT';
+KW_VIEW: 'VIEW';
+KW_IN: 'IN';
+KW_DATABASE: 'DATABASE';
+KW_DATABASES: 'DATABASES';
+KW_MATERIALIZED: 'MATERIALIZED';
+KW_SCHEMA: 'SCHEMA';
+KW_SCHEMAS: 'SCHEMAS';
+KW_GRANT: 'GRANT';
+KW_REVOKE: 'REVOKE';
+KW_SSL: 'SSL';
+KW_UNDO: 'UNDO';
+KW_LOCK: 'LOCK';
+KW_LOCKS: 'LOCKS';
+KW_UNLOCK: 'UNLOCK';
+KW_SHARED: 'SHARED';
+KW_EXCLUSIVE: 'EXCLUSIVE';
+KW_PROCEDURE: 'PROCEDURE';
+KW_UNSIGNED: 'UNSIGNED';
+KW_WHILE: 'WHILE';
+KW_READ: 'READ';
+KW_READS: 'READS';
+KW_PURGE: 'PURGE';
+KW_RANGE: 'RANGE';
+KW_ANALYZE: 'ANALYZE';
+KW_BEFORE: 'BEFORE';
+KW_BETWEEN: 'BETWEEN';
+KW_BOTH: 'BOTH';
+KW_BINARY: 'BINARY';
+KW_CROSS: 'CROSS';
+KW_CONTINUE: 'CONTINUE';
+KW_CURSOR: 'CURSOR';
+KW_TRIGGER: 'TRIGGER';
+KW_RECORDREADER: 'RECORDREADER';
+KW_RECORDWRITER: 'RECORDWRITER';
+KW_SEMI: 'SEMI';
+KW_LATERAL: 'LATERAL';
+KW_TOUCH: 'TOUCH';
+KW_ARCHIVE: 'ARCHIVE';
+KW_UNARCHIVE: 'UNARCHIVE';
+KW_COMPUTE: 'COMPUTE';
+KW_STATISTICS: 'STATISTICS';
+KW_USE: 'USE';
+KW_OPTION: 'OPTION';
+KW_CONCATENATE: 'CONCATENATE';
+KW_SHOW_DATABASE: 'SHOW_DATABASE';
+KW_UPDATE: 'UPDATE';
+KW_RESTRICT: 'RESTRICT';
+KW_CASCADE: 'CASCADE';
+KW_SKEWED: 'SKEWED';
+KW_ROLLUP: 'ROLLUP';
+KW_CUBE: 'CUBE';
+KW_DIRECTORIES: 'DIRECTORIES';
+KW_FOR: 'FOR';
+KW_WINDOW: 'WINDOW';
+KW_UNBOUNDED: 'UNBOUNDED';
+KW_PRECEDING: 'PRECEDING';
+KW_FOLLOWING: 'FOLLOWING';
+KW_CURRENT: 'CURRENT';
+KW_LESS: 'LESS';
+KW_MORE: 'MORE';
+KW_OVER: 'OVER';
+KW_GROUPING: 'GROUPING';
+KW_SETS: 'SETS';
+KW_TRUNCATE: 'TRUNCATE';
+KW_NOSCAN: 'NOSCAN';
+KW_PARTIALSCAN: 'PARTIALSCAN';
+KW_USER: 'USER';
+KW_ROLE: 'ROLE';
+KW_INNER: 'INNER';
+
+// Operators
+// NOTE: if you add a new function/operator, add it to sysFuncNames so that describe function _FUNC_ will work.
+
+DOT : '.'; // generated as a part of Number rule
+COLON : ':' ;
+COMMA : ',' ;
+SEMICOLON : ';' ;
+
+LPAREN : '(' ;
+RPAREN : ')' ;
+LSQUARE : '[' ;
+RSQUARE : ']' ;
+LCURLY : '{';
+RCURLY : '}';
+
+EQUAL : '=' | '==';
+EQUAL_NS : '<=>';
+NOTEQUAL : '<>' | '!=';
+LESSTHANOREQUALTO : '<=';
+LESSTHAN : '<';
+GREATERTHANOREQUALTO : '>=';
+GREATERTHAN : '>';
+
+DIVIDE : '/';
+PLUS : '+';
+MINUS : '-';
+STAR : '*';
+MOD : '%';
+DIV : 'DIV';
+
+AMPERSAND : '&';
+TILDE : '~';
+BITWISEOR : '|';
+BITWISEXOR : '^';
+QUESTION : '?';
+DOLLAR : '$';
+
+// LITERALS
+fragment
+Letter
+ : 'a'..'z' | 'A'..'Z'
+ ;
+
+fragment
+HexDigit
+ : 'a'..'f' | 'A'..'F'
+ ;
+
+fragment
+Digit
+ :
+ '0'..'9'
+ ;
+
+fragment
+Exponent
+ :
+ ('e' | 'E') ( PLUS|MINUS )? (Digit)+
+ ;
+
+fragment
+RegexComponent
+ : 'a'..'z' | 'A'..'Z' | '0'..'9' | '_'
+ | PLUS | STAR | QUESTION | MINUS | DOT
+ | LPAREN | RPAREN | LSQUARE | RSQUARE | LCURLY | RCURLY
+ | BITWISEXOR | BITWISEOR | DOLLAR
+ ;
+
+StringLiteral
+ :
+ ( '\'' ( ~('\''|'\\') | ('\\' .) )* '\''
+ | '\"' ( ~('\"'|'\\') | ('\\' .) )* '\"'
+ )+
+ ;
+
+CharSetLiteral
+ :
+ StringLiteral
+ | '0' 'X' (HexDigit|Digit)+
+ ;
+
+BigintLiteral
+ :
+ (Digit)+ 'L'
+ ;
+
+SmallintLiteral
+ :
+ (Digit)+ 'S'
+ ;
+
+TinyintLiteral
+ :
+ (Digit)+ 'Y'
+ ;
+
+DecimalLiteral
+ :
+ Number 'B' 'D'
+ ;
+
+ByteLengthLiteral
+ :
+ (Digit)+ ('b' | 'B' | 'k' | 'K' | 'm' | 'M' | 'g' | 'G')
+ ;
+
+Number
+ :
+ (Digit)+ ( DOT (Digit)* (Exponent)? | Exponent)?
+ ;
+
+Identifier
+ : (Letter | Digit) (Letter | Digit | '_')* { setText(getText().toLowerCase()); }
+ ;
+
+CharSetName
+ :
+ '_' (Letter | Digit | '_' | '-' | '.' | ':' )+
+ ;
+
+WS :
+(' '|'\r'|'\t'|'\n') -> skip
+ ;
+
+COMMENT
+ : '--' (~('\n'|'\r'))* -> skip
+ ;
+
+
+