-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add INDEX USING HASH support #56
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add a migration file for the integration test for the index hashing support? No need to assert anything. Just need to make sure it actually runs.
Folder can be found: https://github.com/Faire/sqldelight-cockroachdb-dialect/tree/main/integration-testing/src/main/resources/migration/com/faire/sqldelight/dialects/cockroachdb
You can run the gradle task :integration-testing:generateMigrationFile
to create a migration file.
Thanks!
@@ -134,10 +156,10 @@ blob_data_type ::= 'BYTEA' | 'BLOB' | 'BYTES' { | |||
override = true | |||
} | |||
|
|||
create_index_stmt ::= CREATE [ UNIQUE ] INDEX [ IF NOT EXISTS ] [ [ ansi_database_name DOT ] ansi_index_name ] ON ansi_table_name LP ansi_indexed_column ( COMMA ansi_indexed_column ) * RP ['STORING' LP ansi_indexed_column ( COMMA ansi_indexed_column ) * RP ] [ WHERE <<expr '-1'>> ] { | |||
create_index_stmt ::= CREATE [ UNIQUE ] INDEX [ 'CONCURRENTLY' ] [ IF NOT EXISTS ] [ [ ansi_database_name DOT ] ansi_index_name ] ON ansi_table_name LP ansi_indexed_column ( COMMA ansi_indexed_column ) * RP [ index_using_hash ] [('STORING' | 'COVERING' | 'INCLUDE') LP ansi_indexed_column ( COMMA ansi_indexed_column ) * RP ] [ WHERE <<expr '-1'>> ] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test case for CONCURRENTLY
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I forgot that one, my bad
@@ -94,8 +99,10 @@ overrides ::= table_constraint | |||
| alter_table_rules | |||
| extension_stmt | |||
|
|||
index_using_hash ::= 'USING' 'HASH' [ storage_options ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be good to use something else than storage_options and create your own just for the hash options.
The cockroach grammar only supports one option https://www.cockroachlabs.com/docs/stable/sql-grammar#opt_hash_sharded
While storage options can support multiple.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also there should be a SqlType for USING
already
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot!
Hi,
This PR adds support for hash sharded indexes.
It adds
USING HASH [WITH ( bucket_size = X )]
to:Also added:
STORING
keyword:INCLUDE
andCOVERING
.CONCURRENTLY
onCREATE INDEX