feat(fe,meta): support logical view - #6023
Merged
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## main #6023 +/- ##
==========================================
- Coverage 74.65% 74.35% -0.30%
==========================================
Files 931 935 +4
Lines 149324 150090 +766
==========================================
+ Hits 111471 111601 +130
- Misses 37853 38489 +636
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
HuaHuaY
approved these changes
Nov 1, 2022
yezizp2012
reviewed
Nov 1, 2022
This was referenced Nov 1, 2022
yezizp2012
approved these changes
Nov 2, 2022
yezizp2012
left a comment
Contributor
There was a problem hiding this comment.
generally LGTM, great job!!!
| uint32 source_id = 4; | ||
| uint32 all_tables_schema_id = 5; | ||
| uint32 all_sources_schema_id = 6; | ||
| uint32 view_id = 8; |
Contributor
There was a problem hiding this comment.
We might need to support grant/revoke privileges for views (and all views in schema maybe) in user service. But that's non-related to this PR. Cc @HuaHuaY
This was referenced Nov 9, 2022
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I hereby agree to the terms of the Singularity Data, Inc. Contributor License Agreement.
What's changed and what's your intention?
close #2317
See
e2e_test/batch/basic/logical_view.slt.partfor examplesidea:
Viewincatalog.proto).binder/relation/table_or_source.rs)limitations:
View's dependants not resolved. e.g., when view
Vdepends on mv (or table)MV, we can't dropMVbefore droppingV. But if mv (or view)MVdepends onV, we can dropV.The difficulty is that currently after binding, view is completely replaced by the sql and the information of the view is lost. To support it, we may collect the dependent view ids in binder. Note that currently for mv, dependent relation ids are resolved in meta from stream fragment plan. For view, they are resolved in frontend from batch plan.
How to handle * in case of ddl (specifically adding column) is not yet considered
example:
create table t(x int); create view v as select * from t; alter table t add column y int;In PG,vonly outputsxwithouty. This means*is resolved before the view is stored. This behavior is expected also because we can specify column names when creating views. It only makes sense if the view outputs fixed number of columns.The difficulty is that
*is resolved in binder, but after binding, we can't restore theBoundQueryto AST and unparse it. One solution is to serializing plan instead of sql, but as discussed earlier we don't want to persist plan because it may be subject to change. Another solution is to rewriting AST while binding, but it may be a little bit hacky.Checklist
./risedev check(or alias,./risedev c)Documentation
If your pull request contains user-facing changes, please specify the types of the changes, and create a release note. Otherwise, please feel free to remove this section.
Types of user-facing changes
Release note
Support
CREATE VIEWSee
e2e_test/batch/basic/logical_view.slt.partfor examples