Till Westmann has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/1936

Change subject: [ASTERIXDB-2028][SQL] No recursion for list creation
......................................................................

[ASTERIXDB-2028][SQL] No recursion for list creation

- user model changes: no more dangling comma for lists in SQL++
- storage format changes: no
- interface changes: no

details:
- change the production to create expression lists to avoid recursion
- report the class name of Errors (not just the message)

Change-Id: I86b65371bc007b57fd80542f6530db12dd936242
---
M 
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/unnest/left-outer-unnest-with-pos/left-outer-unnest-with-pos.1.query.sqlpp
M 
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/unnest/left-outer-unnest/left-outer-unnest.1.query.sqlpp
M asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
3 files changed, 14 insertions(+), 13 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/36/1936/1

diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/unnest/left-outer-unnest-with-pos/left-outer-unnest-with-pos.1.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/unnest/left-outer-unnest-with-pos/left-outer-unnest-with-pos.1.query.sqlpp
index 7b8651b..c736e24 100644
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/unnest/left-outer-unnest-with-pos/left-outer-unnest-with-pos.1.query.sqlpp
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/unnest/left-outer-unnest-with-pos/left-outer-unnest-with-pos.1.query.sqlpp
@@ -23,7 +23,7 @@
  {'id': 1, 'list': [2, 3]},
  {'id': 4, 'list': [] },
  {'id': 5, 'list': [6, 7]},
- {'id': 8, 'list': []},
+ {'id': 8, 'list': []}
 ] AS a
 LEFT OUTER UNNEST a.list AS item AT i
 ORDER BY a.id
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/unnest/left-outer-unnest/left-outer-unnest.1.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/unnest/left-outer-unnest/left-outer-unnest.1.query.sqlpp
index 502d073..e7b6882 100644
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/unnest/left-outer-unnest/left-outer-unnest.1.query.sqlpp
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/unnest/left-outer-unnest/left-outer-unnest.1.query.sqlpp
@@ -23,7 +23,7 @@
  {'id': 1, 'list': [2, 3]},
  {'id': 4, 'list': [] },
  {'id': 5, 'list': [6, 7]},
- {'id': 8, 'list': []},
+ {'id': 8, 'list': []}
 ] AS a
 LEFT OUTER UNNEST a.list AS item
 ORDER BY a.id
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj 
b/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
index bcba939..4c1d174 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
+++ b/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
@@ -291,7 +291,8 @@
         } catch (Error e) {
             // this is here as the JavaCharStream that's below the lexer 
somtimes throws Errors that are not handled
             // by the ANTLR-generated lexer or parser (e.g it does this for 
invalid backslash u + 4 hex digits escapes)
-            throw new CompilationException(new ParseException(e.getMessage()));
+            final String msg = e.getClass().getSimpleName() + (e.getMessage() 
!= null ? ": " + e.getMessage() : "");
+            throw new CompilationException(new ParseException(msg));
         } catch (ParseException e) {
             throw new CompilationException("Syntax error: " + getMessage(e));
         }
@@ -2424,19 +2425,19 @@
 }
 {
     (
-      expr = Expression() { exprList.add(expr); }
-      (LOOKAHEAD(1) <COMMA> list = ExpressionList() { exprList.addAll(list); 
})?
+      expr = Expression()
+      {
+        exprList.add(expr);
+      }
+      ( <COMMA> expr = Expression()
+        {
+          exprList.add(expr);
+        }
+      )*
     )?
-    (LOOKAHEAD(1) Comma())?
     {
-        return exprList;
+      return exprList;
     }
-}
-
-void Comma():
-{}
-{
-   <COMMA>
 }
 
 RecordConstructor RecordConstructor() throws ParseException:

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1936
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I86b65371bc007b57fd80542f6530db12dd936242
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Till Westmann <ti...@apache.org>

Reply via email to