-
Notifications
You must be signed in to change notification settings - Fork 593
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(frontend): initially introduce table def sql purification #19949
base: main
Are you sure you want to change the base?
Conversation
c2b4de2
to
ca9e6ef
Compare
45ab48e
to
073b15c
Compare
7922a7b
to
7fd1ad9
Compare
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.
LGTM
show create table ctas; | ||
---- | ||
public.ctas CREATE TABLE ctas (v0 INT, v1 NUMERIC, v2 TIMESTAMP, v3 TIMESTAMP WITH TIME ZONE, v4 CHARACTER VARYING[], v5 STRUCT<i BIGINT, j STRUCT<a BIGINT, b CHARACTER VARYING>>, v6 rw_int256, v7 MAP(CHARACTER VARYING,INT)) |
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.
After the change, how/is it possible (is it meaningful?) to get the "original create sql" for CTAS and schema registry? It seems useful for debugging/development purpose.
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.
It can be done via inspecting definition
field of the metadata (like through the dashboard). However, I suppose it's indeed not that meaningful, as altering a CTAS will cause the purified definition to be persisted.
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.
as altering a CTAS will cause the purified definition to be persisted.
Note: This is not the current behavior as purified definition is only used for SHOW
but not the base for schema change replanning.
|
||
// Schema inferred. Now derive the missing columns and constraints. | ||
// First, remove the wildcard from the definition. | ||
*wildcard_idx = None; |
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.
We might need tests for wildcard, and generated column, include column ,etc
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.
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.
license-eye has checked 5535 files.
Valid | Invalid | Ignored | Fixed |
---|---|---|---|
2332 | 2 | 3201 | 0 |
Click to see the invalid file list
- src/frontend/src/catalog/purify.rs
- src/frontend/src/utils/data_type.rs
Use this command to fix any missing license headers
```bash
docker run -it --rm -v $(pwd):/github/workspace apache/skywalking-eyes header fix
</details>
265f6f7
to
efa9a22
Compare
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
2869377
to
5a21eb2
Compare
pub fn create_sql_purified(&self) -> String { | ||
self.create_sql_ast_purified() | ||
.map(|stmt| stmt.to_string()) | ||
.unwrap_or_else(|_| self.create_sql()) | ||
} |
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.
Should we still return the result here? Not sure if we can guarantee this for all exist tables created previously.
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.
By falling back to self.create_sql()
(i.e. self.definition
) we ensure that the behavior gets strictly better compared to prior to this PR. 🤔 Not sure what you mean by "guarantee this"?
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
See #17472 for the background. This PR initially introduces SQL purification for table definition, and adopt it in
SHOW CREATE TABLE
. Further adoption (like for replacing table plan) will be done in future PRs, as they require additional work that is not directly relevant to the current scope to ensure a complete end-to-end implementation.It turns out that we only need to restore the
ColumnDef
(specifically, theDataType
, which is already contributed by @StrikeW). This makes the procedure much simpler than initially thought.Checklist
Documentation
Release note