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

[FEATURE] Support compound expression in Stats aggregation #819

Open
LantaoJin opened this issue Oct 28, 2024 · 0 comments
Open

[FEATURE] Support compound expression in Stats aggregation #819

LantaoJin opened this issue Oct 28, 2024 · 0 comments
Labels
enhancement New feature or request Lang:PPL Pipe Processing Language support

Comments

@LantaoJin
Copy link
Member

Is your feature request related to a problem?
Query stats max(age) by country works but stats max(age) / 2 by country doesn't.
Q8 in tpch:

	sum(case
		when nation = 'BRAZIL' then volume
		else 0
	end) / sum(volume) as mkt_share

could be straightforwardly rewritten to

stats sum(case(nation = 'BRAZIL', volume else 0)) / sum(volume) as mkt_share by o_year

But we haven't support compound expression in aggregation. So as a workaround, we have to change it to:

| stats sum(case(nation = 'BRAZIL', volume else 0)) as sum_case, sum(volume) as sum_volume by o_year
| eval mkt_share = sum_case / sum_volume
| fields mkt_share, o_year

What solution would you like?
A clear and concise description of what you want to happen.

What alternatives have you considered?
A clear and concise description of any alternative solutions or features you've considered.

Do you have any additional context?
Add any other context or screenshots about the feature request here.

@LantaoJin LantaoJin added enhancement New feature or request untriaged Lang:PPL Pipe Processing Language support and removed untriaged labels Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Lang:PPL Pipe Processing Language support
Projects
None yet
Development

No branches or pull requests

1 participant