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

timeInterval doesn't work for month granularity #911

Closed
mzealey opened this issue Jul 18, 2024 · 3 comments
Closed

timeInterval doesn't work for month granularity #911

mzealey opened this issue Jul 18, 2024 · 3 comments
Labels

Comments

@mzealey
Copy link

mzealey commented Jul 18, 2024

I'm using $__timeInterval and want to get a monthly summary (changeable to daily etc via drop-down variable). However because it's using a simple seconds since epoch calculation it comes out with grouping on 16/17 of month at present.

A $__timeIntervalStartOf type macro would be really useful that uses the toStartOfInterval function to produce the expected/correct result in this case.

@SpencerTorres
Copy link
Collaborator

I want to avoid adding too many macros like this, especially when ClickHouse has functions built in for these types of time operations.

Can you show me an example of a query you would write with the macro vs without the macro? You should be able to use the other macros/variables to accomplish this, such as $__fromTime and $__toTime. This will give you a DateTime value that you can plug into the ClickHouse functions.

Thanks for the suggestion!

@SpencerTorres SpencerTorres added enhancement New feature or request and removed type/bug Something isn't working labels Jul 19, 2024
@mzealey
Copy link
Author

mzealey commented Jul 19, 2024

This sounds reasonable, however it is a real pain (if even possible) to convert the interval from grafana (either seconds or 1M format) into "interval 1 month". So perhaps a $__intervalSql type variable that does this?

@SpencerTorres
Copy link
Collaborator

Good point, we actually have an issue open for this (#528)

We can close this issue in favor of that one since it's already been triaged as a feature request

@github-project-automation github-project-automation bot moved this from Incoming to Done in Partner Datasources Jul 19, 2024
@taleena taleena closed this as not planned Won't fix, can't repro, duplicate, stale Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

No branches or pull requests

3 participants