improved odps sql parser.

This commit is contained in:
wenshao
2017-07-17 14:54:08 +08:00
parent d4480d4f3c
commit 5032b3e21a
7 changed files with 335 additions and 2 deletions
@@ -224,6 +224,14 @@ public class OdpsLexer extends Lexer {
ch = charAt(++pos);
if (!isIdentifierChar(ch)) {
if (ch == '{' && charAt(pos - 1) == '$') {
int endIndex = this.text.indexOf('}', pos);
if (endIndex != -1) {
bufPos += (endIndex - pos + 1);
pos = endIndex;
continue;
}
}
break;
}
@@ -350,7 +358,7 @@ public class OdpsLexer extends Lexer {
super.scanVariable();
}
protected final void scanString() {
scanString2();
}
@@ -141,8 +141,13 @@ public class OdpsStatementParser extends SQLStatementParser {
}
if (identifierEquals("READ")) {
lexer.nextToken();
OdpsReadStatement stmt = new OdpsReadStatement();
if (lexer.hasComment() && lexer.isKeepComments()) {
stmt.addBeforeComment(lexer.readAndResetComments());
}
lexer.nextToken();
stmt.setTable(this.exprParser.name());
if (lexer.token() == Token.LPAREN) {