IMSMWU/RClickhouse

insert hangs

Closed this issue · 6 comments

Hi,

The following hangs at the insert statment

dbExecute(con,"CREATE TABLE tag_join(`id` UInt32) ENGINE = Log()")
dbExecute(con,"INSERT INTO tag_join VALUES (1);")

@giko45 Thanks for reporting this bug. dbExecute calls dbSendQuery behind the scenes, which seem to hang. We'll investigate it and fit it as soon as possible.

Thanks!

Hi,

we investigated this issue in more detail. It is related to the Clickhouse-cpp client, which is used in the background. Insert queries seem to return "data" on the wire protocol, which is discarded per default in case of the insert-command (see [1] for details). However, when you use the sendQuery/execute interface directly, it is not discarded, but blocks (the cpp client waits for data which is never received).

In consequence, it cannot be directly fixed by us, but it could be targeted by the Clickhouse-cpp colleagues (https://github.com/artpaul/clickhouse-cpp). This behaviour is induced by the use of the dbExecute command for inserts. A easy "hot fix" would be to use dbWriteTable/dbAppendTable instead.

dbWriteTable/dbAppendTable works fine for my case, Thanks!

Author of clickhouse-cpp is here.

This is not a bug. There is just no way to pass values inside textual part of an insert query when the raw TCP protocol is used. All values should be given as a block, and there is an "Insert" method in the client.

@artpaul thanks for clarification! I'll close this issue for now.