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

Query Builder: Add ability to group by columns #15984

Open
hoorayimhelping opened this issue Nov 19, 2019 · 3 comments

Comments

@hoorayimhelping
Copy link
Contributor

@hoorayimhelping hoorayimhelping commented Nov 19, 2019

Related: #15563

It is currently only possible to generate queries of the form

from(bucket: "telegraf")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(<filter>)
  |> aggregateWindow(every: v.windowPeriod, fn: <agg>)

Since flux does a default group by *, it is not possible to apply a different grouping of data before aggregating.

  1. Aggregate all series over time into a single series

group-none-before-agg

More of less the query we'll want to be able to express is

from(bucket: "telegraf")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r._measurement == "cpu")
  |> filter(fn: (r) => r._field == "usage_user")
  |> group()
  |> aggregateWindow(every: v.windowPeriod, fn: mean)
  |> yield(name: "mean")
@hoorayimhelping

This comment has been minimized.

Copy link
Contributor Author

@hoorayimhelping hoorayimhelping commented Nov 20, 2019

POC I whipped up:
in

Chatted with Alex Pax about this on Slack. We both think there needs to be more affordance for switching between Filters and Groups so I'm going to make the Filter / Group a dropdown and allow selecting it.

@hoorayimhelping

This comment has been minimized.

Copy link
Contributor Author

@hoorayimhelping hoorayimhelping commented Nov 27, 2019

Chatted with @mavarius about the design and UX of this. For the first initial pass (what I'm calling Group By 0.5) we're going to add a dropdown to select between filter and group. Adding a new BuilderCard will select filter by default, initially.
Screen Shot 2019-11-27 at 10 49 35 AM

After the initial 0.5 functionality lands, we'll evaluate the best way to change the function with fewer clicks. Some initial thoughts are to have a list of functions to add in place of the single + icon, or a dropdown above Aggregate Functions with a list of functions to add.
Screen Shot 2019-11-27 at 10 50 18 AM

@hoorayimhelping

This comment has been minimized.

Copy link
Contributor Author

@hoorayimhelping hoorayimhelping commented Dec 2, 2019

Related: #16076

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.