liutang123 opened a new issue #4922:
URL: https://github.com/apache/incubator-doris/issues/4922


   Like follow SQL:
   
   ```
   create table testT(
   `dt` bigint(20) NULL ,
   `dt_name` bigint(20) NULL ,
   `wk` bigint(20) NULL ,
   `wk_name` varchar(100) NULL,
   `expose_uv` bitmap BITMAP_UNION NULL
   ) ENGINE=OLAP
   AGGREGATE KEY(`dt`, `dt_name`, `wk`, `wk_name`) 
   PARTITION BY RANGE(`dt_name`)
   (PARTITION p20190701 VALUES [("19700101"), ("20190701")),
   PARTITION p20190702 VALUES [("20190701"), ("20190702")),
   PARTITION p20190703 VALUES [("20190702"), ("20190703")),
   PARTITION p20190704 VALUES [("20190703"), ("20190704")),
   PARTITION p20201105 VALUES [("20201104"), ("20201105")))
   DISTRIBUTED BY HASH(`wk_name`) BUCKETS 3
   PROPERTIES (
   "replication_num" = "3",
   "in_memory" = "false",
   "storage_format" = "DEFAULT"
   );
   insert into testT (dt, dt_name, expose_uv)     values (19700101, 19700101, 
to_bitmap(1));
   insert into testT (dt, dt_name, expose_uv)     values (20190701, 20190701, 
to_bitmap(1));
   insert into testT (dt, dt_name, expose_uv)     values (20190702, 20190702, 
to_bitmap(1));
   insert into testT (dt, dt_name, expose_uv)     values (20190703, 20190703, 
to_bitmap(1));
   insert into testT (dt, dt_name, expose_uv)     values (20201104, 20201104, 
to_bitmap(1));
   explain SELECT dt_name,
                  count(DISTINCT expose_uv) AS expose_uv
             FROM testT
            WHERE dt in(20190703, 20201104)
              and ((dt_name>=20190703 AND dt_name<=20190703) or 
(dt_name>=20201104 AND dt_name<=20201104))
   GROUP BY dt_name;
   ```
   The plan is as follows:
   
![image](https://user-images.githubusercontent.com/17537020/99546447-5f708980-29f1-11eb-950f-c227c118e8f8.png)
   
   We can use `((dt_name>=20190703 AND dt_name<=20190703) or (dt_name>=20201104 
AND dt_name<=20201104))` to prune partitions.


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