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

Duplicate Limit in manual Queries #150

Closed
weeco opened this issue Oct 2, 2019 · 7 comments
Closed

Duplicate Limit in manual Queries #150

weeco opened this issue Oct 2, 2019 · 7 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@weeco
Copy link

weeco commented Oct 2, 2019

Bug Report

I want to create a Table which shows the most expensive BigQuery jobs ran by our users/services. Therefore I am forced to use the manual query anyways. My query looks like this:

SELECT UserId, Query, TotalCost
FROM `projectname.billing.bigquery_audit`
WHERE
  $__timeFilter(JobCreateTime)
ORDER BY TotalCost DESC
LIMIT 10

The query fails because of: "invalidQuery: Syntax error: Unexpected keyword LIMIT at [6:10]". That didn't make sense for me and hence I opened the query inspector. There I can see the generated query and that there's a second LIMIT parameter:

query:"SELECT UserId, Query, TotalCost FROM projectname.billing.bigquery_auditWHEREJobCreateTime BETWEEN TIMESTAMP_MILLIS (1567415998923) AND TIMESTAMP_MILLIS (1570007998923) ORDER BY TotalCost DESC LIMIT 10 LIMIT 795"

Expected Behavior

It shouldn't attach any further LIMIT parameter when I have specified an own one.

Actual Behavior

It always appends LIMIT 795, no matter whether I have specified a limit or not. I assume this is only the case when I use "Format as table".

Steps to Reproduce the Problem

Described above.

Specifications

  • Version: 1.0.2
  • Platform: Kubernetes
  • Grafana Version: 6.4.0
@avivl
Copy link
Contributor

avivl commented Oct 2, 2019

It looks you are missing a time field in the query

@weeco
Copy link
Author

weeco commented Oct 2, 2019

Can you eloborate that? I am using the time filter macro and it seems like it does what I expected (see the where condition)

@weeco
Copy link
Author

weeco commented Oct 9, 2019

@avivl bump

@avivl
Copy link
Contributor

avivl commented Oct 10, 2019

In your select statement you should have a time filed(timestamp, datetime etc)

@weeco
Copy link
Author

weeco commented Oct 10, 2019

@avivl Why is that necessary? If I remove the LIMIT in my query it works completely fine (but I get hundreds of rows).

@avivl
Copy link
Contributor

avivl commented Oct 10, 2019

I tried it without any problems.
Can you try to recreate the visualization?

@weeco
Copy link
Author

weeco commented Oct 10, 2019

I have recreated the visualization but the issue is still exactly the same. I have attached a screenshot. Adding a time field hasn't helped either btw..

Screenshot 2019-10-10 at 14 50 40

@avivl avivl self-assigned this Oct 13, 2019
@avivl avivl added the bug Something isn't working label Oct 13, 2019
@avivl avivl added this to the 1.0.3 milestone Oct 13, 2019
@avivl avivl closed this as completed in 662d501 Oct 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants