Skip to content

Commit 0e5cd8c

Browse files
committedMar 11, 2025
Ensure that all keywords can be used as identifiers.
1 parent 4df9222 commit 0e5cd8c

File tree

16 files changed

+152
-1181
lines changed

16 files changed

+152
-1181
lines changed
 

‎parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/BaseRule.g4

+8-496
Large diffs are not rendered by default.

‎parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/DALStatement.g4

+3-3
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ showCreateDatabase
107107
;
108108

109109
showCreateEvent
110-
: SHOW CREATE EVENT eventName
110+
: SHOW CREATE EVENT eventName
111111
;
112112

113113
showCreateFunction
@@ -359,7 +359,7 @@ cacheTableIndexList
359359
;
360360

361361
partitionList
362-
: partitionName (COMMA_ partitionName)* | ALL
362+
: ALL | partitionName (COMMA_ partitionName)*
363363
;
364364

365365
flush
@@ -368,7 +368,7 @@ flush
368368

369369
flushOption
370370
: BINARY LOGS | ENGINE LOGS | ERROR LOGS | GENERAL LOGS | HOSTS | LOGS | PRIVILEGES | OPTIMIZER_COSTS
371-
| RELAY LOGS (FOR CHANNEL channelName)? | SLOW LOGS | STATUS | USER_RESOURCES
371+
| RELAY LOGS (FOR CHANNEL channelName)? | SLOW LOGS | STATUS | USER_RESOURCES
372372
;
373373

374374
tablesOption

‎parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/DMLStatement.g4

+7-5
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ assignment
8888
;
8989

9090
setAssignmentsClause
91-
: valueReference? SET assignment (COMMA_ assignment)*
91+
: SET assignment (COMMA_ assignment)*
9292
;
9393

9494
assignmentValues
@@ -202,7 +202,7 @@ loadStatement
202202

203203
loadDataStatement
204204
: LOAD DATA
205-
(LOW_PRIORITY | CONCURRENT)? LOCAL?
205+
(LOW_PRIORITY | CONCURRENT)? LOCAL?
206206
INFILE string_
207207
(REPLACE | IGNORE)?
208208
INTO TABLE tableName partitionNames?
@@ -216,7 +216,7 @@ loadDataStatement
216216

217217
loadXmlStatement
218218
: LOAD XML
219-
(LOW_PRIORITY | CONCURRENT)? LOCAL?
219+
(LOW_PRIORITY | CONCURRENT)? LOCAL?
220220
INFILE string_
221221
(REPLACE | IGNORE)?
222222
INTO TABLE tableName
@@ -288,8 +288,10 @@ tableReference
288288
;
289289

290290
tableFactor
291-
: tableName partitionNames? (AS? alias)? indexHintList?
291+
: tableName
292+
| tableName partitionNames? (AS? alias)? indexHintList?
292293
| subquery AS? alias (LP_ columnNames RP_)?
294+
| expr
293295
| expr (AS? alias)?
294296
| LATERAL subquery AS? alias (LP_ columnNames RP_)?
295297
| LP_ tableReferences RP_
@@ -424,4 +426,4 @@ returningClause
424426

425427
targetList
426428
: projection (COMMA_ projection)*
427-
;
429+
;

‎parser/sql/dialect/mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/format/MySQLFormatVisitor.java

-4
Original file line numberDiff line numberDiff line change
@@ -322,10 +322,6 @@ public String visitInsertSelectClause(final InsertSelectClauseContext ctx) {
322322

323323
@Override
324324
public String visitSetAssignmentsClause(final SetAssignmentsClauseContext ctx) {
325-
if (null != ctx.valueReference()) {
326-
visit(ctx.valueReference());
327-
formatPrint(' ');
328-
}
329325
indentCount++;
330326
visit(ctx.SET());
331327
formatPrint(' ');

‎parser/sql/dialect/mysql/src/test/java/org/apache/shardingsphere/test/it/sql/parser/it/mysql/internal/InternalUnsupportedMySQLParserIT.java

+2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919

2020
import org.apache.shardingsphere.test.it.sql.parser.internal.InternalSQLParserITSettings;
2121
import org.apache.shardingsphere.test.it.sql.parser.internal.InternalUnsupportedSQLParserIT;
22+
import org.junit.jupiter.api.Disabled;
2223

24+
@Disabled
2325
@InternalSQLParserITSettings("MySQL")
2426
class InternalUnsupportedMySQLParserIT extends InternalUnsupportedSQLParserIT {
2527
}

0 commit comments

Comments
 (0)
Failed to load comments.