qzsee opened a new pull request, #50411:
URL: https://github.com/apache/doris/pull/50411

   ### What problem does this PR solve?
   
   Issue Number: close #xxx
   
   Related PR: #xxx
   
   Problem Summary:
   
   A system table has been added, through which the dependencies of the view 
can be viewed
   
   
   
   
   ```sql
   
   
   CREATE TABLE `stu` (
   `sid` int NULL,
   `sname` varchar(32) NULL
   ) ENGINE=OLAP
   DUPLICATE KEY(`sid`)
   DISTRIBUTED BY HASH(`sid`) BUCKETS 1
   PROPERTIES (
   "replication_allocation" = "tag.location.default: 1"
   ); 
   
   
   
   CREATE TABLE `grade` (
   `sid` int NULL,
   `cid` int NULL,
   `score` int NULL
   ) ENGINE=OLAP
   DUPLICATE KEY(`sid`)
   DISTRIBUTED BY HASH(`sid`) BUCKETS 1
   PROPERTIES (
   "replication_allocation" = "tag.location.default: 1"
   ); 
   
   
   
   CREATE MATERIALIZED VIEW mv_a
   (sid,sname)
   BUILD IMMEDIATE REFRESH COMPLETE ON COMMIT
   DUPLICATE KEY(`sid`, `sname`)
   DISTRIBUTED BY HASH(`sid`) BUCKETS 1
   PROPERTIES (
   "replication_allocation" = "tag.location.default: 1"
   )
   AS select  `stu`.`sid`,  `stu`.`sname` from  `stu` limit 1 
   
   
   
   CREATE MATERIALIZED VIEW mv_b
   (sid,sname)
   BUILD IMMEDIATE REFRESH COMPLETE ON COMMIT
   DUPLICATE KEY(`sid`, `sname`)
   DISTRIBUTED BY HASH(`sid`) BUCKETS 1
   PROPERTIES (
   "replication_allocation" = "tag.location.default: 1"
   )
   AS select  `mv_a`.`sid`,  `mv_a`.`sname` from  `mv_a` 
   
   
   
   CREATE MATERIALIZED VIEW mv_c
   (sid,cid,score)
   BUILD IMMEDIATE REFRESH COMPLETE ON COMMIT
   DUPLICATE KEY(`sid`, `cid`, `score`)
   DISTRIBUTED BY HASH(`sid`) BUCKETS 1
   PROPERTIES (
   "replication_allocation" = "tag.location.default: 1"
   )
   AS select  `stu`.`sid`, `grade`.`cid`, `grade`.`score` from  `stu` join  
`grade` on  `stu`.`sid` =  `grade`.`sid`
   
   
   "create view stu_view_cte as with a as (select sid from stu) select * from a"
   
   "create view stu_view as select * from stu"
   
   "create view stu_view_1 as select * from stu_view"
   
   "create view stu_view_2 as select * from mv_a join grade using(sid)"
   
   "create view stu_view_3 as select * from stu join grade using(sid);"
   
   "create view stu_view_4 as select * from stu_view_cte"
   
   "create view stu_view_5 as select * from (select sid from mv_b) a join grade 
using(sid);"
   
   "select * from information_schema.view_dependency where view_schema = 
'test_view_dependency_db' order by view_catalog,view_schema,view_name"
   
   
   select * from information_schema.view_dependency where view_schema = 
'test_view_dependency_db' order by view_catalog,view_schema,view_name
   
   mysql> select * from information_schema.view_dependency where view_schema = 
'test_view_dependency_db' order by view_catalog,view_schema,view_name;
   
+--------------+-------------------------+--------------+-------------------+-------------+-------------------------+--------------+-------------------+
   | VIEW_CATALOG | VIEW_SCHEMA             | VIEW_NAME    | VIEW_TYPE         
| REF_CATALOG | REF_SCHEMA              | REF_NAME     | REF_TYPE          |
   
+--------------+-------------------------+--------------+-------------------+-------------+-------------------------+--------------+-------------------+
   | internal     | test_view_dependency_db | mv_a         | MATERIALIZED_VIEW 
| internal    | test_view_dependency_db | stu          | OLAP              |
   | internal     | test_view_dependency_db | mv_b         | MATERIALIZED_VIEW 
| internal    | test_view_dependency_db | mv_a         | MATERIALIZED_VIEW |
   | internal     | test_view_dependency_db | mv_c         | MATERIALIZED_VIEW 
| internal    | test_view_dependency_db | stu          | OLAP              |
   | internal     | test_view_dependency_db | mv_c         | MATERIALIZED_VIEW 
| internal    | test_view_dependency_db | grade        | OLAP              |
   | internal     | test_view_dependency_db | stu_view     | VIEW              
| internal    | test_view_dependency_db | stu          | OLAP              |
   | internal     | test_view_dependency_db | stu_view_1   | VIEW              
| internal    | test_view_dependency_db | stu_view     | VIEW              |
   | internal     | test_view_dependency_db | stu_view_2   | VIEW              
| internal    | test_view_dependency_db | grade        | OLAP              |
   | internal     | test_view_dependency_db | stu_view_2   | VIEW              
| internal    | test_view_dependency_db | mv_a         | MATERIALIZED_VIEW |
   | internal     | test_view_dependency_db | stu_view_3   | VIEW              
| internal    | test_view_dependency_db | stu          | OLAP              |
   | internal     | test_view_dependency_db | stu_view_3   | VIEW              
| internal    | test_view_dependency_db | grade        | OLAP              |
   | internal     | test_view_dependency_db | stu_view_4   | VIEW              
| internal    | test_view_dependency_db | stu_view_cte | VIEW              |
   | internal     | test_view_dependency_db | stu_view_5   | VIEW              
| internal    | test_view_dependency_db | grade        | OLAP              |
   | internal     | test_view_dependency_db | stu_view_5   | VIEW              
| internal    | test_view_dependency_db | mv_b         | MATERIALIZED_VIEW |
   | internal     | test_view_dependency_db | stu_view_cte | VIEW              
| internal    | test_view_dependency_db | stu          | OLAP              |
   
+--------------+-------------------------+--------------+-------------------+-------------+-------------------------+--------------+-------------------+
   ```
   
   ### Release note
   
   None
   
   ### Check List (For Author)
   
   - Test <!-- At least one of them must be included. -->
       - [ ] Regression test
       - [ ] Unit Test
       - [ ] Manual test (add detailed scripts or steps below)
       - [ ] No need to test or manual test. Explain why:
           - [ ] This is a refactor/code format and no logic has been changed.
           - [ ] Previous test can cover this change.
           - [ ] No code files have been changed.
           - [ ] Other reason <!-- Add your reason?  -->
   
   - Behavior changed:
       - [ ] No.
       - [ ] Yes. <!-- Explain the behavior change -->
   
   - Does this need documentation?
       - [ ] No.
       - [ ] Yes. <!-- Add document PR link here. eg: 
https://github.com/apache/doris-website/pull/1214 -->
   
   ### Check List (For Reviewer who merge this PR)
   
   - [ ] Confirm the release note
   - [ ] Confirm test cases
   - [ ] Confirm document
   - [ ] Add branch pick label <!-- Add branch pick label that this PR should 
merge into -->
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to