zhangayqian edited a comment on pull request #1088:
URL: https://github.com/apache/kylin/pull/1088#issuecomment-640479276
## Design test cases
### Prepare test env
- create cube and build segment `2012-01-01~2012-02-01`
- dimension: PART_DT, OPS_REGION, SELLER_ID
- measure: count_distinct(SELLER_ID)
### Test Case 1 (For Union in intersect_count())
- Query-1
```
select
intersect_count(SELLER_ID, OPS_REGION, array['Hongkong']) as h,
intersect_count(SELLER_ID, OPS_REGION, array['Beijing']) as b,
intersect_count(SELLER_ID, OPS_REGION, array['Shanghai']) as s,
intersect_count(SELLER_ID, OPS_REGION, array['Hongkong', 'Beijing']) as
retention_city1
from kylin_sales
```
- Query-2
```
select
intersect_count(SELLER_ID, OPS_REGION, array['Hongkong']) as h,
intersect_count(SELLER_ID, OPS_REGION, array['Beijing']) as b,
intersect_count(SELLER_ID, OPS_REGION, array['Shanghai']) as s,
intersect_count(SELLER_ID, OPS_REGION, array['Shanghai', 'Beijing']) as
retention_city2
from kylin_sales
```
- Query-3
```
select
intersect_count(SELLER_ID, OPS_REGION, array['Hongkong']) as h,
intersect_count(SELLER_ID, OPS_REGION, array['Beijing']) as b,
intersect_count(SELLER_ID, OPS_REGION, array['Shanghai']) as s,
intersect_count(SELLER_ID, OPS_REGION, array['Shanghai', 'Hongkong',
'Beijing']) as retention_city3
from kylin_sales
```
- Query-4
```
select
intersect_count(SELLER_ID, OPS_REGION, array['Hongkong']) as h,
intersect_count(SELLER_ID, OPS_REGION, array['Beijing']) as b,
intersect_count(SELLER_ID, OPS_REGION, array['Shanghai']) as s,
intersect_count(SELLER_ID, OPS_REGION, array['Hongkong|Shanghai',
'Beijing']) as retention_city
from kylin_sales
```
- Expect result
```
retention_city == retention_city1 + retention_city2 - retention_city3
```
### Test Case 2 (For Intersect_value())
```
select
intersect_value(SELLER_ID, OPS_REGION, array['Shanghai', 'Hongkong'
,'Beijing']) as retention_city
from kylin_sales
```
----------------------------------------------------------------
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:
[email protected]