Skip to content

Commit

Permalink
Add unit test for ALTER TABLE COALESCE PARTITION
Browse files Browse the repository at this point in the history
  • Loading branch information
Tithugues committed Apr 12, 2023
1 parent 26eb1f2 commit 6e14f3e
Show file tree
Hide file tree
Showing 3 changed files with 176 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/Parser/AlterStatementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public function alterProvider(): array
['parser/parseAlterTableRenameIndex'],
['parser/parseAlterTablePartitionByRange1'],
['parser/parseAlterTablePartitionByRange2'],
['parser/parseAlterTableCoalescePartition'],
['parser/parseAlterWithInvisible'],
['parser/parseAlterTableCharacterSet1'],
['parser/parseAlterTableCharacterSet2'],
Expand Down
1 change: 1 addition & 0 deletions tests/data/parser/parseAlterTableCoalescePartition.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE `MY_TABLE` COALESCE PARTITION 2;
174 changes: 174 additions & 0 deletions tests/data/parser/parseAlterTableCoalescePartition.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
{
"query": "ALTER TABLE `MY_TABLE` COALESCE PARTITION 2;",
"lexer": {
"@type": "PhpMyAdmin\\SqlParser\\Lexer",
"str": "ALTER TABLE `MY_TABLE` COALESCE PARTITION 2;",
"len": 44,
"last": 44,
"list": {
"@type": "PhpMyAdmin\\SqlParser\\TokensList",
"tokens": [
{
"@type": "PhpMyAdmin\\SqlParser\\Token",
"token": "ALTER",
"value": "ALTER",
"keyword": "ALTER",
"type": 1,
"flags": 3,
"position": 0
},
{
"@type": "PhpMyAdmin\\SqlParser\\Token",
"token": " ",
"value": " ",
"keyword": null,
"type": 3,
"flags": 0,
"position": 5
},
{
"@type": "PhpMyAdmin\\SqlParser\\Token",
"token": "TABLE",
"value": "TABLE",
"keyword": "TABLE",
"type": 1,
"flags": 3,
"position": 6
},
{
"@type": "PhpMyAdmin\\SqlParser\\Token",
"token": " ",
"value": " ",
"keyword": null,
"type": 3,
"flags": 0,
"position": 11
},
{
"@type": "PhpMyAdmin\\SqlParser\\Token",
"token": "`MY_TABLE`",
"value": "MY_TABLE",
"keyword": null,
"type": 8,
"flags": 2,
"position": 12
},
{
"@type": "PhpMyAdmin\\SqlParser\\Token",
"token": " ",
"value": " ",
"keyword": null,
"type": 3,
"flags": 0,
"position": 22
},
{
"@type": "PhpMyAdmin\\SqlParser\\Token",
"token": "COALESCE PARTITION",
"value": "COALESCE PARTITION",
"keyword": "COALESCE PARTITION",
"type": 1,
"flags": 7,
"position": 23
},
{
"@type": "PhpMyAdmin\\SqlParser\\Token",
"token": " ",
"value": " ",
"keyword": null,
"type": 3,
"flags": 0,
"position": 41
},
{
"@type": "PhpMyAdmin\\SqlParser\\Token",
"token": "2",
"value": 2,
"keyword": null,
"type": 6,
"flags": 0,
"position": 42
},
{
"@type": "PhpMyAdmin\\SqlParser\\Token",
"token": ";",
"value": ";",
"keyword": null,
"type": 9,
"flags": 0,
"position": 43
},
{
"@type": "PhpMyAdmin\\SqlParser\\Token",
"token": null,
"value": null,
"keyword": null,
"type": 9,
"flags": 0,
"position": null
}
],
"count": 11,
"idx": 11
},
"delimiter": ";",
"delimiterLen": 1,
"strict": false,
"errors": []
},
"parser": {
"@type": "PhpMyAdmin\\SqlParser\\Parser",
"list": {
"@type": "@1"
},
"statements": [
{
"@type": "PhpMyAdmin\\SqlParser\\Statements\\AlterStatement",
"table": {
"@type": "PhpMyAdmin\\SqlParser\\Components\\Expression",
"database": null,
"table": "MY_TABLE",
"column": null,
"expr": "`MY_TABLE`",
"alias": null,
"function": null,
"subquery": null
},
"altered": [
{
"@type": "PhpMyAdmin\\SqlParser\\Components\\AlterOperation",
"options": {
"@type": "PhpMyAdmin\\SqlParser\\Components\\OptionsArray",
"options": {
"1": {
"name": "COALESCE PARTITION",
"equals": false,
"expr": "2",
"value": "2"
}
}
},
"field": null,
"partitions": null,
"unknown": []
}
],
"options": {
"@type": "PhpMyAdmin\\SqlParser\\Components\\OptionsArray",
"options": {
"3": "TABLE"
}
},
"first": 0,
"last": 9
}
],
"brackets": 0,
"strict": false,
"errors": []
},
"errors": {
"lexer": [],
"parser": []
}
}

0 comments on commit 6e14f3e

Please sign in to comment.