Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support parsing MySQL CREATE INDEX with ENGINE_ATTRIBUTE #31140

Merged
merged 1 commit into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ vcpuSpec

createResourceGroup
: CREATE RESOURCE GROUP groupName TYPE EQ_ (SYSTEM | USER) (VCPU EQ_? vcpuSpec (COMMA_ vcpuSpec)*)?
(THREAD_PRIORITY EQ_? NUMBER_)? (ENABLE | DISABLE)?
(THREAD_PRIORITY EQ_? numberLiterals)? (ENABLE | DISABLE)?
;

dropResourceGroup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ columnAttribute
| constraintClause? checkConstraint
| constraintEnforcement
| visibility
| value = ENGINE_ATTRIBUTE EQ_? jsonAttribute = string_
;

checkConstraint
Expand Down Expand Up @@ -521,6 +522,7 @@ commonIndexOption
: KEY_BLOCK_SIZE EQ_? NUMBER_
| COMMENT stringLiterals
| visibility
| ENGINE_ATTRIBUTE EQ_? jsonAttribute = string_
;

visibility
Expand Down
3 changes: 3 additions & 0 deletions test/it/parser/src/main/resources/case/dal/create.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,7 @@
<create-resource-group sql-case-id="create_resource_group">
<group name="rg" start-index="23" stop-index="24" />
</create-resource-group>
<create-resource-group sql-case-id="create_resource_group_with_system_type_and_thread_priority">
<group name="rg2" start-index="23" stop-index="25"/>
</create-resource-group>
</sql-parser-test-cases>
8 changes: 8 additions & 0 deletions test/it/parser/src/main/resources/case/ddl/create-index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -269,4 +269,12 @@
</table>
<column start-index="58" stop-index="66" name="is_active" />
</create-index>

<create-index sql-case-id="create_index_with_engine_attribute">
<index name="i1" start-index="13" stop-index="14"/>
<table>
<simple-table name="t1" start-index="19" stop-index="20"/>
</table>
<column name="c1" start-index="23" stop-index="24"/>
</create-index>
</sql-parser-test-cases>
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@

<sql-cases>
<sql-case id="create_resource_group" value="CREATE RESOURCE GROUP rg type = user" db-types="MySQL" />
<sql-case id="create_resource_group_with_system_type_and_thread_priority" value="CREATE RESOURCE GROUP rg2 TYPE = SYSTEM THREAD_PRIORITY = -20 DISABLE" db-types="MySQL"/>
</sql-cases>
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@
WITH (FILLFACTOR = 80, PAD_INDEX = ON, DROP_EXISTING = ON);" db-types="SQLServer" />
<sql-case id="create_index_on_local_parallel_nologging" value="CREATE INDEX from_number_ix ON call_detail_records(from_number) LOCAL PARALLEL NOLOGGING" db-types="Oracle" />
<sql-case id="create_bitmap_index_on_local_parallel_nologging" value="CREATE BITMAP INDEX is_active_bix ON credit_card_accounts(is_active) LOCAL PARALLEL NOLOGGING" db-types="Oracle" />
<sql-case id="create_index_with_engine_attribute" value="CREATE INDEX i1 ON t1 (c1) ENGINE_ATTRIBUTE='{&quot;key&quot;:&quot;value&quot;}';" db-types="MySQL"/>
</sql-cases>