clickhouse icon indicating copy to clipboard operation
clickhouse copied to clipboard

Nullable fields

Open workgena opened this issue 8 years ago • 3 comments

Recently Yandex added support for Nullable types. But this gem does not support them.

Nullable fields are not documented yet. Some info can be found here

I forked gem and fixed this issue: https://github.com/workgena/clickhouse/pull/1/files https://github.com/workgena/clickhouse/pull/2/files

I'll try to write some test on this and create PR later.

workgena avatar May 29 '17 11:05 workgena

@archan937 , can this be merged?

Fivell avatar Jun 29 '17 08:06 Fivell

@workgena, have you been able to create any documentation regarding the use cases for, and the behavior of the Nullable feature? Let me know if you need any help typing something up.

cerealcoder avatar Feb 15 '18 15:02 cerealcoder

Aside from fixing NULL on select, NULLs on INSERT still won't be handled well with the CSVWithNames format that the ruby driver uses due to this existing issue: https://github.com/yandex/ClickHouse/issues/469

I'm unable to insert where the schema says the field is Nullable and the record passed to Clickhouse.connection.insert_rows has a null value. Attempting the same insert with clickhouse-client CLI with a few different variations of "NULL", e.g. empty string, \N, gives same error.

FWIW, the JSONRows import format handles nulls fine, so modifying Clickhouse.connection.insert_rows to use that if there's a nil valued field is a way to make it work.

clarsen avatar May 30 '19 20:05 clarsen