This repository has been archived by the owner on Dec 11, 2022. It is now read-only.
$__timeGroupAlias(timestamp, $__interval) not working for 1m (minute) -> becomes 1 month instead #343
Labels
duplicate
This issue or pull request already exists
Bug Report
There seems to be an issue translating the interval value of '1m' (which means 1 minute) in $__timeGroupAlias(timestamp, $__interval).
The generated BQ query translates '1m' in $__interval to 1 month instead of 1 minute. (It does translate '1min' to 1 minute, but that only works when hardcoding '1min' in the query, whereas I would like to use the $__interval variable (which holds i.e. 1s / 1m / 10m / 1d/ 10d/ 1y etc.
Expected Behavior
When $__interval=1m I expect the generated query for
$__timeGroupAlias(timestamp, $__interval)
to be:
SELECT
TIMESTAMP_SECONDS(DIV(UNIX_SECONDS(timestamp), 60) * 60) AS time,
Actual Behavior
$__timeGroupAlias(timestamp, $__interval) gets translated to this when $__interval=1m (1 minute) :
SELECT
TIMESTAMP( (PARSE_DATE( "%Y-%m-%d",CONCAT( CAST((EXTRACT(YEAR FROM timestamp)) AS STRING),'-',CAST((EXTRACT(MONTH FROM timestamp)) AS STRING),'-','01')))) AS time,
Steps to Reproduce the Problem
Freshly installed Grafana 8.0.1 (or 7.5.5, same issue) with only Google BigQuery plugin using any query containing timeGroupAlias :
SELECT
$__timeGroupAlias(timestamp, $__interval),
FROM project.bqdataset.table
WHERE
$__timeFilter(timestamp)
Specifications
The text was updated successfully, but these errors were encountered: