Skip to content

Intermittent decoding failure for Array(Map(LowCardinality(String), String)) — works on driver 0.6.3, fails on 0.8.6 / 0.9.4 #2657

@Schum-io

Description

@Schum-io

On ClickHouse client/driver versions 0.8.6 and 0.9.4, reading a column of type:

Array(Map(LowCardinality(String), String))

fails with:

[HY000] Failed to read value for column traits
array element type mismatch

The same query on the same dataset using driver 0.6.3 always works correctly.

The failure is non-deterministic: the query may succeed once and fail on the next attempt without any data changes. This matches real production behavior where this error “happens every other run”.

This issue appears specifically when the column is located inside a Nested structure in real data, but the failure also reproduces with a plain column in a minimal table.

Environment

  • ClickHouse server: 25.10.1.3832 and 25.6.12.10
  • Client/driver:
  • 0.9.4 — fails intermittently
  • 0.8.6 — fails intermittently
  • 0.4.6 — always works (no failures)
  • 0.6.3 — always works (no failures)

Steps to reproduce

CREATE TABLE reproduce_table
(
    StartedDateTime DateTime,
    traits Array(Map(LowCardinality(String), String))
)
ENGINE = MergeTree
ORDER BY StartedDateTime;
INSERT INTO reproduce_table (StartedDateTime, traits) VALUES
(
    '2025-11-11 00:00:01',
    [
        map(),
        map(
            'RandomKey1','Value1',
            'RandomKey2','Value2',
            'RandomKey3','Value3',
            'RandomKey4','Value4',
            'RandomKey5','Value5',
            'RandomKey6','Value6',
            'RandomKey7','Value7',
            'RandomKey8','Value8'
        ),
        map(), map(), map(), map(), map(), map()
    ]
);
SELECT traits
FROM reproduce_table

Expected Behaviour

[{}, {'RandomKey1': 'Value1', 'RandomKey2': 'Value2', 'RandomKey3': 'Value3', 'RandomKey4': 'Value4', 'RandomKey5': 'Value5', 'RandomKey6': 'Value6', 'RandomKey7': 'Value7', 'RandomKey8': 'Value8'}, {}, {}, {}, {}, {}, {}]

Actual behavior

[HY000] Failed to read value for column traits
array element type mismatch

Additional detail: the issue is triggered only when empty maps (map()) are present

While testing, we discovered that the decoding failure appears only if the Array(Map(...)) contains empty maps — i.e. map() with zero key/value pairs.

If all maps inside the array are non-empty, the error does not reproduce, even across multiple blocks and different LowCardinality dictionaries.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions