-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Feat(starrocks)!: improve some starrocks properties generation #6827
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
Conversation
|
I create this PR to replace #6737, which is closed by mistake. Please have a review. Thanks. |
sqlglot/dialects/starrocks.py
Outdated
| exp.RollupProperty: exp.Properties.Location.POST_SCHEMA, | ||
| exp.PartitionByListProperty: exp.Properties.Location.POST_SCHEMA, | ||
| exp.PartitionedByProperty: exp.Properties.Location.POST_SCHEMA, | ||
| exp.RefreshTriggerProperty: exp.Properties.Location.POST_SCHEMA, |
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.
Looks like this is the case for Doris as well, does MySQL have this property? Otherwise, we can move both Doris & Starrocks's to MySQL and have it inherited
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.
- For MySQL, it doesn't support MV.
- There are different between Doris and StarRocks for the REFRESH clause, both for the syntax and keywords.
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.
Right, I meant that this line is also true in Doris so we can move the POST_SCHEMA to either MySQL's generator or the base generator instead of duplicating it in both Doris & Starrocks
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'll move it to the base generator. (It's not proper for MySQL.)
sqlglot/dialects/starrocks.py
Outdated
| exp.RollupProperty: exp.Properties.Location.POST_SCHEMA, | ||
| exp.PartitionByListProperty: exp.Properties.Location.POST_SCHEMA, | ||
| exp.PartitionedByProperty: exp.Properties.Location.POST_SCHEMA, | ||
| exp.RefreshTriggerProperty: exp.Properties.Location.POST_SCHEMA, |
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.
Right, I meant that this line is also true in Doris so we can move the POST_SCHEMA to either MySQL's generator or the base generator instead of duplicating it in both Doris & Starrocks
Depends on tobymao#6804 Please review/merge tobymao#6804 first. This PR only contains changes on top of that PR. - Import expression partitioning for MV. - Enabled ALTER TABLE … RENAME for StarRocks. - Emitted ORDER BY via CLUSTER BY for StarRocks outputs. - Added MV (REFRESH) properties handling for StarRocks materialized views. - And, tests updated/added for the new StarRocks behaviors. Signed-off-by: jaogoy <jaogoy@gmail.com>
1. move alterrename_sql to mysql 2. implement parse_refresh_property for starrocks 3. refine refresh property generatation Signed-off-by: jaogoy <jaogoy@gmail.com>
Signed-off-by: jaogoy <jaogoy@gmail.com>
Signed-off-by: jaogoy <jaogoy@gmail.com>
Signed-off-by: jaogoy <jaogoy@gmail.com>
41194d5 to
b0df46e
Compare
@geooo109 @VaggelisD I've rebased the code, and solve the conflict. You can have a look again. thanks. |
Signed-off-by: jaogoy <jaogoy@gmail.com>
|
@jaogoy I will check it, thank you. For the We can parse them but we generate without PARTITION BY Starrocks edit: i will refactor it to generate parentheses by default, in order to support the superset. |
|
@jaogoy can you fix the styling ? edit: I will merge, fix style and refactor, thanks for the PR! |
@geooo109 The StarRocks docs can't reflect all the real behavior. I've tested the creation on v3.5, only DUPLICATE KEY tables can be created without parentheses when using column only partitioning. And I don't know whether they will fix it. |
|
@jaogoy If we always generate by default parentheses, it will be correct right ? |
Yes, for columns only partitioning, it will be correct for all cases. |
Depends on #6804.
Please review/merge #6804 first.
This PR contains changes on top of that PR. And you can review the diff only.
alterrename_sqlfrom Doris into MySQL, because it's the same for them all.)views.