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 aggregate function state_agg #1422

Closed
ZuoTiJia opened this issue Aug 11, 2023 · 0 comments
Closed

[Feature] Support aggregate function state_agg #1422

ZuoTiJia opened this issue Aug 11, 2023 · 0 comments
Labels
component/function component/query documentation Improvements or additions to documentation

Comments

@ZuoTiJia
Copy link
Contributor

Describe the solution you'd like
A clear and concise description of what you want to happen.

The duration_in function can be used to specify the time interval for the aggregation result of state_agg.

create table if not exists states(state STRING);
insert into states values
('2020-01-01 10:00:00', 'starting'),
('2020-01-01 10:30:00', 'running'),
('2020-01-03 16:00:00', 'error'),
('2020-01-03 18:30:00', 'starting'),
('2020-01-03 19:30:00', 'running'),
('2020-01-05 12:00:00', 'stopping');
select duration_in(state_agg(time, state), 'running') from states;
-- 0 years 0 mons 3 days 22 hours 0 mins 0.000000000 secs
select duration_in(state_agg(time, state), 'running', Timestamp '2020-01-01 11:00:00');
-- 0 years 0 mons 3 days 21 hours 30 mins 0.000000000 secs
@ZuoTiJia ZuoTiJia added the sql implement sql statement label Aug 11, 2023
@ZuoTiJia ZuoTiJia changed the title Support aggregate function state_agg [Feature] Support aggregate function state_agg Aug 11, 2023
@ZuoTiJia ZuoTiJia added documentation Improvements or additions to documentation component/query component/function and removed sql implement sql statement labels Aug 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/function component/query documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant