I have 2 examples with different errors, first one:
using Octonica.ClickHouseClient;
const string connectionString = "Host=localhost;Port=9000;User=default;Password=;";
var connection = new ClickHouseConnection(connectionString);
connection.Open();
var dropTableCommand = connection.CreateCommand("DROP TABLE IF EXISTS test_table");
dropTableCommand.ExecuteNonQuery();
var createTableCommand = connection.CreateCommand(
$"""
CREATE TABLE test_table
(
id Int32,
strings Array(LowCardinality(String))
) ENGINE = MergeTree()
ORDER BY id;
""");
createTableCommand.ExecuteNonQuery();
var columns = new Dictionary<string, object?>
{
{ "id", new[] { 123 } },
{ "strings", new[] { Array.Empty<string>() } }
};
await using var writer = await connection.CreateColumnWriterAsync(
$"insert into test_table(id, strings) values",
CancellationToken.None);
await writer.WriteTableAsync(columns, 1, CancellationToken.None);
I'm getting the error: Octonica.ClickHouseClient.Exceptions.ClickHouseServerException: DB::Exception: Empty query
If I remove LowCardinality, it works fine.
Similar example:
using Octonica.ClickHouseClient;
const string connectionString = "Host=localhost;Port=9000;User=default;Password=;";
var connection = new ClickHouseConnection(connectionString);
connection.Open();
var dropTableCommand = connection.CreateCommand("DROP TABLE IF EXISTS test_table");
dropTableCommand.ExecuteNonQuery();
var createTableCommand = connection.CreateCommand(
$"""
CREATE TABLE test_table
(
id Int32,
strings Array(LowCardinality(String)),
any_field Int32,
) ENGINE = MergeTree()
ORDER BY id;
""");
createTableCommand.ExecuteNonQuery();
var columns = new Dictionary<string, object?>
{
{ "id", new[] { 123 } },
{ "strings", new[] { Array.Empty<string>() } },
{ "any_field", new[] { 321 } }
};
await using var writer = await connection.CreateColumnWriterAsync(
$"insert into test_table(id, strings, any_field) values",
CancellationToken.None);
await writer.WriteTableAsync(columns, 1, CancellationToken.None);
Error: Octonica.ClickHouseClient.Exceptions.ClickHouseServerException
DB::Exception: Syntax error (data type): failed at position 1 (' '): . Unrecognized token: ' '
Hi! After updating from version 3.1.1 to 3.1.2, I encountered an error in saving empty string arrays with LowCardinality.
.net target: 8.0 Docker: clickhouse/clickhouse-server:23.8-alpine
I have 2 examples with different errors, first one:
I'm getting the error: Octonica.ClickHouseClient.Exceptions.ClickHouseServerException: DB::Exception: Empty query If I remove LowCardinality, it works fine.
Similar example:
Error: Octonica.ClickHouseClient.Exceptions.ClickHouseServerException DB::Exception: Syntax error (data type): failed at position 1 (' '): . Unrecognized token: ' '
Also works fine without LowCardinality.