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

Implement pivot for selectors and raw queries in the transpiler #10746

Closed
jsternberg opened this issue Sep 11, 2018 · 2 comments
Closed

Implement pivot for selectors and raw queries in the transpiler #10746

jsternberg opened this issue Sep 11, 2018 · 2 comments
Labels

Comments

@jsternberg
Copy link
Contributor

This is a more specific issue than #707 which this issue is based on.

#764 describes the behavior of using pivot to select multiple fields and place them into a single row rather than generate multiple from statements and using join to combine them. We will need to implement that behavior for selectors and raw queries that contain multiple fields.

We will also probably need the transpiler to be schema-aware or we will need the query engine planner to be capable of optimizing out the unnecessary pivot when we generate the following:

... |> filter(fn: (r) => r._measurement == "cpu" and (r._field == "usage_user" or r._field == "host")) |> pivot(rowKey: ["_time"], colKey: ["_field"], valueCol: "_value")

The planner could potentially use the schema information to recognize that r._field == "host" will always be false. Then it rewrites the filter to be just r._measurement == "cpu" and r._field == "usage_user". Then it recognizes that the pivot is pivoting on a column that will only feasibly have one value and it can be replaced with a rename to the proper column name.

That, or the transpiler can become schema-aware and generate the correct filter. I like the idea of the planner doing it because it would be a good test of a more complicated optimization, but making the transpiler schema-aware is probably more simple.

@mark-rushakoff mark-rushakoff transferred this issue from another repository Jan 10, 2019
@stale
Copy link

stale bot commented Jul 23, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jul 23, 2019
@stale
Copy link

stale bot commented Jul 30, 2019

This issue has been automatically closed because it has not had recent activity. Please reopen if this issue is still important to you. Thank you for your contributions.

@stale stale bot closed this as completed Jul 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant