Skip to content

Commit ee3c549

Browse files
authored
check spelling errors for all sql g4 (#396)
* feat(flink): check spelling errors for flink g4 * feat(hive): check spelling errors for hive g4 * feat(mysql): check spelling errors for mysql g4 * feat(impala): check spelling errors for impala g4 * feat(spark): check spelling errors for spark g4 * feat(trino): check spelling errors for trino sql * feat(postgre): check seplling errors for postgre g4 * feat(postgre): changed to camelCase for postgreSQL
1 parent 52b9a5a commit ee3c549

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+28232
-29064
lines changed

src/grammar/flink/FlinkSqlLexer.g4

+3-3
Original file line numberDiff line numberDiff line change
@@ -571,11 +571,11 @@ REVERSE_QUOTE_SYMB : '`';
571571
COLON_SYMB : ':';
572572
ASTERISK_SIGN : '*';
573573
UNDERLINE_SIGN : '_';
574-
HYPNEN_SIGN : '-';
574+
HYPHEN_SIGN : '-';
575575
ADD_SIGN : '+';
576-
PENCENT_SIGN : '%';
576+
PERCENT_SIGN : '%';
577577
DOUBLE_VERTICAL_SIGN : '||';
578-
DOUBLE_HYPNEN_SIGN : '--';
578+
DOUBLE_HYPHEN_SIGN : '--';
579579
SLASH_SIGN : '/';
580580
QUESTION_MARK_SIGN : '?';
581581
DOUBLE_RIGHT_ARROW : '=>';

src/grammar/flink/FlinkSqlParser.g4

+42-42
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ sqlStatement
2929
| describeStatement
3030
| explainStatement
3131
| useStatement
32-
| showStatememt
32+
| showStatement
3333
| loadStatement
34-
| unloadStatememt
35-
| setStatememt
36-
| resetStatememt
37-
| jarStatememt
34+
| unloadStatement
35+
| setStatement
36+
| resetStatement
37+
| jarStatement
3838
| dtAddStatement
3939
;
4040

@@ -64,7 +64,7 @@ dmlStatement
6464
| insertStatement
6565
;
6666

67-
// some statemen
67+
// some statement
6868
describeStatement
6969
: (KW_DESCRIBE | KW_DESC) tablePath
7070
;
@@ -97,7 +97,7 @@ useModuleStatement
9797
: KW_USE KW_MODULES uid (COMMA uid)*
9898
;
9999

100-
showStatememt
100+
showStatement
101101
: KW_SHOW (KW_CATALOGS | KW_DATABASES | KW_VIEWS | KW_JARS)
102102
| KW_SHOW KW_CURRENT (KW_CATALOG | KW_DATABASE)
103103
| KW_SHOW KW_TABLES (( KW_FROM | KW_IN) databasePath)? likePredicate?
@@ -111,19 +111,19 @@ loadStatement
111111
: KW_LOAD KW_MODULE uid (KW_WITH tablePropertyList)?
112112
;
113113

114-
unloadStatememt
114+
unloadStatement
115115
: KW_UNLOAD KW_MODULE uid
116116
;
117117

118-
setStatememt
118+
setStatement
119119
: KW_SET (tableProperty)?
120120
;
121121

122-
resetStatememt
122+
resetStatement
123123
: KW_RESET tablePropertyKey?
124124
;
125125

126-
jarStatememt
126+
jarStatement
127127
: (KW_ADD | KW_REMOVE) KW_JAR jarFileName
128128
;
129129

@@ -338,7 +338,7 @@ jarFileName
338338
;
339339

340340
// Alter statements
341-
// Just for simple alter table statements,
341+
// Just for simple alter table statements,
342342
// it only includes rename, set key, add constraint, drop constraint, add unique
343343

344344
alterTable
@@ -449,15 +449,15 @@ insertMulStatement
449449
// Select statements
450450

451451
queryStatement
452-
: valuesCaluse
452+
: valuesClause
453453
| withClause queryStatement
454454
| LR_BRACKET queryStatement RR_BRACKET
455-
| left=queryStatement operator=(KW_INTERSECT | KW_UNION | KW_EXCEPT) KW_ALL? right=queryStatement orderByCaluse? limitClause?
456-
| selectClause orderByCaluse? limitClause?
457-
| selectStatement orderByCaluse? limitClause?
455+
| left=queryStatement operator=(KW_INTERSECT | KW_UNION | KW_EXCEPT) KW_ALL? right=queryStatement orderByClause? limitClause?
456+
| selectClause orderByClause? limitClause?
457+
| selectStatement orderByClause? limitClause?
458458
;
459459

460-
valuesCaluse
460+
valuesClause
461461
: KW_VALUES expression (COMMA expression)*
462462
;
463463

@@ -505,7 +505,7 @@ tableExpression
505505
| tableExpression KW_NATURAL? (KW_LEFT | KW_RIGHT | KW_FULL | KW_INNER)? KW_OUTER? KW_JOIN tableExpression joinCondition?
506506
| tableExpression KW_CROSS KW_JOIN tableExpression
507507
| inlineDataValueClause
508-
| windoTVFClause
508+
| windowTVFClause
509509
;
510510

511511
tableReference
@@ -532,15 +532,15 @@ inlineDataValueClause
532532
: LR_BRACKET valuesDefinition RR_BRACKET tableAlias
533533
;
534534

535-
windoTVFClause
536-
: KW_TABLE LR_BRACKET windowTVFExression RR_BRACKET
535+
windowTVFClause
536+
: KW_TABLE LR_BRACKET windowTVFExpression RR_BRACKET
537537
;
538538

539-
windowTVFExression
540-
: windoTVFName LR_BRACKET windowTVFParam (COMMA windowTVFParam)* RR_BRACKET
539+
windowTVFExpression
540+
: windowTVFName LR_BRACKET windowTVFParam (COMMA windowTVFParam)* RR_BRACKET
541541
;
542542

543-
windoTVFName
543+
windowTVFName
544544
: KW_TUMBLE
545545
| KW_HOP
546546
| KW_CUMULATE
@@ -586,7 +586,7 @@ groupItemDefinition
586586
| groupWindowFunction
587587
| LR_BRACKET RR_BRACKET
588588
| LR_BRACKET expression (COMMA expression)* RR_BRACKET
589-
| groupingSetsNotaionName LR_BRACKET expression (COMMA expression)* RR_BRACKET
589+
| groupingSetsNotationName LR_BRACKET expression (COMMA expression)* RR_BRACKET
590590
| groupingSets LR_BRACKET groupItemDefinition (COMMA groupItemDefinition)* RR_BRACKET
591591
| expression
592592
;
@@ -595,7 +595,7 @@ groupingSets
595595
: KW_GROUPING KW_SETS
596596
;
597597

598-
groupingSetsNotaionName
598+
groupingSetsNotationName
599599
: KW_CUBE
600600
| KW_ROLLUP
601601
;
@@ -627,19 +627,19 @@ namedWindow
627627
;
628628

629629
windowSpec
630-
: name=errorCapturingIdentifier? LR_BRACKET partitionByClause? orderByCaluse? windowFrame? RR_BRACKET
630+
: name=errorCapturingIdentifier? LR_BRACKET partitionByClause? orderByClause? windowFrame? RR_BRACKET
631631
;
632632

633633
matchRecognizeClause
634-
: KW_MATCH_RECOGNIZE LR_BRACKET partitionByClause? orderByCaluse? measuresClause? outputMode? afterMatchStrategy? patternDefination?
635-
patternVariablesDefination RR_BRACKET (KW_AS? identifier)?
634+
: KW_MATCH_RECOGNIZE LR_BRACKET partitionByClause? orderByClause? measuresClause? outputMode? afterMatchStrategy? patternDefinition?
635+
patternVariablesDefinition RR_BRACKET (KW_AS? identifier)?
636636
;
637637

638-
orderByCaluse
639-
: KW_ORDER KW_BY orderItemDefition (COMMA orderItemDefition)*
638+
orderByClause
639+
: KW_ORDER KW_BY orderItemDefinition (COMMA orderItemDefinition)*
640640
;
641641

642-
orderItemDefition
642+
orderItemDefinition
643643
: columnName ordering=(KW_ASC | KW_DESC)? (KW_NULLS nullOrder=(KW_LAST | KW_FIRST))?
644644
;
645645

@@ -664,7 +664,7 @@ measuresClause
664664
: KW_MEASURES projectItemDefinition (COMMA projectItemDefinition)*
665665
;
666666

667-
patternDefination
667+
patternDefinition
668668
: KW_PATTERN LR_BRACKET patternVariable+ RR_BRACKET withinClause?
669669
;
670670

@@ -684,7 +684,7 @@ afterMatchStrategy
684684
| KW_AFTER KW_MATCH KW_SKIP KW_TO KW_FIRST unquotedIdentifier
685685
;
686686

687-
patternVariablesDefination
687+
patternVariablesDefinition
688688
: KW_DEFINE projectItemDefinition (COMMA projectItemDefinition)*
689689
;
690690

@@ -739,9 +739,9 @@ likePredicate
739739

740740
valueExpression
741741
: primaryExpression # valueExpressionDefault
742-
| operator=(HYPNEN_SIGN | ADD_SIGN | BIT_NOT_OP) valueExpression # arithmeticUnary
743-
| left=valueExpression operator=(ASTERISK_SIGN | SLASH_SIGN | PENCENT_SIGN | KW_DIV) right=valueExpression # arithmeticBinary
744-
| left=valueExpression operator=(ADD_SIGN | HYPNEN_SIGN | DOUBLE_VERTICAL_SIGN) right=valueExpression # arithmeticBinary
742+
| operator=(HYPHEN_SIGN | ADD_SIGN | BIT_NOT_OP) valueExpression # arithmeticUnary
743+
| left=valueExpression operator=(ASTERISK_SIGN | SLASH_SIGN | PERCENT_SIGN | KW_DIV) right=valueExpression # arithmeticBinary
744+
| left=valueExpression operator=(ADD_SIGN | HYPHEN_SIGN | DOUBLE_VERTICAL_SIGN) right=valueExpression # arithmeticBinary
745745
| left=valueExpression operator=BIT_AND_OP right=valueExpression # arithmeticBinary
746746
| left=valueExpression operator=BIT_XOR_OP right=valueExpression # arithmeticBinary
747747
| left=valueExpression operator=BIT_OR_OP right=valueExpression # arithmeticBinary
@@ -854,7 +854,7 @@ unitToUnitInterval
854854
;
855855

856856
intervalValue
857-
: (ADD_SIGN | HYPNEN_SIGN)? (DIG_LITERAL | REAL_LITERAL)
857+
: (ADD_SIGN | HYPHEN_SIGN)? (DIG_LITERAL | REAL_LITERAL)
858858
| STRING_LITERAL
859859
;
860860

@@ -1000,26 +1000,26 @@ bitOperator
10001000
mathOperator
10011001
: ASTERISK_SIGN
10021002
| SLASH_SIGN
1003-
| PENCENT_SIGN
1003+
| PERCENT_SIGN
10041004
| KW_DIV
10051005
| ADD_SIGN
1006-
| HYPNEN_SIGN
1007-
| DOUBLE_HYPNEN_SIGN
1006+
| HYPHEN_SIGN
1007+
| DOUBLE_HYPHEN_SIGN
10081008
;
10091009

10101010
unaryOperator
10111011
: EXCLAMATION_SYMBOL
10121012
| BIT_NOT_OP
10131013
| ADD_SIGN
1014-
| HYPNEN_SIGN
1014+
| HYPHEN_SIGN
10151015
| KW_NOT
10161016
;
10171017

10181018
constant
10191019
: timeIntervalExpression
10201020
| timePointLiteral
10211021
| stringLiteral // 引号包含的字符串
1022-
| HYPNEN_SIGN? decimalLiteral // 正/负整数
1022+
| HYPHEN_SIGN? decimalLiteral // 正/负整数
10231023
| booleanLiteral // 布尔值
10241024
| REAL_LITERAL // 小数
10251025
| BIT_STRING

src/grammar/hive/HiveSqlParser.g4

+5-5
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ explainOption
5959
| KW_REOPTIMIZATION
6060
| KW_LOCKS
6161
| KW_AST
62-
| KW_VECTORIZATION KW_ONLY? vectorizatonDetail?
62+
| KW_VECTORIZATION KW_ONLY? vectorizationDetail?
6363
| KW_DEBUG
6464
| KW_DDL
6565
;
6666

67-
vectorizatonDetail
67+
vectorizationDetail
6868
: KW_SUMMARY
6969
| KW_OPERATOR
7070
| KW_EXPRESSION
@@ -415,10 +415,10 @@ privObjectCols
415415
;
416416

417417
privilegeList
418-
: privlegeDef (COMMA privlegeDef)*
418+
: privilegeDef (COMMA privilegeDef)*
419419
;
420420

421-
privlegeDef
421+
privilegeDef
422422
: privilegeType (LPAREN cols=columnNameList RPAREN)?
423423
;
424424

@@ -663,7 +663,7 @@ recordWriter
663663

664664
rowFormatSerde
665665
: KW_ROW KW_FORMAT KW_SERDE name=StringLiteral (
666-
KW_WITH KW_SERDEPROPERTIES serdeprops=tableProperties
666+
KW_WITH KW_SERDEPROPERTIES serderops=tableProperties
667667
)?
668668
;
669669

src/grammar/impala/ImpalaSqlParser.g4

+2-2
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ createFunction
132132

133133
alterStatement
134134
: alterDatabase
135-
| alterUnSetOrSetViewTblproperties
135+
| alterUnSetOrSetViewTblProperties
136136
| renameTable
137137
| alterViewOwner
138138
| alterView
@@ -241,7 +241,7 @@ renameTable
241241
: KW_ALTER KW_TABLE tableNamePath KW_RENAME KW_TO tableNamePath
242242
;
243243

244-
alterUnSetOrSetViewTblproperties
244+
alterUnSetOrSetViewTblProperties
245245
: KW_ALTER KW_VIEW viewNamePath (KW_UNSET | KW_SET) KW_TBLPROPERTIES tblProp=properties
246246
;
247247

0 commit comments

Comments
 (0)