Skip to content

Commit

Permalink
feat: support spark sql auto complete (#179)
Browse files Browse the repository at this point in the history
* refactor: spark sql g4

* feat: support spark sql suggestion

* test: spark sql suggestion unit test

* test: hive spell check

* feat: spark sql keyword has multiple values

* test: KW_NOT KW_RLIKE split into two value

---------

Co-authored-by: liuyi <[email protected]>
  • Loading branch information
liuxy0551 and liuyi authored Oct 12, 2023
1 parent 53ead45 commit 4d1dfa6
Show file tree
Hide file tree
Showing 18 changed files with 9,919 additions and 8,815 deletions.
9 changes: 6 additions & 3 deletions src/grammar/spark/SparkSqlLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ KW_NANOSECOND: 'NANOSECOND';
KW_NANOSECONDS: 'NANOSECONDS';
KW_NATURAL: 'NATURAL';
KW_NO: 'NO';
KW_NOT: 'NOT' | '!';
KW_NOT: 'NOT';
KW_NULL: 'NULL';
KW_NULLS: 'NULLS';
KW_NUMERIC: 'NUMERIC';
Expand Down Expand Up @@ -290,7 +290,8 @@ KW_RESPECT: 'RESPECT';
KW_RESTRICT: 'RESTRICT';
KW_REVOKE: 'REVOKE';
KW_RIGHT: 'RIGHT';
KW_RLIKE: 'RLIKE' | 'REGEXP';
KW_RLIKE: 'RLIKE';
KW_REGEXP: 'REGEXP';
KW_ROLE: 'ROLE';
KW_ROLES: 'ROLES';
KW_ROLLBACK: 'ROLLBACK';
Expand Down Expand Up @@ -328,14 +329,15 @@ KW_STRUCT: 'STRUCT';
KW_SUBSTR: 'SUBSTR';
KW_SUBSTRING: 'SUBSTRING';
KW_SYNC: 'SYNC';
KW_SYSTEM: 'SYSTEM';
KW_SYSTEM_TIME: 'SYSTEM_TIME';
KW_SYSTEM_VERSION: 'SYSTEM_VERSION';
KW_TABLE: 'TABLE';
KW_TABLES: 'TABLES';
KW_TABLESAMPLE: 'TABLESAMPLE';
KW_TARGET: 'TARGET';
KW_TBLPROPERTIES: 'TBLPROPERTIES';
KW_TEMPORARY: 'TEMPORARY' | 'TEMP';
KW_TEMPORARY: 'TEMPORARY';
KW_TERMINATED: 'TERMINATED';
KW_THEN: 'THEN';
KW_TIME: 'TIME';
Expand Down Expand Up @@ -402,6 +404,7 @@ LTE : '<=' | '!>';
GT : '>';
GTE : '>=' | '!<';

NOT: '!';
PLUS: '+';
MINUS: '-';
ASTERISK: '*';
Expand Down
232 changes: 126 additions & 106 deletions src/grammar/spark/SparkSqlParser.g4

Large diffs are not rendered by default.

17 changes: 13 additions & 4 deletions src/lib/spark/SparkSqlLexer.interp

Large diffs are not rendered by default.

Loading

0 comments on commit 4d1dfa6

Please sign in to comment.