Skip to content

Commit

Permalink
[MySql] Heatwave, TokuDB and Azure MySQL extensions (#4383)
Browse files Browse the repository at this point in the history
  • Loading branch information
ani-sha authored Jan 17, 2025
1 parent 761804c commit 83cb847
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sql/mysql/Positive-Technologies/MySqlLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,9 @@ WEEK : 'WEEK';
SECOND : 'SECOND';
MICROSECOND : 'MICROSECOND';

// Azure Database for MySQL Single Server instance:
FIREWALL_RULES: 'FIREWALL_RULES';

// PRIVILEGES

ADMIN : 'ADMIN';
Expand Down Expand Up @@ -1089,6 +1092,7 @@ ROW_COUNT : 'ROW_COUNT';
RPAD : 'RPAD';
RTRIM : 'RTRIM';
SEC_TO_TIME : 'SEC_TO_TIME';
SECONDARY_ENGINE : 'SECONDARY_ENGINE';
SECONDARY_ENGINE_ATTRIBUTE : 'SECONDARY_ENGINE_ATTRIBUTE';
SESSION_USER : 'SESSION_USER';
SHA : 'SHA';
Expand Down
7 changes: 7 additions & 0 deletions sql/mysql/Positive-Technologies/MySqlParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ columnConstraint
| INVISIBLE # invisibilityColumnConstraint
| (AUTO_INCREMENT | ON UPDATE currentTimestamp) # autoIncrementColumnConstraint
| PRIMARY? KEY # primaryKeyColumnConstraint
| CLUSTERING KEY # clusteringKeyColumnConstraint // Tokudb-specific only
| UNIQUE KEY? # uniqueKeyColumnConstraint
| COMMENT STRING_LITERAL # commentColumnConstraint
| COLUMN_FORMAT colformat = (FIXED | DYNAMIC | DEFAULT) # formatColumnConstraint
Expand All @@ -461,6 +462,8 @@ tableConstraint
| (CONSTRAINT name = uid?)? UNIQUE indexFormat = (INDEX | KEY)? index = uid? indexType? indexColumnNames indexOption* # uniqueKeyTableConstraint
| (CONSTRAINT name = uid?)? FOREIGN KEY index = uid? indexColumnNames referenceDefinition # foreignKeyTableConstraint
| (CONSTRAINT name = uid?)? CHECK '(' expression ')' # checkTableConstraint
| CLUSTERING KEY index = uid? indexColumnNames # clusteringKeyTableConstraint
// Tokudb-specific only
;

referenceDefinition
Expand Down Expand Up @@ -520,6 +523,8 @@ tableOption
| ID
) # tableOptionRowFormat
| START TRANSACTION # tableOptionStartTransaction
| SECONDARY_ENGINE '='? (ID | STRING_LITERAL) # tableOptionSecondaryEngine
// HeatWave-specific only
| SECONDARY_ENGINE_ATTRIBUTE '='? STRING_LITERAL # tableOptionSecondaryEngineAttribute
| STATS_AUTO_RECALC '='? extBoolValue = (DEFAULT | '0' | '1') # tableOptionRecalculation
| STATS_PERSISTENT '='? extBoolValue = (DEFAULT | '0' | '1') # tableOptionPersistent
Expand Down Expand Up @@ -1871,6 +1876,8 @@ cacheIndexStatement

flushStatement
: FLUSH flushFormat = (NO_WRITE_TO_BINLOG | LOCAL)? flushOption (',' flushOption)*
// Specific for Azure Database for MySQL Single Server instance.
| FLUSH FIREWALL_RULES
;

killStatement
Expand Down
14 changes: 14 additions & 0 deletions sql/mysql/Positive-Technologies/examples/ddl_create.sql
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,20 @@ CREATE TABLE `\\test_table`(id INT(11) NOT NULL, PRIMARY KEY (`id`)) ENGINE = IN
CREATE TABLE `\\test\\_table\\`(id INT(11) NOT NULL, PRIMARY KEY (`id`)) ENGINE = INNODB;

CREATE TABLE TableWithVector (id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, vec1 VECTOR, vec2 VECTOR);

CREATE TABLE PARTICIPATE_ACTIVITIES (
ID BIGINT NOT NULL AUTO_INCREMENT,
USER_ID BIGINT NOT NULL,
PRIMARY KEY (ID) USING BTREE)
ENGINE=INNODB AUTO_INCREMENT=1979503 DEFAULT CHARSET=UTF8MB4 COLLATE=UTF8MB4_GENERAL_CI SECONDARY_ENGINE=RAPID;

CREATE TABLE `TABLE1` (
`COL1` INT(10) UNSIGNED NOT NULL,
`COL2` VARCHAR(32) NOT NULL,
`COL3` ENUM (`VAR1`,`VAR2`, `VAR3`) NOT NULL,
PRIMARY KEY (`COL1`, `COL2`, `COL3`),
CLUSTERING KEY `CLKEY1` (`COL3`, `COL2`))
ENGINE=TOKUDB DEFAULT CHARSET=CP1251;
#end
#begin
-- Rename table
Expand Down
3 changes: 3 additions & 0 deletions sql/mysql/Positive-Technologies/examples/ddl_flush.sql
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ flush TABLE Foo, Bar;
flush table Foo, Bar for export;
flush table Foo, Bar with read lock;
#end

-- Azure Database for MySQL Single Server instance. This type of database server is being decommissioned on Sept 16 2024 and is succeeded by their "Flexible Server" offering.
FLUSH FIREWALL_RULES;

0 comments on commit 83cb847

Please sign in to comment.