Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error querying the database: clickhouse: unsupported column type "JSON" #1021

Open
luis-munoz opened this issue Oct 17, 2024 · 2 comments
Open

Comments

@luis-munoz
Copy link

luis-munoz commented Oct 17, 2024

What happened:

A query executed through the Grafana datasource fails with error: clickhouse: unsupported column type "JSON" but if I run this exact query from the clickhouse client CLI, it works fine.

What you expected to happen:

How to reproduce it (as minimally and precisely as possible):

I used the following query:

SELECT timestamp as "time", log FROM "k8s"."dist_pod_logs" WHERE ( time >= $__fromTime AND time <= $__toTime ) ORDER BY time ASC LIMIT 10

My table definition is:

SET allow_experimental_full_text_index = true;
SET allow_experimental_json_type = 1

CREATE TABLE IF NOT EXISTS k8s.pod_logs ON CLUSTER logs
(
    timestamp DateTime,
    log JSON,
    host LowCardinality(String),
    pod_name LowCardinality(String),
    severity LowCardinality(String),
    message String CODEC(ZSTD(1)),
    INDEX inv_idx(message) TYPE full_text(0) GRANULARITY 1
)
Engine = MergeTree
ORDER BY tuple(host, pod_name, timestamp)
TTL timestamp + toIntervalDay(8);

CREATE TABLE IF NOT EXISTS k8s.dist_pod_logs ON CLUSTER logs
(
    timestamp DateTime,
    log JSON,
    host LowCardinality(String),
    pod_name LowCardinality(String),
    severity LowCardinality(String),
    message String CODEC(ZSTD(1))
)
ENGINE = Distributed('logs', 'k8s', 'pod_logs', rand());

Anything else we need to know?:

Environment:*

  • Grafana version: Grafana v10.3.3
  • Plugin version: 4.4.0
  • OS Grafana is installed on: Kubernetes (1.29) / AWS Linux
  • User OS & Browser: Linux / Chrome
  • Clickhouse version: 24.9.2
  • Others:

Does the behavior got resolved on 4.5.0?, I couldn't find any references to it

@jpfortune
Copy link

I'm also running into this Issue

@SpencerTorres
Copy link
Collaborator

The new experimental JSON type is not yet supported in the Go driver, and therefore not supported in the plugin

You can work around this by casting the entire JSON column from JSON to String (SELECT log::String), or by casting the individual field from Dynamic to whatever type the underlying field is known to be (SELECT log.some_field::Int64)

We are working to update both the Go driver and Grafana plugin to support these new types. I'll close this for now since it's not a bug.

Thanks!

@taleena taleena closed this as not planned Won't fix, can't repro, duplicate, stale Nov 7, 2024
@mshustov mshustov reopened this Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants