Repository: tajo
Updated Branches:
  refs/heads/master 68d2c7020 -> e84df9ccb


TAJO-1970: Change the null first syntax.

Closes #856


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

Branch: refs/heads/master
Commit: e84df9ccb1d5e30a08de136efd6f5842b2555a16
Parents: 68d2c70
Author: Jihoon Son <[email protected]>
Authored: Mon Nov 9 19:05:38 2015 +0900
Committer: Jihoon Son <[email protected]>
Committed: Mon Nov 9 19:05:38 2015 +0900

----------------------------------------------------------------------
 CHANGES                                                        | 2 ++
 .../src/test/java/org/apache/tajo/cli/tools/TestTajoDump.java  | 2 +-
 .../org/apache/tajo/engine/planner/TestLogicalPlanner.java     | 2 +-
 .../tajo/engine/planner/physical/TestPhysicalPlanner.java      | 2 +-
 .../java/org/apache/tajo/engine/query/TestCreateIndex.java     | 2 +-
 .../test/java/org/apache/tajo/engine/query/TestIndexScan.java  | 6 +++---
 .../test/java/org/apache/tajo/engine/query/TestSortQuery.java  | 2 +-
 .../test/resources/queries/TestCreateIndex/testCreateIndex.sql | 2 +-
 .../queries/TestCreateIndex/testCreateIndexOnExpression.sql    | 2 +-
 .../queries/TestCreateIndex/testCreateIndexOnLocation.sql      | 2 +-
 .../queries/TestCreateIndex/testCreateIndexOnMultiAttrs.sql    | 2 +-
 .../queries/TestCreateIndex/testCreateIndexOnMultiExprs.sql    | 2 +-
 .../src/test/resources/queries/TestSQLAnalyzer/window5.sql     | 2 +-
 .../src/test/resources/queries/TestSQLAnalyzer/window6.sql     | 2 +-
 .../src/test/resources/queries/TestSQLAnalyzer/window7.sql     | 2 +-
 .../src/test/resources/queries/TestSQLAnalyzer/window8.sql     | 2 +-
 .../src/test/resources/queries/TestSQLAnalyzer/window9.sql     | 2 +-
 tajo-docs/src/main/sphinx/sql_language/queries.rst             | 4 ++--
 .../src/main/antlr4/org/apache/tajo/parser/sql/SQLLexer.g4     | 1 +
 .../src/main/antlr4/org/apache/tajo/parser/sql/SQLParser.g4    | 4 ++--
 20 files changed, 25 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/e84df9cc/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index db7e2c7..60ae302 100644
--- a/CHANGES
+++ b/CHANGES
@@ -55,6 +55,8 @@ Release 0.12.0 - unreleased
 
   TASKS
 
+    TAJO-1970: Change the null first syntax. (jihoon)
+
     TAJO-1904: Extend GraphVisitor to accept user-defined context. (jihoon)
 
     TAJO-1906: Decrease the default size of hash map and array list for 
testing.

http://git-wip-us.apache.org/repos/asf/tajo/blob/e84df9cc/tajo-core-tests/src/test/java/org/apache/tajo/cli/tools/TestTajoDump.java
----------------------------------------------------------------------
diff --git 
a/tajo-core-tests/src/test/java/org/apache/tajo/cli/tools/TestTajoDump.java 
b/tajo-core-tests/src/test/java/org/apache/tajo/cli/tools/TestTajoDump.java
index 13936e6..937b75c 100644
--- a/tajo-core-tests/src/test/java/org/apache/tajo/cli/tools/TestTajoDump.java
+++ b/tajo-core-tests/src/test/java/org/apache/tajo/cli/tools/TestTajoDump.java
@@ -85,7 +85,7 @@ public class TestTajoDump extends QueryTestCaseBase {
         "\".\"TableName1\" (\"Age\" int, \"FirstName\" TEXT, lastname TEXT)");
 
       executeString("CREATE INDEX test_idx on \"" + getCurrentDatabase()
-        + "\".\"TableName1\" ( \"Age\" asc null first, \"FirstName\" desc null 
last )");
+        + "\".\"TableName1\" ( \"Age\" asc nulls first, \"FirstName\" desc 
nulls last )");
 
       try {
         UserRoleInfo userInfo = UserRoleInfo.getCurrentUser();

http://git-wip-us.apache.org/repos/asf/tajo/blob/e84df9cc/tajo-core-tests/src/test/java/org/apache/tajo/engine/planner/TestLogicalPlanner.java
----------------------------------------------------------------------
diff --git 
a/tajo-core-tests/src/test/java/org/apache/tajo/engine/planner/TestLogicalPlanner.java
 
b/tajo-core-tests/src/test/java/org/apache/tajo/engine/planner/TestLogicalPlanner.java
index df4cfd9..a11d9be 100644
--- 
a/tajo-core-tests/src/test/java/org/apache/tajo/engine/planner/TestLogicalPlanner.java
+++ 
b/tajo-core-tests/src/test/java/org/apache/tajo/engine/planner/TestLogicalPlanner.java
@@ -158,7 +158,7 @@ public class TestLogicalPlanner {
       "create table store1 as select p.deptName, sumtest(score) from dept as 
p, score group by p.deptName", // 8
       "select deptName, sumtest(score) from score group by deptName having 
sumtest(score) > 30", // 9
       "select 7 + 8 as res1, 8 * 9 as res2, 10 * 10 as res3", // 10
-      "create index idx_employee on employee using bitmap_idx (name null 
first, empId desc) where empid > 100", // 11
+      "create index idx_employee on employee using bitmap_idx (name nulls 
first, empId desc) where empid > 100", // 11
       "select name, score from employee, score order by score limit 3", // 12
       "select length(name), length(deptname), *, empid+10 from employee where 
empId > 500", // 13
   };

http://git-wip-us.apache.org/repos/asf/tajo/blob/e84df9cc/tajo-core-tests/src/test/java/org/apache/tajo/engine/planner/physical/TestPhysicalPlanner.java
----------------------------------------------------------------------
diff --git 
a/tajo-core-tests/src/test/java/org/apache/tajo/engine/planner/physical/TestPhysicalPlanner.java
 
b/tajo-core-tests/src/test/java/org/apache/tajo/engine/planner/physical/TestPhysicalPlanner.java
index d3f1649..bcecff7 100644
--- 
a/tajo-core-tests/src/test/java/org/apache/tajo/engine/planner/physical/TestPhysicalPlanner.java
+++ 
b/tajo-core-tests/src/test/java/org/apache/tajo/engine/planner/physical/TestPhysicalPlanner.java
@@ -970,7 +970,7 @@ public class TestPhysicalPlanner {
   }
 
   public final String [] createIndexStmt = {
-      "create index idx_employee on employee using TWO_LEVEL_BIN_TREE (name 
null first, empId desc)"
+      "create index idx_employee on employee using TWO_LEVEL_BIN_TREE (name 
nulls first, empId desc)"
   };
 
   @Test

http://git-wip-us.apache.org/repos/asf/tajo/blob/e84df9cc/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestCreateIndex.java
----------------------------------------------------------------------
diff --git 
a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestCreateIndex.java
 
b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestCreateIndex.java
index 81df04a..17a28dc 100644
--- 
a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestCreateIndex.java
+++ 
b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestCreateIndex.java
@@ -102,7 +102,7 @@ public class TestCreateIndex extends QueryTestCaseBase {
     assertTrue(catalog.existIndexByColumnNames(getCurrentDatabase(), 
"lineitem", new String[]{"l_orderkey"}));
     catalog.dropIndex(getCurrentDatabase(), "l_orderkey_idx");
     assertFalse(catalog.existIndexByName(getCurrentDatabase(), 
"l_orderkey_idx"));
-    executeString("create index l_orderkey_idx on lineitem (l_orderkey asc 
null first) location '/tajo/warehouse/default/l_orderkey_idx';");
+    executeString("create index l_orderkey_idx on lineitem (l_orderkey asc 
nulls first) location '/tajo/warehouse/default/l_orderkey_idx';");
     assertTrue(catalog.existIndexByName(getCurrentDatabase(), 
"l_orderkey_idx"));
     assertTrue(catalog.existIndexByColumnNames(getCurrentDatabase(), 
"lineitem", new String[]{"l_orderkey"}));
     executeString("drop index l_orderkey_idx");

http://git-wip-us.apache.org/repos/asf/tajo/blob/e84df9cc/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestIndexScan.java
----------------------------------------------------------------------
diff --git 
a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestIndexScan.java 
b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestIndexScan.java
index 19b1486..f049aeb 100644
--- 
a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestIndexScan.java
+++ 
b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestIndexScan.java
@@ -69,7 +69,7 @@ public class TestIndexScan extends QueryTestCaseBase {
 
   @Test
   public final void testOnMultipleKeys() throws Exception {
-    executeString("create index multikey_idx on lineitem (l_shipdate asc null 
last, l_tax desc null first, l_shipmode, l_linenumber desc null last)");
+    executeString("create index multikey_idx on lineitem (l_shipdate asc nulls 
last, l_tax desc nulls first, l_shipmode, l_linenumber desc nulls last)");
     try {
       ResultSet res = executeString("select l_orderkey, l_shipdate, l_comment 
from lineitem " +
           "where l_shipdate = '1997-01-28' and l_tax = 0.05 and l_shipmode = 
'RAIL' and l_linenumber = 1;");
@@ -82,7 +82,7 @@ public class TestIndexScan extends QueryTestCaseBase {
 
   @Test
   public final void testOnMultipleKeys2() throws Exception {
-    executeString("create index multikey_idx on lineitem (l_shipdate asc null 
last, l_tax desc null first)");
+    executeString("create index multikey_idx on lineitem (l_shipdate asc nulls 
last, l_tax desc nulls first)");
     try {
       ResultSet res = executeString("select l_orderkey, l_shipdate, l_comment 
from lineitem " +
           "where l_shipdate = '1997-01-28' and l_tax = 0.05 and l_shipmode = 
'RAIL' and l_linenumber = 1;");
@@ -95,7 +95,7 @@ public class TestIndexScan extends QueryTestCaseBase {
 
   @Test
   public final void testOnMultipleExprs() throws Exception {
-    executeString("create index l_orderkey_100_l_linenumber_10_idx on lineitem 
(l_orderkey*100-l_linenumber*10 asc null first);");
+    executeString("create index l_orderkey_100_l_linenumber_10_idx on lineitem 
(l_orderkey*100-l_linenumber*10 asc nulls first);");
     try {
       ResultSet res = executeString("select l_orderkey, l_linenumber from 
lineitem where l_orderkey*100-l_linenumber*10 = 280");
       assertResultSet(res);

http://git-wip-us.apache.org/repos/asf/tajo/blob/e84df9cc/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestSortQuery.java
----------------------------------------------------------------------
diff --git 
a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestSortQuery.java 
b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestSortQuery.java
index 6022672..3d6965c 100644
--- 
a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestSortQuery.java
+++ 
b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestSortQuery.java
@@ -283,7 +283,7 @@ public class TestSortQuery extends QueryTestCaseBase {
     TajoTestingCluster.createTable("testSortOnNullColumn3".toLowerCase(), 
schema, tableOptions, data, 1);
 
     try {
-      ResultSet res = executeString("select * from testSortOnNullColumn3 order 
by name null first");
+      ResultSet res = executeString("select * from testSortOnNullColumn3 order 
by name nulls first");
       String ascExpected = "id,name\n" +
           "-------------------------------\n" +
           "2,null\n" +

http://git-wip-us.apache.org/repos/asf/tajo/blob/e84df9cc/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
index 1cb8936..548fa74 100644
--- 
a/tajo-core-tests/src/test/resources/queries/TestCreateIndex/testCreateIndex.sql
+++ 
b/tajo-core-tests/src/test/resources/queries/TestCreateIndex/testCreateIndex.sql
@@ -1 +1 @@
-create index l_orderkey_idx on lineitem (l_orderkey asc null first);
\ No newline at end of file
+create index l_orderkey_idx on lineitem (l_orderkey asc nulls first);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/e84df9cc/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
index 0d19cb3..532352c 100644
--- 
a/tajo-core-tests/src/test/resources/queries/TestCreateIndex/testCreateIndexOnExpression.sql
+++ 
b/tajo-core-tests/src/test/resources/queries/TestCreateIndex/testCreateIndexOnExpression.sql
@@ -1 +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
+create index l_orderkey_100_lt10_idx on lineitem (l_orderkey*100 asc nulls 
first) where l_orderkey*100 > 10;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/e84df9cc/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
index 1cb8936..548fa74 100644
--- 
a/tajo-core-tests/src/test/resources/queries/TestCreateIndex/testCreateIndexOnLocation.sql
+++ 
b/tajo-core-tests/src/test/resources/queries/TestCreateIndex/testCreateIndexOnLocation.sql
@@ -1 +1 @@
-create index l_orderkey_idx on lineitem (l_orderkey asc null first);
\ No newline at end of file
+create index l_orderkey_idx on lineitem (l_orderkey asc nulls first);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/e84df9cc/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
index 3487d2e..2cc9689 100644
--- 
a/tajo-core-tests/src/test/resources/queries/TestCreateIndex/testCreateIndexOnMultiAttrs.sql
+++ 
b/tajo-core-tests/src/test/resources/queries/TestCreateIndex/testCreateIndexOnMultiAttrs.sql
@@ -1 +1 @@
-create index l_orderkey_partkey_idx on lineitem (l_orderkey asc, l_partkey 
desc null last);
\ No newline at end of file
+create index l_orderkey_partkey_idx on lineitem (l_orderkey asc, l_partkey 
desc nulls last);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/e84df9cc/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
index 7938005..ec6a6b9 100644
--- 
a/tajo-core-tests/src/test/resources/queries/TestCreateIndex/testCreateIndexOnMultiExprs.sql
+++ 
b/tajo-core-tests/src/test/resources/queries/TestCreateIndex/testCreateIndexOnMultiExprs.sql
@@ -1 +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
+create index l_orderkey_100_l_linenumber_10_lt10_idx on lineitem 
(l_orderkey*100-l_linenumber*10 asc nulls first) where l_orderkey*100 > 10;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/e84df9cc/tajo-core-tests/src/test/resources/queries/TestSQLAnalyzer/window5.sql
----------------------------------------------------------------------
diff --git 
a/tajo-core-tests/src/test/resources/queries/TestSQLAnalyzer/window5.sql 
b/tajo-core-tests/src/test/resources/queries/TestSQLAnalyzer/window5.sql
index 6338817..cf4e922 100644
--- a/tajo-core-tests/src/test/resources/queries/TestSQLAnalyzer/window5.sql
+++ b/tajo-core-tests/src/test/resources/queries/TestSQLAnalyzer/window5.sql
@@ -1,6 +1,6 @@
  SELECT
   dt,
   dt2,
-  sum(xy) over(partition by round(dt),dt2 order by ceil(dt) asc null last)
+  sum(xy) over(partition by round(dt),dt2 order by ceil(dt) asc nulls last)
 FROM
   sum_example;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/e84df9cc/tajo-core-tests/src/test/resources/queries/TestSQLAnalyzer/window6.sql
----------------------------------------------------------------------
diff --git 
a/tajo-core-tests/src/test/resources/queries/TestSQLAnalyzer/window6.sql 
b/tajo-core-tests/src/test/resources/queries/TestSQLAnalyzer/window6.sql
index 1f1870e..24c134a 100644
--- a/tajo-core-tests/src/test/resources/queries/TestSQLAnalyzer/window6.sql
+++ b/tajo-core-tests/src/test/resources/queries/TestSQLAnalyzer/window6.sql
@@ -1,6 +1,6 @@
  SELECT
   dt,
   dt2,
-  sum(xy) over(partition by round(dt),dt2 order by ceil(dt) asc null last ROWS 
UNBOUNDED PRECEDING)
+  sum(xy) over(partition by round(dt),dt2 order by ceil(dt) asc nulls last 
ROWS UNBOUNDED PRECEDING)
 FROM
   sum_example;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/e84df9cc/tajo-core-tests/src/test/resources/queries/TestSQLAnalyzer/window7.sql
----------------------------------------------------------------------
diff --git 
a/tajo-core-tests/src/test/resources/queries/TestSQLAnalyzer/window7.sql 
b/tajo-core-tests/src/test/resources/queries/TestSQLAnalyzer/window7.sql
index 6daa806..ebdf340 100644
--- a/tajo-core-tests/src/test/resources/queries/TestSQLAnalyzer/window7.sql
+++ b/tajo-core-tests/src/test/resources/queries/TestSQLAnalyzer/window7.sql
@@ -1,6 +1,6 @@
  SELECT
   dt,
   dt2,
-  row_number() over(partition by round(dt),dt2 order by ceil(dt) asc null last 
ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)
+  row_number() over(partition by round(dt),dt2 order by ceil(dt) asc nulls 
last ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)
 FROM
   sum_example;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/e84df9cc/tajo-core-tests/src/test/resources/queries/TestSQLAnalyzer/window8.sql
----------------------------------------------------------------------
diff --git 
a/tajo-core-tests/src/test/resources/queries/TestSQLAnalyzer/window8.sql 
b/tajo-core-tests/src/test/resources/queries/TestSQLAnalyzer/window8.sql
index 6f70690..f7f4f31 100644
--- a/tajo-core-tests/src/test/resources/queries/TestSQLAnalyzer/window8.sql
+++ b/tajo-core-tests/src/test/resources/queries/TestSQLAnalyzer/window8.sql
@@ -1,6 +1,6 @@
  SELECT
   dt,
   dt2,
-  row_number() over(partition by round(dt),dt2 order by ceil(dt) asc null last 
ROWS BETWEEN 1 PRECEDING AND CURRENT ROW)
+  row_number() over(partition by round(dt),dt2 order by ceil(dt) asc nulls 
last ROWS BETWEEN 1 PRECEDING AND CURRENT ROW)
 FROM
   sum_example;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/e84df9cc/tajo-core-tests/src/test/resources/queries/TestSQLAnalyzer/window9.sql
----------------------------------------------------------------------
diff --git 
a/tajo-core-tests/src/test/resources/queries/TestSQLAnalyzer/window9.sql 
b/tajo-core-tests/src/test/resources/queries/TestSQLAnalyzer/window9.sql
index b289ebf..8779262 100644
--- a/tajo-core-tests/src/test/resources/queries/TestSQLAnalyzer/window9.sql
+++ b/tajo-core-tests/src/test/resources/queries/TestSQLAnalyzer/window9.sql
@@ -6,4 +6,4 @@
 FROM
   sum_example
 WINDOW
-  window1 AS (partition by round(dt),dt2 order by ceil(dt) asc null last ROWS 
BETWEEN 1 PRECEDING AND CURRENT ROW);
\ No newline at end of file
+  window1 AS (partition by round(dt),dt2 order by ceil(dt) asc nulls last ROWS 
BETWEEN 1 PRECEDING AND CURRENT ROW);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/e84df9cc/tajo-docs/src/main/sphinx/sql_language/queries.rst
----------------------------------------------------------------------
diff --git a/tajo-docs/src/main/sphinx/sql_language/queries.rst 
b/tajo-docs/src/main/sphinx/sql_language/queries.rst
index 551e417..185c9cc 100644
--- a/tajo-docs/src/main/sphinx/sql_language/queries.rst
+++ b/tajo-docs/src/main/sphinx/sql_language/queries.rst
@@ -15,7 +15,7 @@ Overview
     [WHERE <condition>]
     [GROUP BY <expression> [, ...]]
     [HAVING <condition>]
-    [ORDER BY <expression> [ASC|DESC] [NULL FIRST|NULL LAST] [, ...]]
+    [ORDER BY <expression> [ASC|DESC] [NULLS (FIRST|LAST)] [, ...]]
 
 
 
@@ -189,7 +189,7 @@ Orderby and Limit Clauses
 
 .. code-block:: sql
 
-  FROM ... ORDER BY <sort_expr> [(ASC|DESC)] [NULL (FIRST|LAST) [,...]
+  FROM ... ORDER BY <sort_expr> [(ASC|DESC)] [NULLS (FIRST|LAST) [,...]
 
 ``sort_expr`` can be a column reference, aliased column reference, or a 
complex expression. 
 ``ASC`` indicates an ascending order of ``sort_expr`` values. ``DESC`` 
indicates a descending order of ``sort_expr`` values.

http://git-wip-us.apache.org/repos/asf/tajo/blob/e84df9cc/tajo-sql-parser/src/main/antlr4/org/apache/tajo/parser/sql/SQLLexer.g4
----------------------------------------------------------------------
diff --git 
a/tajo-sql-parser/src/main/antlr4/org/apache/tajo/parser/sql/SQLLexer.g4 
b/tajo-sql-parser/src/main/antlr4/org/apache/tajo/parser/sql/SQLLexer.g4
index ee61320..2bb3582 100644
--- a/tajo-sql-parser/src/main/antlr4/org/apache/tajo/parser/sql/SQLLexer.g4
+++ b/tajo-sql-parser/src/main/antlr4/org/apache/tajo/parser/sql/SQLLexer.g4
@@ -164,6 +164,7 @@ LIMIT : L I M I T;
 NATURAL : N A T U R A L;
 NOT : N O T;
 NULL : N U L L;
+NULLS : N U L L S;
 
 ON : O N;
 OR : O R;

http://git-wip-us.apache.org/repos/asf/tajo/blob/e84df9cc/tajo-sql-parser/src/main/antlr4/org/apache/tajo/parser/sql/SQLParser.g4
----------------------------------------------------------------------
diff --git 
a/tajo-sql-parser/src/main/antlr4/org/apache/tajo/parser/sql/SQLParser.g4 
b/tajo-sql-parser/src/main/antlr4/org/apache/tajo/parser/sql/SQLParser.g4
index f0de08a..1908258 100644
--- a/tajo-sql-parser/src/main/antlr4/org/apache/tajo/parser/sql/SQLParser.g4
+++ b/tajo-sql-parser/src/main/antlr4/org/apache/tajo/parser/sql/SQLParser.g4
@@ -1594,8 +1594,8 @@ limit_clause
   ;
 
 null_ordering
-  : NULL FIRST
-  | NULL LAST
+  : NULLS FIRST
+  | NULLS LAST
   ;
 
 /*

Reply via email to