bug fixed for refactor

This commit is contained in:
温少
2012-05-20 15:37:29 +08:00
15 changed files with 67 additions and 33 deletions
@@ -24,7 +24,7 @@ public class HiveCreateTableParser extends SQLCreateTableParser {
public SQLCreateTableStatement parseCrateTable(boolean acceptCreate) {
HiveCreateTableStatement stmt = (HiveCreateTableStatement) super.parseCrateTable(acceptCreate);
if (lexer.token() == Token.PARTITIONED) {
if (identifierEquals("PARTITIONED")) {
lexer.nextToken();
accept(Token.BY);
accept(Token.LPAREN);
@@ -0,0 +1,17 @@
package com.alibaba.druid.sql.dialect.hive.parser;
import com.alibaba.druid.sql.parser.Lexer;
import com.alibaba.druid.sql.parser.ParserException;
import com.alibaba.druid.sql.parser.SQLExprParser;
public class HiveExprParser extends SQLExprParser {
public HiveExprParser(String sql) throws ParserException{
super(new HiveLexer(sql));
this.lexer.nextToken();
}
public HiveExprParser(Lexer lexer){
super(lexer);
}
}
@@ -83,9 +83,6 @@ public class HiveLexer extends Lexer {
map.put("ANY", Token.ANY);
map.put("WITH", Token.WITH);
map.put("PARTITIONED", Token.PARTITIONED);
map.put("SHOW", Token.SHOW);
map.put("TABLES", Token.TABLES);
DEFAULT_SQL_SERVER_KEYWORDS = new Keywords(map);
}
@@ -25,10 +25,10 @@ public class HiveStatementParser extends SQLStatementParser {
}
public boolean parseStatementListDialect(List<SQLStatement> statementList) {
if (lexer.token() == Token.SHOW) {
if (identifierEquals("SHOW")) {
lexer.nextToken();
if (lexer.token() == Token.TABLES) {
if (identifierEquals("TABLES")) {
lexer.nextToken();
HiveShowTablesStatement stmt = new HiveShowTablesStatement();
@@ -41,7 +41,7 @@ public class HiveStatementParser extends SQLStatementParser {
return true;
}
throw new ParserException("TODO " + lexer.token());
throw new ParserException("TODO " + lexer.info());
}
return false;
}
@@ -11,7 +11,8 @@ import com.alibaba.druid.sql.parser.Token;
public class PGExprParser extends SQLExprParser{
public PGExprParser(String sql) throws ParserException{
super(sql);
super(new PGLexer(sql));
this.lexer.nextToken();
}
public PGExprParser(Lexer lexer){