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 rule to convert filter to range when possible #385

Open
wolffcm opened this issue Dec 5, 2018 · 2 comments
Open

Implement rule to convert filter to range when possible #385

wolffcm opened this issue Dec 5, 2018 · 2 comments

Comments

@wolffcm
Copy link

wolffcm commented Dec 5, 2018

If a user enters a query like

from(bucket: "telegraf") |> filter(fn: (r) => r._time >= now() - 1h)

It will fail planning because there is no range to push down. However, the filter is semantically equivalent to a range and should be rewritten as such:

from(bucket: "telegraf") |> range(start: -1h)

The rule should be made to handle reasonable expressions using relational operators and the _time column.

This would be a logical rule defined in filter.go.

@nathanielc
Copy link
Contributor

Note, that currently the binary operators like == and >= are not defined for time values. This will need to address that.

@wolffcm
Copy link
Author

wolffcm commented Feb 6, 2019

range will create _start and _stop columns, and filter does not. Should the rule also generate a drop node to drop these columns?

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

No branches or pull requests

2 participants