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

One Day Rounding does not work as expected #117

Closed
PeterZaitsev opened this issue Feb 25, 2019 · 3 comments · Fixed by #219
Closed

One Day Rounding does not work as expected #117

PeterZaitsev opened this issue Feb 25, 2019 · 3 comments · Fixed by #219
Assignees
Labels

Comments

@PeterZaitsev
Copy link

I'm plotting statistical data which is available with 1 day resolution. As I configure my query I specify 1d for step and rounding. The data on the graph however ends up not to be one day aligned and confusing:

image

image

Note in the second graph we can see the interval is aligned to 20:00 (as it is on all days) not to 20:00 as it is in the database.

Is there any way to avoid it ?

@albenik
Copy link

albenik commented Jun 3, 2019

Same for me!
I investigated this problem a little bit deeper and found that $timeSeres macro with step 1d produces SQL (intDiv(toUInt32(ts), 86400) * 86400) * 1000 as t which gets different result comparing with handmade SQL toUInt32(dt) * 86400 * 1000 as t

@kbespalov
Copy link

+1 the same issue

@Slach
Copy link
Collaborator

Slach commented Jul 6, 2020

@PeterZaitsev, @albenik, @kbespalov
Hi guys,
this rounding behavior related to grafana core data transformation for time series data, grafana-clickhouse data source plugin pass $timeSeries to grafana as UInt64 timestamp with ms and grafana graph panel transform it to "browser local datetime"

@PeterZaitsev I reproduce your query on #219
and got a following results:
image

image

image

Slach added a commit to Altinity/grafana-plugin-repository that referenced this issue Jul 7, 2020
# 2.0.2 (2020-07-07)

## Enhancements:
* add alerts support for Windows and MacOSX
* improve ad-hoc filters for query field values as `SELECT DISTINCT field AS value FROM db.table LIMIT 300`, Altinity/clickhouse-grafana#222
* add the ability to multiple JOIN parsing Altinity/clickhouse-grafana#206
* multiple improvements for docker-compose environments, add automatic dashboards and data source provisions which help to reproduce most of the corner cases which happens in Grafana + ClickHouse

## Fixes:
* apply a workaround for UTC timezone for Date and DateTime columns in grafana dashboards Altinity/clickhouse-grafana#117
* clear documentation about timestamp term for $from and $to Altinity/clickhouse-grafana#115
* fix AST parsing corner case in `WHERE [test, 'test']` "," was skipped, fix ah-doc AST FROM recursive parsing Altinity/clickhouse-grafana#99
* fix corner cases for table functions parsing when Adhoc filter applied Altinity/clickhouse-grafana#130
* fix multiple grammar issues in README.md
* fix convert rules for Float, Decimal columns from Clickhouse to Grafana Table plugin Altinity/clickhouse-grafana#199
* fix corner cases when Grafana Template variable value represented as an array of strings Altinity/clickhouse-grafana#169
* fix AST parsing corner cases for $macroFunctions correct position for FROM statement Altinity/clickhouse-grafana#187

Signed-off-by: Eugene Klimov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants