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

Columns with dots cause query error #247

Closed
thecodeassassin opened this issue Jun 10, 2020 · 2 comments · Fixed by #267
Closed

Columns with dots cause query error #247

thecodeassassin opened this issue Jun 10, 2020 · 2 comments · Fixed by #267

Comments

@thecodeassassin
Copy link

thecodeassassin commented Jun 10, 2020

Bug Report

Expected Behavior

Being able to add aggregation on columns

Actual Behavior

400 Error

{
  "error": {
    "code": 400,
    "message": "Syntax error: Expected \")\" or \",\" but got \".\" at [2:33]",
    "errors": [
      {
        "message": "Syntax error: Expected \")\" or \",\" but got \".\" at [2:33]",
        "domain": "global",
        "reason": "invalidQuery",
        "location": "q",
        "locationType": "parameter"
      }
    ],
    "status": "INVALID_ARGUMENT"
  }
}

GraphQL Query

standardSQL↵SELECT *  EXCEPT (tmphttpRequest.status) From ↵ (↵SELECT↵ `timestamp` AS time,↵  CAST (`resource`.`type`AS String ) AS metric,↵  `httpRequest`.`status` as tmphttpRequest.status, (CASE WHEN `httpRequest`.`status` >= lag(`httpRequest`.`status`) OVER (PARTITION BY timestamp,resource.type ORDER BY `timestamp`) THEN `httpRequest`.`status` - lag(`httpRequest`.`status`) OVER (PARTITION BY timestamp,resource.type ORDER BY `timestamp`) WHEN lag(`httpRequest`.`status`) OVER (PARTITION BY timestamp,resource.type ORDER BY `timestamp`) IS NULL THEN NULL ELSE `httpRequest`.`status` END)/(UNIX_SECONDS(`timestamp`) -UNIX_SECONDS(  lag(`timestamp`) OVER (PARTITION BY timestamp,resource.type ORDER BY `timestamp`))) AS httpRequest.status↵FROM `mls-production.loadbalancer_metrics.requests`↵WHERE↵  `timestamp` BETWEEN TIMESTAMP_MILLIS (1591816612290) AND TIMESTAMP_MILLIS (1591820212290))↵GROUP BY 1,2,3  LIMIT 2110"
useLegacySql: false
useQueryCache: true

Steps to Reproduce the Problem

  1. Create a bigquery table with dots in the column names
  2. Try to add an aggregate function to the column name

This was done using the query builder.

Specifications

  • Version: 1.0.7
  • Platform: Hosted grafana
  • Grafana Version: Grafana v7.0.2 (d3c725e4ff)
@Tamirk
Copy link

Tamirk commented Jul 30, 2020

@thecodeassassin is the field you are trying to exclude is part of a repeated field?
Can you try to change this:

SELECT *

to this

SELECT *, tmphttpRequest.*

and let us know if it solves your problem

@thecodeassassin
Copy link
Author

thecodeassassin commented Jul 30, 2020

@Tamirk Just fyi it doesn't matter really because this is a result from the query builder. If I manually enter the queries I had no issues.

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

Successfully merging a pull request may close this issue.

2 participants