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

   # Proposed changes
   
   Issue Number: close #xxx
   
   ## Problem summary
   
   impl import data to multi table materialized view table,mainly include four 
steps
   1、create tmp table
   2、insert data to tmp table though insert into select stmt
   3、swap tmp table with origin table
   4、update task info and wrtie log
   
   ```
   create table t_user(
        event_day DATE,
        id bigint,
        username varchar(20)
   )
   DISTRIBUTED BY HASH(id) BUCKETS 10 
   PROPERTIES (
      "replication_num" = "1"
    );
   insert into  t_user values("2022-10-26",1,"clz");
   insert into  t_user values("2022-10-28",2,"zhangsang");
   insert into  t_user values("2022-10-29",3,"lisi");
   create table t_user_pv(
       event_day DATE,
       id bigint,
       pv bigint
   )
   DISTRIBUTED BY HASH(id) BUCKETS 10 
   PROPERTIES (
      "replication_num" = "1"
    );
   insert into  t_user_pv  values("2022-10-26",1,200);
   insert into  t_user_pv  values("2022-10-28",2,200);
   insert into  t_user_pv  values("2022-10-28",3,300);
   ```
   ### create multi view table 
   ```
   DROP MATERIALIZED VIEW  if exists multi_mv;
   CREATE MATERIALIZED VIEW  multi_mv
   BUILD IMMEDIATE 
   REFRESH COMPLETE 
   start with "2022-10-27 19:35:00"
   next  60 second
   KEY(username)   
   DISTRIBUTED BY HASH (username)  buckets 1
   PROPERTIES ('replication_num' = '1') 
   AS 
   select t_user.username, t_user_pv.pv  from t_user, t_user_pv where 
t_user.id=t_user_pv.id;
   ```
   ## show mtmv task \G
   <img width="892" alt="image" 
src="https://user-images.githubusercontent.com/11487604/202708285-baaa082e-62ef-4ff4-9a34-04a3f36e16be.png";>
   <img width="360" alt="image" 
src="https://user-images.githubusercontent.com/11487604/202708355-f0df8e70-df86-462e-ab37-cb6d91b35951.png";>
   
   ## search run log
   grep --color ${taskid} fe.log
   
![image](https://user-images.githubusercontent.com/11487604/202710580-057e74e5-1b85-4879-beff-aa1f8d73d9e7.png)
   
   
   
   
   ## Checklist(Required)
   
   1. Does it affect the original behavior: 
       - [ ] Yes
       - [ ] No
       - [ ] I don't know
   2. Has unit tests been added:
       - [ ] Yes
       - [ ] No
       - [ ] No Need
   3. Has document been added or modified:
       - [ ] Yes
       - [ ] No
       - [ ] No Need
   4. Does it need to update dependencies:
       - [ ] Yes
       - [ ] No
   5. Are there any changes that cannot be rolled back:
       - [ ] Yes (If Yes, please explain WHY)
       - [ ] No
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at 
[d...@doris.apache.org](mailto:d...@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-unsubscr...@doris.apache.org

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


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

Reply via email to