Repository: asterixdb Updated Branches: refs/heads/master f0620c132 -> 60f89981d
[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 Reviewed-on: https://asterix-gerrit.ics.uci.edu/1936 Sonar-Qube: Jenkins <[email protected]> Integration-Tests: Jenkins <[email protected]> Tested-by: Jenkins <[email protected]> Contrib: Jenkins <[email protected]> Reviewed-by: Yingyi Bu <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/60f89981 Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/60f89981 Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/60f89981 Branch: refs/heads/master Commit: 60f89981d2d9961b3ebc265606d00a95b3d58fc2 Parents: f0620c1 Author: Till Westmann <[email protected]> Authored: Fri Aug 11 18:14:20 2017 -0700 Committer: Till Westmann <[email protected]> Committed: Sun Aug 13 21:53:36 2017 -0700 ---------------------------------------------------------------------- .../left-outer-unnest-with-pos.1.query.sqlpp | 2 +- .../left-outer-unnest.1.query.sqlpp | 2 +- .../asterix-lang-sqlpp/src/main/javacc/SQLPP.jj | 23 ++++++++++---------- 3 files changed, 14 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/asterixdb/blob/60f89981/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/unnest/left-outer-unnest-with-pos/left-outer-unnest-with-pos.1.query.sqlpp ---------------------------------------------------------------------- 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 @@ FROM {'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 http://git-wip-us.apache.org/repos/asf/asterixdb/blob/60f89981/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/unnest/left-outer-unnest/left-outer-unnest.1.query.sqlpp ---------------------------------------------------------------------- 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 @@ FROM {'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 http://git-wip-us.apache.org/repos/asf/asterixdb/blob/60f89981/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj ---------------------------------------------------------------------- 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 @@ class SQLPPParser extends ScopeChecker implements IParser { } 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,21 +2425,21 @@ List<Expression> ExpressionList() throws ParseException: } { ( - 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: { RecordConstructor expr = new RecordConstructor();
