-
Notifications
You must be signed in to change notification settings - Fork 596
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
feat: support ALTER [TABLE | [MATERIALIZED] VIEW | SOURCE | SINK | CONNECTION | FUNCTION] <name> SET SCHEMA <schema_name>
syntax
#13341
Conversation
ALTER [TABLE | [MATERIAL] VIEW | SOURCE | SINK | FUNCTION] <name> SET SCHEMA <schema_name>
ALTER [TABLE | [MATERIAL] VIEW | SOURCE | SINK | FUNCTION] <name> SET SCHEMA <schema_name>
syntax
As
Method 1 keeps the proto definition clean but introduce overehead for iteration, but since the no. of schemas in database are generally not huge and the frequencies of calling There is no overhead in Method 2 but introducing a new field may be ugly. Which way will you suggest here? @yezizp2012 |
ALTER [TABLE | [MATERIAL] VIEW | SOURCE | SINK | FUNCTION] <name> SET SCHEMA <schema_name>
syntaxALTER [TABLE | [MATERIALIZED] VIEW | SOURCE | SINK | FUNCTION] <name> SET SCHEMA <schema_name>
syntax
I prefer the first one. There won't be too many schemas and the altering will be very low-frequency. |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #13341 +/- ##
==========================================
- Coverage 68.40% 68.29% -0.12%
==========================================
Files 1505 1506 +1
Lines 259135 259992 +857
==========================================
+ Hits 177268 177552 +284
- Misses 81867 82440 +573
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
ALTER [TABLE | [MATERIALIZED] VIEW | SOURCE | SINK | FUNCTION] <name> SET SCHEMA <schema_name>
syntaxALTER [TABLE | [MATERIALIZED] VIEW | SOURCE | SINK | CONNECTION | FUNCTION] <name> SET SCHEMA <schema_name>
syntax
…avelabs/risingwave into kanzhen/alter-set-schema
…avelabs/risingwave into kanzhen/alter-set-schema
Good job! I will review it after my vacation. |
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.
Good job! Rest LGTM.
@@ -192,7 +192,7 @@ impl SchemaCatalog { | |||
.unwrap(); | |||
entry.get_mut().remove(pos); | |||
} | |||
Vacant(_entry) => unreachable!(), |
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.
Is this modification unintentional? I didn't see any reason to ignore it.
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, it is intentional.
The notification order received by frontend is:
- update table
- create table in the new schema
- drop table in the old schema (which calls
indexes_by_table_id.remove(table_id)
)
- update index
- create index in the new schema
- drop index in the old schema (which lookup
indexes_by_table_id
in the old schema and it is removed in step 1)
By changing the unreachable!()
to ()
and with the designate notification order we can reuse most of code like drop_table/create_table/...
. Otherwise we may need to create a new kind of notification for alter set schema
and reimplement all the drop and create logic. It might be more robust though since not sharing functions with other statements, but may introduce more duplicate and trivial code. Which option does you prefer, preserve this change or reimplement a new one?
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.
I see. Well, let's just ignore it for now and add some comments for it.
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.
Good job!!! LGTM, please add user-facing
label for this new syntax and add some brief introduce in the release section.
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
Resolve #13159 and #13454
Checklist
./risedev check
(or alias,./risedev c
)Documentation
Release note
If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.
Support alter relations/connection/function set schema syntax:
ALTER { TABLE t | [MATERIALIZED] VIEW (m)v | SOURCE src | SINK sink | CONNECTION c | FUNCTION f( argument_type [, ...] ) } SET SCHEMA schema_name