clickhouse-datasource icon indicating copy to clipboard operation
clickhouse-datasource copied to clipboard

Regression in `LowCardinality(Nullable(String))` type processing in v4.0.5

Open btmc opened this issue 10 months ago • 2 comments

What happened:

Trying to select a column of aforementioned type returns an error:

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

It seems to be a regression of #785, wherein the regexp for "Nullable(String)" Converter has been changed to match on the beginning of string only, thus not matching LowCardinality(Nullable(String)) anymore (and in this case default Converter is used and that is probably the cause of the error).

I've downgraded datasource version to v4.0.4 to corroborate that and the error indeed disappeared.


What you expected to happen:

No errors.


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

In Explore view:

select
    toNullable('test')
;

OK

select
    toLowCardinality('test')
;

OK

select
    toLowCardinality(
        toNullable('test'))
;

Error:

sql: Scan error on column index 0, name "toLowCardinality(toNullable('test'))": unsupported Scan, storing driver.Value type *string into type *string: Could not process SQL results

Environment:

v4.0.6, grafana v10.4.1

btmc avatar Apr 19 '24 11:04 btmc

@SpencerTorres As you were involved in the PR that @btmc linked to above, would you be able to comment on this? As they rightly point out, ^ matches the start of string, meaning that nesting within LowCardinality() would indeed break after this PR was merged.

adamyeats avatar Apr 22 '24 11:04 adamyeats

Good find. This is a case I failed to identify when I reviewed the first PR, although I was suspicious. We can add some unit tests for this and maybe a different set of regexs for LowCardinality().

Downgrading to v4.0.4 is the correct workaround for now

SpencerTorres avatar Apr 22 '24 19:04 SpencerTorres