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

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

Closed
linjunzhe opened this issue May 16, 2024 · 3 comments
Assignees

Comments

@linjunzhe
Copy link

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:
@linjunzhe
Copy link
Author

Hi, could anyone help?

@SpencerTorres
Copy link
Collaborator

Apologies, I thought this was resolved in #805 + #814

If it's still an issue I can try reproducing the error and seeing why the fix isn't working in this case.

At the cost of losing some newer patches, you can downgrade to v4.0.4 and this should be fixed. The change that was made in v4.0.5 may have caused this regression.

@SpencerTorres
Copy link
Collaborator

Should be fixed and released in the related PR. Let me know if you're still having issues after updating. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

3 participants