Skip to content

Clickhouse datasource plugin returns error in Grafana explore page when query with a LowCardinality(Nullable(String)) column #833

@linjunzhe

Description

@linjunzhe

What happened:
It returned an error if a table contains a LowCardinality(Nullable(String)) column.

sql: Scan error on column index 0, name "src_tor_name": unsupported Scan, storing driver.Value type *string into type *string: Could not process SQL results

What you expected to happen:
It should return the data same as clickhouse-client.

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

  1. Create a table with a LowCardinality(Nullable(String)) column, for example
CREATE TABLE pingmesh.test ON CLUSTER staging
(
    `src_tor_name` LowCardinality(Nullable(String)),
    `loss_count` Int64,
    `unixtime` DateTime('Etc/UTC') CODEC(DoubleDelta)
)
ENGINE = ReplicatedMergeTree('/clickhouse/{installation}/{cluster}/tables/{shard}/pingmesh/test', '{replica}')
PARTITION BY toYYYYMMDD(unixtime)
PRIMARY KEY unixtime
ORDER BY unixtime
SETTINGS index_granularity = 8192
  1. Insert some data
INSERT INTO pingmesh.test (*) VALUES ('test', 0, 0)
  1. Query the data from clickhouse client. It works fine.
> SELECT * FROM "pingmesh"."test" LIMIT 10
SELECT *
FROM pingmesh.test
LIMIT 10

Query id: fd6dea33-12b2-4ae2-aaa4-c2e8601742cf

┌─src_tor_name─┬─loss_count─┬────────────unixtime─┐
│ test         │          0 │ 1970-01-01 00:00:00 │
└──────────────┴────────────┴─────────────────────┘

1 row in set. Elapsed: 0.001 sec.
  1. Put the same query in Grafana Explore with Clickhouse datasource.
    image

Screenshots
image
Anything else we need to know?:

  1. I was upgrade Grafana recently to the newest 10.4.3. The previous version I used is 10.2.3, which was working fine.
  2. I tested with Nullable(String) or LowCardinality(String) DEFAULT '' columns, the plugin works as expected.

Environment:

  • Grafana version: 10.4.3
  • Plugin version: 4.0.7
  • OS Grafana is installed on: Grafana official docker image
  • User OS & Browser: macOS 13.5.2, Chrome
  • Others:

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions