grafana / google-bigquery-datasource

Google BigQuery Datasource Plugin for Grafana.
Apache License 2.0
26 stars 13 forks source link

Support for fill parameter in $__timeGroup macro (3rd argument) #128

Open carlosflorencio opened 2 years ago

carlosflorencio commented 2 years ago

Hi,

I don't think this argument is being respected, can anyone confirm?

I'm trying the following query but the graph doesn't seem to fill the 0's when the $__timeGroup has the 3rd argument.

SELECT
  $__timeGroup(timestamp, $__interval, 0) as time,
  count(document_id) as users
FROM
  `project.firestore_export.users_raw_changelog`
WHERE
  operation = "CREATE" and $__timeFilter(timestamp)
group by time
order by time
image

The setting Connect null values doesn't seem to have any effect either.

Are there other options to fill the 0's (like transformations or similar?) without involving generating the missing data points on the BigQuery side?

Thanks

carlosflorencio commented 2 years ago

Okay after inspecting the code it seems the functionality is not implemented.

Current $__timeGroup macro implementation https://github.com/grafana/google-bigquery-datasource/blob/main/pkg/bigquery/macros.go#L20

PR when this feature was added to the MySQL and Postgres datasources: https://github.com/grafana/grafana/pull/10138

HbirdJ commented 2 months ago

BigQuery hasn't historically supported gap-filling until some time series features launched earlier this year. It's a powerful feature but does not look like a straightforward integration with $__timeGroup

https://cloud.google.com/bigquery/docs/working-with-time-series#fill_gaps_with_linear_and_locf_gap_filling