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

Scan error on Nullable( Enum(..) ): converting NULL to string is unsupported #807

Open
sergey-v9 opened this issue Apr 19, 2024 · 0 comments
Labels
datasource/ClickHouse type/bug Something isn't working

Comments

@sergey-v9
Copy link

For the nullable enum column (in this case, 'status') Query Builder fails to select the column as is and displays the error message:
sql: Scan error on column index 2, name "status": converting NULL to string is unsupported: Could not process SQL results

As a workaround, this can be fixed by manually wrapping the enum column with toString() function in SQL Editor.

Sample table to reproduce:

CREATE TABLE test_nullable_enum
(
    timestamp DateTime64, 
    id String(64),
    status Nullable(
        Enum(
            'Success' = 1,
            'Fail' = 2
        )
    )
) ENGINE = MergeTree
ORDER BY id;

INSERT INTO test_nullable_enum (timestamp, id, status) VALUES ('2024-04-18 00:00:00.000', 'i0', NULL);
INSERT INTO test_nullable_enum (timestamp, id, status) VALUES ('2024-04-18 11:11:11.000', 'i1', 'Success');
INSERT INTO test_nullable_enum (timestamp, id, status) VALUES ('2024-04-18 22:22:22.000', 'i2', 'Fail');

SELECT * FROM test_nullable_enum;

Screenshots

image

image

image

Environment:

  • Grafana version: v10.4.2 (701c851be7) Docker image grafana/grafana-oss:10.4.2
  • Plugin version: 4.0.6
  • OS Grafana is installed on: linux/amd64 (Docker for Windows)
  • User OS & Browser: Windows 11, Google Chrome 124
@sergey-v9 sergey-v9 added datasource/ClickHouse type/bug Something isn't working labels Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datasource/ClickHouse type/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant