question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AST parse error when query contains remote

See original GitHub issue

I have simple query on single stat panel

SELECT
    toFloat64(sum(bid))
FROM remote('$clickhouse_host', events)
WHERE  and action_type = 'view' AND date >= toStartOfMonth(now())

In browser console i see error

sql_query.ts:86 AST parser error:  TypeError: this.tree[this.rootToken].push is not a function
    at Scanner.push (scanner.ts:79)
    at Scanner.toAST (scanner.ts:118)
    at SqlQuery.replace (sql_query.ts:43)
    at ClickHouseDatasource.createQuery (datasource.ts:135)
    at eval (datasource.ts:85)
    at Qt (lodash.js:639)
    at Function.Ja [as map] (lodash.js:9555)
    at d (lodash.js:16993)
    at Ba (lodash.js:8797)
    at lodash.js:4374

With debugger i found that problem is located in remote function after i delete it and add GROUP BY 1 this issue fixed. Also it’s not obvious that i need GROUP BY statement for single stat panel

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
Slachcommented, Jul 3, 2020

@hagen1778, @minaevmike look like the latest master version works fine with remote() and cluster() functions and template variables inside them I use the following SQL query for remote_host variable:

SELECT DISTINCT concat(host_name, ':', toString(port)) AS remote_host FROM system.clusters |   |   |   |  

image

and following for cluster_name

SELECT DISTINCT cluster FROM system.clusters

image

I will add these examples to clickhouse_dashboard.json

0reactions
hagen1778commented, Jul 7, 2020

Thanks for doing this!

Read more comments on GitHub >

github_iconTop Results From Across the Web

AST parse error when query contains remote #130 - GitHub
I have simple query on single stat panel SELECT toFloat64(sum(bid)) FROM remote('$clickhouse_host', events) WHERE and action_type = 'view' ...
Read more >
why is python's parser throwing errors on this simple input?
This is because you're using mode='eval' , which only works for single expressions. Your code has multiple statements, so use mode='exec' ...
Read more >
ast - Go Packages
Package ast declares Rego syntax tree types and also includes a parser and compiler for preparing policies for execution in the policy ...
Read more >
TPT3291 Invalid assigned value AST node: no column object ...
TPT3291 Invalid assigned value AST node: no column object. The job is terminated. Explanation: A TPT process, task, component or function ...
Read more >
Learn Sangria - Sangria - Scala GraphQL Implementation
QueryAnalysisError - signifies issues in the query or variables. This means that client has made some error. If you are exposing a GraphQL...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found