diff --git a/core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java b/core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java index 0259a1f3fe..47886440d4 100644 --- a/core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java +++ b/core/src/main/java/com/alibaba/druid/sql/parser/SQLExprParser.java @@ -5178,15 +5178,17 @@ public SQLUnique parseUnique() { public void parseAssignItem(List outList, SQLObject parent) { accept(Token.LPAREN); - for (; ; ) { - SQLAssignItem item = this.parseAssignItem(true, parent); - item.setParent(parent); - outList.add(item); - if (lexer.token() == Token.COMMA) { - lexer.nextToken(); - continue; + if (lexer.token() != Token.RPAREN) { + for (; ; ) { + SQLAssignItem item = this.parseAssignItem(true, parent); + item.setParent(parent); + outList.add(item); + if (lexer.token() == Token.COMMA) { + lexer.nextToken(); + continue; + } + break; } - break; } accept(Token.RPAREN); } diff --git a/core/src/test/resources/bvt/parser/bigquery/0.txt b/core/src/test/resources/bvt/parser/bigquery/0.txt index 552b08cf82..cafa7d06b7 100644 --- a/core/src/test/resources/bvt/parser/bigquery/0.txt +++ b/core/src/test/resources/bvt/parser/bigquery/0.txt @@ -1,3 +1,62 @@ +create temporary function poly(polygon string) +returns string language js as """ +var res = JSON.parse(polygon); +var l = res.length; +var i; +for (i=0; i