ClickHouse-Net icon indicating copy to clipboard operation
ClickHouse-Net copied to clipboard

LowCardinality(Nullable(String)) doesn't work

Open Tjon92 opened this issue 4 years ago • 3 comments

Description

Если в запросе присутствует поле с типом LowCardinality(Nullable(String)), то запрос просто зависает

Steps to reproduce

Использую для запросов конструкции из ваших примеров и до использования полей LowCardinality(Nullable(String)) всё работало отлично. Теперь же происходит просто зависание. Причем сначала отжирается резко несколько гигов оперативки.

Не работает ни такая конструкция:

do { while (reader.Read()) { } } while (reader.NextResult());

Ни такая:

                    reader.ReadAll(r =>
                    {
                        result.Add(reader.GetString(0));
                    });

Tjon92 avatar Mar 25 '21 11:03 Tjon92

Можно более конкретный пример? Нужна структура таблицы, нужен SQL запрос который виснет.

killwort avatar Aug 09 '21 10:08 killwort

Running into the same problem. I had a column of Nullable(String) type. When I changed the column to LowCardinality(Nullable(String)), I get the following error

System.InvalidOperationException: Received unknown packet type Hello from server.    at ClickHouse.Ado.Impl.ProtocolFormatter.ReadPacket(Response rv)    at 
ClickHouse.Ado.Impl.ProtocolFormatter.ReadResponse()    at ClickHouse.Ado.ClickHouseDataReader.Close()    at ClickHouse.Ado.ClickHouseDataReader.Dispose()
--

sandeeppnaik avatar Feb 22 '23 06:02 sandeeppnaik

Looks like support for LowCardinality<Nullable<Something>> is completely broken in clickhouse itself. https://www.tinybird.co/blog-posts/tips-10-null-behavior-with-lowcardinality-columns https://github.com/ClickHouse/ClickHouse/issues/8406

I've implemented reading and writing of these types without regard to NULLs as they state in the docs, yet it sometimes eat up the first value on insert. Reads are OK though.

For now I think that's sufficient, I don't really understand the need to keep NULL and '' values distinct whilst saying it has 'low cardinality'.

killwort avatar Oct 10 '23 12:10 killwort