You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2023/01/12 03:01:34 UTC

[GitHub] [doris] adonis0147 opened a new pull request, #15849: [feature-wip](MTMV) Support table aliases when creating a materialized view with multiple tables

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

   ## Use Case
   
   ```shell
   mysql> CREATE TABLE t_user (
       ->   event_day DATE,
       ->   id bigint,
       ->   username varchar(20)
       -> )
       -> DISTRIBUTED BY HASH(id) BUCKETS 10
       -> PROPERTIES ('replication_num' = '1');
   Query OK, 0 rows affected (0.07 sec)
   
   mysql> CREATE TABLE t_user_pv(
       ->   event_day DATE,
       ->   id bigint,
       ->   pv bigint
       -> )
       -> DISTRIBUTED BY HASH(id) BUCKETS 10
       -> PROPERTIES ('replication_num' = '1');
   Query OK, 0 rows affected (0.09 sec)
   
   mysql> CREATE MATERIALIZED VIEW mv
       -> BUILD IMMEDIATE REFRESH COMPLETE
       -> START WITH "2022-10-27 19:35:00"
       -> NEXT 1 SECOND
       -> KEY (username)
       -> DISTRIBUTED BY HASH(username) BUCKETS 10
       -> PROPERTIES ('replication_num' = '1')
       -> AS SELECT t1.username ,t2.pv FROM t_user t1 LEFT JOIN t_user_pv t2 on t1.id = t2.id;
   Query OK, 0 rows affected (0.10 sec)
   
   mysql> DESC mv;
   +----------+-------------+------+-------+---------+-------+
   | Field    | Type        | Null | Key   | Default | Extra |
   +----------+-------------+------+-------+---------+-------+
   | username | VARCHAR(20) | Yes  | true  | NULL    |       |
   | pv       | BIGINT      | Yes  | false | NULL    | NONE  |
   +----------+-------------+------+-------+---------+-------+
   2 rows in set (0.02 sec)
   ```
   
   ## Checklist(Required)
   
   1. Does it affect the original behavior: 
       - [ ] Yes
       - [x] No
       - [ ] I don't know
   2. Has unit tests been added:
       - [x] Yes
       - [ ] No
       - [ ] No Need
   3. Has document been added or modified:
       - [ ] Yes
       - [x] No
       - [ ] No Need
   4. Does it need to update dependencies:
       - [ ] Yes
       - [x] No
   5. Are there any changes that cannot be rolled back:
       - [ ] Yes (If Yes, please explain WHY)
       - [x] No
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
   
   


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] hello-stephen commented on pull request #15849: [feature-wip](MTMV) Support table aliases when creating a materialized view with multiple tables

Posted by GitBox <gi...@apache.org>.
hello-stephen commented on PR #15849:
URL: https://github.com/apache/doris/pull/15849#issuecomment-1379763280

   TeamCity pipeline, clickbench performance test result:
    the sum of best hot time: 36.6 seconds
    load time: 511 seconds
    storage size: 17120766663 Bytes
    https://doris-community-test-1308700295.cos.ap-hongkong.myqcloud.com/tmp/20230112032342_clickbench_pr_78142.html


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] yangzhg commented on a diff in pull request #15849: [feature-wip](MTMV) Support table aliases when creating a materialized view with multiple tables

Posted by GitBox <gi...@apache.org>.
yangzhg commented on code in PR #15849:
URL: https://github.com/apache/doris/pull/15849#discussion_r1068869019


##########
fe/fe-core/src/main/java/org/apache/doris/analysis/CreateMultiTableMaterializedViewStmt.java:
##########
@@ -43,7 +46,7 @@ public class CreateMultiTableMaterializedViewStmt extends CreateTableStmt {
     private final MVRefreshInfo refreshInfo;
     private final QueryStmt queryStmt;
     private Database database;
-    private final Map<String, OlapTable> olapTables = Maps.newHashMap();
+    private List<TableRef> tableRefs;

Review Comment:
   why use list, map maybe better, use alias or tablename as key



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] adonis0147 commented on a diff in pull request #15849: [feature-wip](MTMV) Support table aliases when creating a materialized view with multiple tables

Posted by GitBox <gi...@apache.org>.
adonis0147 commented on code in PR #15849:
URL: https://github.com/apache/doris/pull/15849#discussion_r1068887951


##########
fe/fe-core/src/main/java/org/apache/doris/analysis/CreateMultiTableMaterializedViewStmt.java:
##########
@@ -43,7 +46,7 @@ public class CreateMultiTableMaterializedViewStmt extends CreateTableStmt {
     private final MVRefreshInfo refreshInfo;
     private final QueryStmt queryStmt;
     private Database database;
-    private final Map<String, OlapTable> olapTables = Maps.newHashMap();
+    private List<TableRef> tableRefs;

Review Comment:
   Refined.



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #15849: [feature-wip](MTMV) Support table aliases when creating a materialized view with multiple tables

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #15849:
URL: https://github.com/apache/doris/pull/15849#issuecomment-1381753717

   PR approved by anyone and no changes requested.


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #15849: [feature-wip](MTMV) Support table aliases when creating a materialized view with multiple tables

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #15849:
URL: https://github.com/apache/doris/pull/15849#issuecomment-1381753655

   PR approved by at least one committer and no changes requested.


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] adonis0147 merged pull request #15849: [feature-wip](MTMV) Support table aliases when creating a materialized view with multiple tables

Posted by GitBox <gi...@apache.org>.
adonis0147 merged PR #15849:
URL: https://github.com/apache/doris/pull/15849


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org