[
https://issues.apache.org/jira/browse/KYLIN-4314?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17128126#comment-17128126
]
ASF GitHub Bot commented on KYLIN-4314:
---------------------------------------
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]
> Support union in intersect_count() function
> -------------------------------------------
>
> Key: KYLIN-4314
> URL: https://issues.apache.org/jira/browse/KYLIN-4314
> Project: Kylin
> Issue Type: Improvement
> Components: Query Engine
> Reporter: Shao Feng Shi
> Assignee: Shao Feng Shi
> Priority: Minor
> Fix For: v3.1.0, v2.6.6
>
>
> The current version of "intersect_count" only support "intersect" operation.
> While in some cases, we may union some collections(bitmaps) first, and then
> intersect with other collections. For example:
>
> intersect_count(user_id, page_id, array['search', 'view', 'order']);
> -- this calculation how many users did "search", and then "view", and then
> make the "order".
>
> intersect_count(user_id, page_id, array['search|view', 'order']);
> -- this calculation how many users did "search" or "view" (any of them) , and
> then make the "order".
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)