Merge pull request #4096 from bytesmithing/master

fix typo:
This commit is contained in:
温绍锦
2021-02-18 10:39:35 +08:00
committed by GitHub
16 changed files with 54 additions and 54 deletions
@@ -34,12 +34,12 @@ public class AdsLexer extends Lexer {
public AdsLexer(String input) {
super(input);
dbType = DbType.ads;
super.keywods = DEFAULT_ADS_KEYWORDS;
super.keywords = DEFAULT_ADS_KEYWORDS;
}
public AdsLexer(String input, SQLParserFeature... features){
super(input);
super.keywods = DEFAULT_ADS_KEYWORDS;
super.keywords = DEFAULT_ADS_KEYWORDS;
for (SQLParserFeature feature : features) {
config(feature, true);
}
@@ -49,7 +49,7 @@ public class AntsparkLexer extends Lexer {
public AntsparkLexer(String input) {
super(input);
dbType= DbType.antspark;
super.keywods = DEFAULT_ANTSPARK_KEYWORDS;
super.keywords = DEFAULT_ANTSPARK_KEYWORDS;
}
}
@@ -33,13 +33,13 @@ public class BlinkLexer extends Lexer {
public BlinkLexer(String input){
super(input);
super.keywods = DEFAULT_BLINK_KEYWORDS;
super.keywords = DEFAULT_BLINK_KEYWORDS;
dbType = DbType.blink;
}
public BlinkLexer(String input, SQLParserFeature... features){
super(input);
super.keywods = DEFAULT_BLINK_KEYWORDS;
super.keywords = DEFAULT_BLINK_KEYWORDS;
dbType = DbType.blink;
for (SQLParserFeature feature : features) {
config(feature, true);
@@ -35,12 +35,12 @@ public class ClickhouseLexer extends Lexer {
public ClickhouseLexer(String input) {
super(input);
dbType = DbType.clickhouse;
super.keywods = DEFAULT_KEYWORDS;
super.keywords = DEFAULT_KEYWORDS;
}
public ClickhouseLexer(String input, SQLParserFeature... features){
super(input);
super.keywods = DEFAULT_KEYWORDS;
super.keywords = DEFAULT_KEYWORDS;
for (SQLParserFeature feature : features) {
config(feature, true);
}
@@ -50,12 +50,12 @@ public class DB2Lexer extends Lexer {
public DB2Lexer(String input){
super(input);
super.keywods = DEFAULT_DB2_KEYWORDS;
super.keywords = DEFAULT_DB2_KEYWORDS;
}
public DB2Lexer(String input, SQLParserFeature... features){
super(input);
super.keywods = DEFAULT_DB2_KEYWORDS;
super.keywords = DEFAULT_DB2_KEYWORDS;
for (SQLParserFeature feature : features) {
config(feature, true);
}
@@ -47,12 +47,12 @@ public class H2Lexer extends Lexer {
public H2Lexer(String input){
super(input, null, DbType.h2);
super.keywods = DEFAULT_H2_KEYWORDS;
super.keywords = DEFAULT_H2_KEYWORDS;
}
public H2Lexer(String input, SQLParserFeature... features){
super(input, null, DbType.h2);
super.keywods = DEFAULT_H2_KEYWORDS;
super.keywords = DEFAULT_H2_KEYWORDS;
for (SQLParserFeature feature : features) {
config(feature, true);
}
@@ -60,7 +60,7 @@ public class HiveLexer extends Lexer {
this.keepComments = true;
dbType = DbType.hive;
this.features |= SQLParserFeature.SupportUnicodeCodePoint.mask;
super.keywods = DEFAULT_HIVE_KEYWORDS;
super.keywords = DEFAULT_HIVE_KEYWORDS;
}
public HiveLexer(String input, SQLParserFeature... features){
@@ -68,7 +68,7 @@ public class HiveLexer extends Lexer {
dbType = DbType.hive;
this.skipComment = true;
this.keepComments = true;
super.keywods = DEFAULT_HIVE_KEYWORDS;
super.keywords = DEFAULT_HIVE_KEYWORDS;
this.features |= SQLParserFeature.SupportUnicodeCodePoint.mask;
for (SQLParserFeature feature : features) {
config(feature, true);
@@ -75,7 +75,7 @@ public class MySqlLexer extends Lexer {
public MySqlLexer(char[] input, int inputLength, boolean skipComment){
super(input, inputLength, skipComment);
super.keywods = DEFAULT_MYSQL_KEYWORDS;
super.keywords = DEFAULT_MYSQL_KEYWORDS;
}
public MySqlLexer(String input){
@@ -85,7 +85,7 @@ public class MySqlLexer extends Lexer {
public MySqlLexer(String input, SQLParserFeature... features){
super(input, true);
this.keepComments = true;
super.keywods = DEFAULT_MYSQL_KEYWORDS;
super.keywords = DEFAULT_MYSQL_KEYWORDS;
for (SQLParserFeature feature : features) {
config(feature, true);
@@ -96,7 +96,7 @@ public class MySqlLexer extends Lexer {
super(input, skipComment);
this.skipComment = skipComment;
this.keepComments = keepComments;
super.keywods = DEFAULT_MYSQL_KEYWORDS;
super.keywords = DEFAULT_MYSQL_KEYWORDS;
}
public void scanSharp() {
@@ -443,7 +443,7 @@ public class MySqlLexer extends Lexer {
return;
}
Token tok = keywods.getKeyword(hash_lower);
Token tok = keywords.getKeyword(hash_lower);
if (tok != null) {
token = tok;
if (token == Token.IDENTIFIER) {
@@ -55,7 +55,7 @@ public class OdpsLexer extends Lexer {
public OdpsLexer(String input, SQLParserFeature... features){
super(input);
dbType = DbType.odps;
super.keywods = DEFAULT_ODPS_KEYWORDS;
super.keywords = DEFAULT_ODPS_KEYWORDS;
this.skipComment = true;
this.keepComments = false;
@@ -69,13 +69,13 @@ public class OdpsLexer extends Lexer {
dbType = DbType.odps;
this.skipComment = skipComment;
this.keepComments = keepComments;
super.keywods = DEFAULT_ODPS_KEYWORDS;
super.keywords = DEFAULT_ODPS_KEYWORDS;
}
public OdpsLexer(String input, CommentHandler commentHandler){
super(input, commentHandler);
dbType = DbType.odps;
super.keywods = DEFAULT_ODPS_KEYWORDS;
super.keywords = DEFAULT_ODPS_KEYWORDS;
}
public void scanComment() {
@@ -167,7 +167,7 @@ public class OdpsLexer extends Lexer {
this.ch = charAt(pos);
stringVal = addSymbol();
Token tok = keywods.getKeyword(stringVal);
Token tok = keywords.getKeyword(stringVal);
if (tok != null) {
token = tok;
} else {
@@ -120,21 +120,21 @@ public class OracleLexer extends Lexer {
public OracleLexer(char[] input, int inputLength, boolean skipComment){
super(input, inputLength, skipComment);
super.keywods = DEFAULT_ORACLE_KEYWORDS;
super.keywords = DEFAULT_ORACLE_KEYWORDS;
}
public OracleLexer(String input){
super(input);
this.skipComment = true;
this.keepComments = true;
super.keywods = DEFAULT_ORACLE_KEYWORDS;
super.keywords = DEFAULT_ORACLE_KEYWORDS;
}
public OracleLexer(String input, SQLParserFeature... features){
super(input);
this.skipComment = true;
this.keepComments = true;
super.keywods = DEFAULT_ORACLE_KEYWORDS;
super.keywords = DEFAULT_ORACLE_KEYWORDS;
for (SQLParserFeature feature : features) {
config(feature, true);
@@ -212,7 +212,7 @@ public class OracleLexer extends Lexer {
this.ch = charAt(pos);
stringVal = addSymbol();
Token tok = keywods.getKeyword(stringVal);
Token tok = keywords.getKeyword(stringVal);
if (tok != null) {
token = tok;
} else {
@@ -52,7 +52,7 @@ public class PhoenixLexer extends Lexer {
public PhoenixLexer(String input, SQLParserFeature... features){
super(input);
super.keywods = DEFAULT_PHOENIX_KEYWORDS;
super.keywords = DEFAULT_PHOENIX_KEYWORDS;
for (SQLParserFeature feature : features) {
config(feature, true);
}
@@ -78,7 +78,7 @@ public class PGLexer extends Lexer {
public PGLexer(String input, SQLParserFeature... features){
super(input, true);
this.keepComments = true;
super.keywods = DEFAULT_PG_KEYWORDS;
super.keywords = DEFAULT_PG_KEYWORDS;
super.dbType = DbType.postgresql;
for (SQLParserFeature feature : features) {
config(feature, true);
@@ -39,7 +39,7 @@ public class PrestoLexer extends Lexer {
public PrestoLexer(String input, SQLParserFeature... features){
super(input);
super.keywods = DEFAULT_PHOENIX_KEYWORDS;
super.keywords = DEFAULT_PHOENIX_KEYWORDS;
for (SQLParserFeature feature : features) {
config(feature, true);
}
@@ -53,17 +53,17 @@ public class SQLServerLexer extends Lexer {
public SQLServerLexer(char[] input, int inputLength, boolean skipComment){
super(input, inputLength, skipComment);
super.keywods = DEFAULT_SQL_SERVER_KEYWORDS;
super.keywords = DEFAULT_SQL_SERVER_KEYWORDS;
}
public SQLServerLexer(String input){
super(input);
super.keywods = DEFAULT_SQL_SERVER_KEYWORDS;
super.keywords = DEFAULT_SQL_SERVER_KEYWORDS;
}
public SQLServerLexer(String input, SQLParserFeature... features){
super(input);
super.keywods = DEFAULT_SQL_SERVER_KEYWORDS;
super.keywords = DEFAULT_SQL_SERVER_KEYWORDS;
for (SQLParserFeature feature : features) {
config(feature, true);
}
@@ -82,7 +82,7 @@ public class Lexer {
protected Token token;
protected Keywords keywods = Keywords.DEFAULT_KEYWORDS;
protected Keywords keywords = Keywords.DEFAULT_KEYWORDS;
protected String stringVal;
protected long hash_lower; // fnv1a_64
@@ -106,7 +106,7 @@ public class Lexer {
protected DbType dbType;
protected boolean optimizedForParameterized = false;
protected boolean keepSourceLocaltion = false;
protected boolean keepSourceLocation = false;
protected int startPos;
protected int posLine;
@@ -131,9 +131,9 @@ public class Lexer {
this.dbType = dbType;
if (DbType.sqlite == dbType) {
this.keywods = Keywords.SQLITE_KEYWORDS;
this.keywords = Keywords.SQLITE_KEYWORDS;
} else if (DbType.dm == dbType) {
this.keywods = Keywords.DM_KEYWORDS;
this.keywords = Keywords.DM_KEYWORDS;
}
}
@@ -214,8 +214,8 @@ public class Lexer {
String stringVal;
}
public Keywords getKeywods() {
return keywods;
public Keywords getKeywords() {
return keywords;
}
public SavePoint mark() {
@@ -2337,7 +2337,7 @@ public class Lexer {
return;
}
Token tok = keywods.getKeyword(hash_lower);
Token tok = keywords.getKeyword(hash_lower);
if (tok != null) {
token = tok;
if (token == Token.IDENTIFIER) {
@@ -2858,7 +2858,7 @@ public class Lexer {
} else if (feature == KeepComments) {
this.keepComments = state;
} else if (feature == KeepSourceLocation) {
this.keepSourceLocaltion = state;
this.keepSourceLocation = state;
} else if (feature == SkipComments) {
this.skipComment = state;
}
@@ -365,7 +365,7 @@ public class SQLExprParser extends SQLParser {
long hash_lower = lexer.hash_lower();
int sourceLine = -1, sourceColumn = -1;
if (lexer.keepSourceLocaltion) {
if (lexer.keepSourceLocation) {
lexer.computeRowAndColumn();
sourceLine = lexer.posLine;
sourceColumn = lexer.posColumn;
@@ -1557,20 +1557,20 @@ public class SQLExprParser extends SQLParser {
if (distinct) {
aggMethodName = methodName;
} else {
aggMethodName = getAggreateFunction(hash_lower);
aggMethodName = getAggregateFunction(hash_lower);
}
} else if (expr instanceof SQLPropertyExpr) {
methodName = ((SQLPropertyExpr) expr).getSimpleName();
aggMethodName = SQLUtils.normalize(methodName);
hash_lower = FnvHash.fnv1a_64_lower(aggMethodName);
aggMethodName = getAggreateFunction(hash_lower);
aggMethodName = getAggregateFunction(hash_lower);
owner = ((SQLPropertyExpr) expr).getOwner();
} else if (expr instanceof SQLDefaultExpr) {
methodName = "DEFAULT";
} else if (expr instanceof SQLCharExpr) {
methodName = ((SQLCharExpr) expr).getText();
if (isAggreateFunction(methodName)) {
if (isAggregateFunction(methodName)) {
aggMethodName = methodName;
}
} else if (expr instanceof SQLDbLinkExpr) {
@@ -1749,7 +1749,7 @@ public class SQLExprParser extends SQLParser {
|| lexer.token == Token.LITERAL_ALIAS) {
name = lexer.stringVal();
lexer.nextToken();
} else if (lexer.getKeywods().containsValue(lexer.token)) {
} else if (lexer.getKeywords().containsValue(lexer.token)) {
name = lexer.stringVal();
lexer.nextToken();
} else if (lexer.token == Token.VARIANT && lexer.stringVal().startsWith("$")) {
@@ -2062,7 +2062,7 @@ public class SQLExprParser extends SQLParser {
}
SQLIdentifierExpr identifierExpr = new SQLIdentifierExpr(identName, hash);
if (lexer.keepSourceLocaltion) {
if (lexer.keepSourceLocation) {
lexer.computeRowAndColumn();
identifierExpr.setSourceLine(lexer.posLine);
identifierExpr.setSourceColumn(lexer.posColumn);
@@ -2086,7 +2086,7 @@ public class SQLExprParser extends SQLParser {
}
if (lexer.token != Token.LITERAL_ALIAS && lexer.token != Token.IDENTIFIER
&& (!lexer.getKeywods().containsValue(lexer.token))) {
&& (!lexer.getKeywords().containsValue(lexer.token))) {
throw new ParserException("error, " + lexer.info());
}
@@ -2103,16 +2103,16 @@ public class SQLExprParser extends SQLParser {
return name;
}
public boolean isAggreateFunction(String word) {
public boolean isAggregateFunction(String word) {
long hash_lower = FnvHash.fnv1a_64_lower(word);
return isAggreateFunction(hash_lower);
return isAggregateFunction(hash_lower);
}
protected boolean isAggreateFunction(long hash_lower) {
protected boolean isAggregateFunction(long hash_lower) {
return Arrays.binarySearch(aggregateFunctionHashCodes, hash_lower) >= 0;
}
protected String getAggreateFunction(long hash_lower) {
protected String getAggregateFunction(long hash_lower) {
int index = Arrays.binarySearch(aggregateFunctionHashCodes, hash_lower);
if (index < 0) {
return null;
@@ -5139,9 +5139,9 @@ public class SQLExprParser extends SQLParser {
if (strVal.startsWith("--")) {
strVal = strVal.substring(2);
}
SQLIntegerExpr intergerExpr = SQLIntegerExpr.ofIntOrLong(Long.parseLong(strVal));
intergerExpr.setType("INTEGER");
expr = intergerExpr;
SQLIntegerExpr integerExpr = SQLIntegerExpr.ofIntOrLong(Long.parseLong(strVal));
integerExpr.setType("INTEGER");
expr = integerExpr;
lexer.nextToken();
} else if (hash_lower == FnvHash.Constants.SMALLINT
&& lexer.token == Token.LITERAL_CHARS) {
@@ -5384,7 +5384,7 @@ public class SQLExprParser extends SQLParser {
hash_lower = FnvHash.hashCode64(ident);
}
SQLIdentifierExpr identifierExpr = new SQLIdentifierExpr(ident, hash_lower);
if (lexer.keepSourceLocaltion) {
if (lexer.keepSourceLocation) {
lexer.computeRowAndColumn();
identifierExpr.setSourceLine(lexer.posLine);
identifierExpr.setSourceColumn(lexer.posColumn);