Skip to content
This repository has been archived by the owner on Dec 11, 2022. It is now read-only.

Function $__timeGroupAlias doesn't support space in argument #196

Closed
eraac opened this issue Feb 5, 2020 · 6 comments · Fixed by #197
Closed

Function $__timeGroupAlias doesn't support space in argument #196

eraac opened this issue Feb 5, 2020 · 6 comments · Fixed by #197
Labels
enhancement New feature or request
Milestone

Comments

@eraac
Copy link
Contributor

eraac commented Feb 5, 2020

Expected Behavior

Query like this should work

SELECT
  $__timeGroupAlias(usage_start_time, 1d), -- space just before '1d'
  sku.description AS metric,
  SUM(cost) AS cost
FROM
  `$from_dataset`,
  UNNEST(project.labels)
WHERE
  $__timeFilter(usage_start_time)
GROUP BY 1, 2
ORDER BY 1, 2 ASC

If I remove space, that work perfectly fine, but I lost so much time on it ...

Actual Behavior

From query inspector

SELECT TIMESTAMP_SECONDS(DIV(UNIX_SECONDS(`usage_start_time`), 0) * 0), sku.description AS metric, SUM(cost) AS cost FROM `*****`, UNNEST(project.labels) WHERE `usage_start_time` BETWEEN TIMESTAMP_MILLIS (1577833200000) AND TIMESTAMP_MILLIS (1580511599999) GROUP BY 1, 2 ORDER BY 1, 2 ASC LIMIT 1440

Error: invalidQuery: division by zero: 1580328000 / 0

Steps to Reproduce the Problem

  1. Create simple query with $__timeGroupAlias(column,<space>1d)

Specifications

  • Version: Latest (master)
  • Platform: Linux
  • Grafana Version: 6.5.2
@avivl
Copy link
Contributor

avivl commented Feb 5, 2020

@eraac I'm not sure I understand why are you losing time on removing space. I would think that you will be losing time on typing it

@eraac
Copy link
Contributor Author

eraac commented Feb 5, 2020

@avivl I lost time to find the issue, I was stuck with "invalidQuery" for a while due of the "extra" space

@avivl avivl added the wontfix This will not be worked on label Feb 5, 2020
@avivl avivl closed this as completed Feb 5, 2020
@eraac
Copy link
Contributor Author

eraac commented Feb 5, 2020

Any reason to not fix this? Is two lines of code and all official datasources with __timeGroupAlias function support this space; what about consistency?

@avivl
Copy link
Contributor

avivl commented Feb 5, 2020

You are more than welcome to issue a pull request

eraac added a commit to eraac/bigquery-grafana that referenced this issue Feb 5, 2020
@ptomasroos
Copy link
Contributor

Same here. Had such problems getting it working. And didn’t release it was the space that was causing a issue. Well spotted

@avivl avivl added enhancement New feature or request and removed wontfix This will not be worked on labels Feb 6, 2020
@avivl avivl added this to the 1.0.6 milestone Feb 6, 2020
avivl added a commit that referenced this issue Feb 6, 2020
@avivl
Copy link
Contributor

avivl commented Apr 6, 2020

@eraac I'll stop maintaining this data source in a couple of weeks.
@Tamirklein and his team will take over.
I would also like to thank you for your involvement and contribution to this project

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants