Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aggregate Dim Col Feature #438

Open
pranavbhole opened this issue Apr 18, 2019 · 1 comment
Open

Aggregate Dim Col Feature #438

pranavbhole opened this issue Apr 18, 2019 · 1 comment

Comments

@pranavbhole
Copy link
Contributor

Requirement is that we want to query count of section_id that student belongs to. Currently maha does not support the rollup expressions on the dimension columns in the fact.

Example query is:

student_id, count(distinct section_id) as NumberOfSections
from student_perf 
group by student_id

Plan is to create a new derived column called DerAaggregatedDimCol which will have rollup expression along with the derived expression. And respective engine query generator will take care of rendering it. Tricky part is to exclude it from the group by expressions only if base col is not used by any other requested cols or dependent derived cols.
As this is experimental feature, i am planning to start it from hive/presto query generator.

let me know if you have any suggestions and questions.

@pranavbhole
Copy link
Contributor Author

Example Generated Query from hive core test

FROM(
SELECT COALESCE(account_id, 0L) advertiser_id, COALESCE(keyword_id, 0L) keyword_id, COALESCE(impressions, 0L) mang_impressions, COALESCE(mang_keyword_count, 0L) mang_keyword_count, COALESCE(mang_keyword_count_scaled, 0L) mang_keyword_count_scaled
FROM(SELECT account_id, keyword_id, (COUNT(distinct keyword_id)) mang_keyword_count, (COUNT(keyword_id * stats_source * 10)) mang_keyword_count_scaled, SUM(impressions) impressions
FROM s_stats_fact
WHERE (account_id = 12345) AND (stats_date >= '2019-04-17' AND stats_date <= '2019-04-24')
GROUP BY account_id, keyword_id

       )
ssf0

)```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@pranavbhole and others