wangbo commented on issue #4788:
URL: 
https://github.com/apache/incubator-doris/issues/4788#issuecomment-717767146


   **User instructions**
   **1 create table**
   ```
   CREATE TABLE example_db.rolup_index_table
       (
           event_day DATE,
           siteid INT DEFAULT '10',
           citycode SMALLINT,
           username VARCHAR(32) DEFAULT '',
           pv BIGINT SUM DEFAULT '0'
       )
       AGGREGATE KEY(event_day, siteid, citycode, username)
       DISTRIBUTED BY HASH(siteid) BUCKETS 10
       rollup (
       r1(event_day,siteid) distributed by hash(event_day) buckets 5, //  
rollup r1 use user specified distribution
       r3(event_day) // user not specify distribution info here , so use 
default distribution
       )
       PROPERTIES("replication_num" = "1");
   ```
   **2 add rollup**
   only support add rollup when table has no data
   case 1: user specify distribution
   ```
   alter table rolup_index_table add rollup r1(event_day,siteid) distributed by 
hash(event_day) buckets 5;
   ```
   case 2: user not specify distribution info,so use default distribution info
   ```
   alter table rolup_index_table add rollup r1(event_day,siteid);
   ```
   
   **3 add partition**
   only support modify bucket num
   case 1:   modify bucket num
   ```
   alter table rolup_index_table add p1 partition values 
[(2017,2018),[2018,2019))
     rollup (r1 distributed by hash(k1,k2) bucket 3)
   ```
   case 2:  use default distribution info
   ```
   alter table rolup_index_table add p1 partition values 
[(2017,2018),[2018,2019))  
   ```
   
   **Current limitation and will be supported in the feature**
    * Only can add rollup when table is empty
    * Not Support colocate join
    * Not Support Materialized view
    * Not Support Restore
    * Not Support Spark Load
   
   **Persistence Data Structure When Write to Edit Log**
   **1 OlapTable**
   ```
   Add a field:    Map<Long, DistributionInfo> indexIdToDistributionInfo, 
key=indexId,value=rollup's distribution
   indexIdToDistributionInfo only keep rollup's distribution
   If a rollup's distribution can't be found in indexIdToDistributionInfo, it 
use defaultDistribution
   ```
   **2 Partition**
   ```
   Add a field:    Map<Long, DistributionInfo> indexIdToDistributionInfo, 
key=indexId,value=rollup's distribution
   indexIdToDistributionInfo only keep rollup's distribution
   If a rollup's distribution can't be found in indexIdToDistributionInfo, it 
use defaultDistribution
   ```


----------------------------------------------------------------
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.

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