-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
295 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 0 additions & 12 deletions
12
core/src/main/java/com/alibaba/druid/sql/dialect/athena/parser/AthenaSelectParser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 1 addition & 14 deletions
15
core/src/main/java/com/alibaba/druid/sql/dialect/athena/parser/AthenaStatementParser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
core/src/main/java/com/alibaba/druid/sql/dialect/supersql/ast/SuperSqlObject.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.alibaba.druid.sql.dialect.supersql.ast; | ||
|
||
import com.alibaba.druid.sql.ast.SQLObject; | ||
import com.alibaba.druid.sql.dialect.supersql.visitor.SuperSqlASTVisitor; | ||
import com.alibaba.druid.sql.visitor.SQLASTVisitor; | ||
|
||
public interface SuperSqlObject extends SQLObject { | ||
void accept0(SuperSqlASTVisitor visitor); | ||
|
||
@Override | ||
default void accept(SQLASTVisitor visitor) { | ||
if (visitor instanceof SuperSqlASTVisitor) { | ||
accept0((SuperSqlASTVisitor) visitor); | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...rc/main/java/com/alibaba/druid/sql/dialect/supersql/parser/SuperSqlCreateTableParser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.alibaba.druid.sql.dialect.supersql.parser; | ||
|
||
import com.alibaba.druid.sql.ast.statement.SQLCreateTableStatement; | ||
import com.alibaba.druid.sql.dialect.presto.parser.PrestoCreateTableParser; | ||
import com.alibaba.druid.sql.parser.SQLExprParser; | ||
import com.alibaba.druid.util.FnvHash; | ||
|
||
public class SuperSqlCreateTableParser extends PrestoCreateTableParser { | ||
public SuperSqlCreateTableParser(SQLExprParser exprParser) { | ||
super(exprParser); | ||
} | ||
|
||
@Override | ||
protected void createTableBefore(SQLCreateTableStatement stmt) { | ||
acceptIdentifier(FnvHash.Constants.EXTERNAL); | ||
stmt.setExternal(true); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
core/src/main/java/com/alibaba/druid/sql/dialect/supersql/parser/SuperSqlExprParser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.alibaba.druid.sql.dialect.supersql.parser; | ||
|
||
import com.alibaba.druid.DbType; | ||
import com.alibaba.druid.sql.dialect.presto.parser.PrestoExprParser; | ||
import com.alibaba.druid.sql.parser.Lexer; | ||
import com.alibaba.druid.sql.parser.SQLParserFeature; | ||
|
||
public class SuperSqlExprParser extends PrestoExprParser { | ||
public SuperSqlExprParser(String sql, SQLParserFeature... features) { | ||
this(new SuperSqlLexer(sql, features)); | ||
this.lexer.nextToken(); | ||
} | ||
|
||
public SuperSqlExprParser(Lexer lexer) { | ||
super(lexer, DbType.supersql); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
core/src/main/java/com/alibaba/druid/sql/dialect/supersql/parser/SuperSqlLexer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.alibaba.druid.sql.dialect.supersql.parser; | ||
|
||
import com.alibaba.druid.DbType; | ||
import com.alibaba.druid.sql.dialect.presto.parser.PrestoLexer; | ||
import com.alibaba.druid.sql.parser.Keywords; | ||
import com.alibaba.druid.sql.parser.SQLParserFeature; | ||
import com.alibaba.druid.sql.parser.Token; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class SuperSqlLexer extends PrestoLexer { | ||
@Override | ||
protected Keywords loadKeywords() { | ||
Map<String, Token> map = new HashMap<String, Token>(); | ||
map.putAll(Keywords.DEFAULT_KEYWORDS.getKeywords()); | ||
map.put("FETCH", Token.FETCH); | ||
map.put("FIRST", Token.FIRST); | ||
map.put("ONLY", Token.ONLY); | ||
map.put("OPTIMIZE", Token.OPTIMIZE); | ||
map.put("OF", Token.OF); | ||
map.put("CONCAT", Token.CONCAT); | ||
map.put("CONTINUE", Token.CONTINUE); | ||
map.put("IDENTITY", Token.IDENTITY); | ||
map.put("MERGE", Token.MERGE); | ||
map.put("USING", Token.USING); | ||
map.put("MATCHED", Token.MATCHED); | ||
map.put("UPSERT", Token.UPSERT); | ||
map.put("IF", Token.IF); | ||
map.put("OVERWRITE", Token.OVERWRITE); | ||
map.put("PARTITION", Token.PARTITION); | ||
|
||
return new Keywords(map); | ||
} | ||
public SuperSqlLexer(String input, SQLParserFeature... features) { | ||
super(input, features); | ||
this.dbType = DbType.supersql; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
core/src/main/java/com/alibaba/druid/sql/dialect/supersql/parser/SuperSqlSelectParser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.alibaba.druid.sql.dialect.supersql.parser; | ||
|
||
import com.alibaba.druid.sql.dialect.presto.parser.PrestoSelectParser; | ||
import com.alibaba.druid.sql.parser.SQLExprParser; | ||
import com.alibaba.druid.sql.parser.SQLSelectListCache; | ||
|
||
public class SuperSqlSelectParser extends PrestoSelectParser { | ||
public SuperSqlSelectParser(SQLExprParser exprParser, SQLSelectListCache selectListCache) { | ||
super(exprParser, selectListCache); | ||
} | ||
|
||
@Override | ||
protected SQLExprParser createExprParser() { | ||
return new SuperSqlExprParser(this.lexer); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
.../src/main/java/com/alibaba/druid/sql/dialect/supersql/parser/SuperSqlStatementParser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.alibaba.druid.sql.dialect.supersql.parser; | ||
|
||
import com.alibaba.druid.sql.dialect.presto.parser.PrestoStatementParser; | ||
import com.alibaba.druid.sql.parser.SQLCreateTableParser; | ||
import com.alibaba.druid.sql.parser.SQLParserFeature; | ||
|
||
public class SuperSqlStatementParser extends PrestoStatementParser { | ||
public SuperSqlStatementParser(String sql, SQLParserFeature... features) { | ||
super(new SuperSqlExprParser(sql, features)); | ||
} | ||
|
||
@Override | ||
public SuperSqlSelectParser createSQLSelectParser() { | ||
return new SuperSqlSelectParser(this.exprParser, selectListCache); | ||
} | ||
|
||
@Override | ||
public SQLCreateTableParser getSQLCreateTableParser() { | ||
return new SuperSqlCreateTableParser(this.exprParser); | ||
} | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
core/src/main/java/com/alibaba/druid/sql/dialect/supersql/visitor/SuperSqlASTVisitor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.alibaba.druid.sql.dialect.supersql.visitor; | ||
|
||
import com.alibaba.druid.sql.dialect.presto.visitor.PrestoASTVisitor; | ||
|
||
public interface SuperSqlASTVisitor extends PrestoASTVisitor { | ||
} |
14 changes: 14 additions & 0 deletions
14
core/src/main/java/com/alibaba/druid/sql/dialect/supersql/visitor/SuperSqlOutputVisitor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.alibaba.druid.sql.dialect.supersql.visitor; | ||
|
||
import com.alibaba.druid.DbType; | ||
import com.alibaba.druid.sql.dialect.presto.visitor.PrestoOutputVisitor; | ||
|
||
public class SuperSqlOutputVisitor extends PrestoOutputVisitor implements SuperSqlASTVisitor { | ||
public SuperSqlOutputVisitor(StringBuilder appender) { | ||
super(appender, DbType.supersql); | ||
} | ||
|
||
public SuperSqlOutputVisitor(StringBuilder appender, boolean parameterized) { | ||
super(appender, DbType.supersql, parameterized); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.