Fix parsing of quoted identifiers#499
Conversation
d828028 to
4197ed0
Compare
slabko
left a comment
There was a problem hiding this comment.
Hi @IyeOnline, can you please move the TupleWithQuotedFieldNamesFromServer test to a more appropriate place.
Additionally column and tuple names can have ` in their names. For example:
Tuple(`a\`b` UInt8, `a``b` UInt8)
|
@IyeOnline did you check the case with inserting data to tables with tuples like // create table test_tuple (
// id UInt64,
// value Tuple(`a.b` Int8)
// )
// engine = MergeTree
// order by id
auto block = client.BeginInsert("INSERT INTO test_tuple VALUES");
auto col_id = block.At(0)->AsStrict<ColumnUInt64>();
auto col_tuple = block.At(1)->AsStrict<ColumnTuple>();
auto col_value = col_tuple->At(0)->AsStrict<ColumnInt8>();
col_id->Append(1);
col_id->Append(2);
col_value->Append(5);
col_value->Append(7);
block.RefreshRowCount();
client.SendInsertBlock(block);
client.EndInsert();Gives From what I can see the library does not wrap the names when sending them to the server:
|
Previously a type such as
Tuple( `a.b` Int8)
would fail to parse. This would cause `Client::Impl::ReadBlock` to throw
an "unsupported column type" exception, even though this is a valid
ClickHouse type and supported by the library.
This fix introduces a new token type for quoted identifiers and uses this
tuples. A dedicated token type seems a semantically cleaner choice, because
formally there could be cases where `Name` would be accepted, but a
quoted identifier would not be allowed.
4197ed0 to
1da3346
Compare
|
@slabko I did discover this while trying to send data to a table with a Tuple like that (with the table previously generated from a JSON schema that used such a key) With this fix, it works there. I will look into why it doesnt work in the simple standalone case tomorrow. |
|
It turns out my our code actually didn't sent blocks with column names on the type as that code predates support for that. We just created the table with the named fields. |

Previously a type such as
would fail to parse. This would cause
Client::Impl::ReadBlockto throwan "unsupported column type" exception, even though this is a valid
ClickHouse type and supported by the library.
This fix introduces a new token type for quoted identifiers and uses this
tuples. A dedicated token type seems a semantically cleaner choice, because
formally there could be cases where
Namewould be accepted, but aquoted identifier would not be allowed.
This is effectively a followup to #491