ClickHouse/clickhouse-jdbc-bridge

Unable to select postgres/cockroachDB UUID as ClickHouse UUID

sashayakovtseva opened this issue · 2 comments

I am trying try connect cockroachDB to ClickHouse via PostgreSQL jdbc driver.
Cockroach claims to be PostgreSQL compatible, and indeed in go application we work with it using pgx driver. That means, PostgreSQL jdbc driver must work as well (see their docs).

However, it is impossible to query cockroach UUID as ClickHouse UUID type while it is possible to query cockroach UUID as ClickHouse String type (which is not something we want to do).

At first I thought this may be cockroach-specific issue and incompatibility, but the same error is reproducible with PostgreSQL.

The error itself:

Received exception from server (version 22.9.2): Code: 33. DB::Exception: Received from localhost:9000. DB::Exception: Cannot read all data. Bytes read: 5. Bytes expected: 16.: (in file/uri http://clickhouse-jdbc-bridge:9019/?version=1&connection_string=jdbc%3Apostgresql%3A%2F%2Fcockroach%3A26257%2Fdefaultdb&max_block_size=65505): (at row 3) : While executing BinaryRowInputFormat: While executing JDBC. (CANNOT_READ_ALL_DATA) (query: SELECT * from test.cockroach_test_uuid_to_uuid)

Steps to reproduce are described in this repo.
I've also tried custom mapping on jdbc side, but got same error. Steps to reproduce are here.

Hi @sashayakovtseva, thanks for reporting the issue and providing the repo for reproducing the issue. Have you tried workaround like converting string to uuid in ClickHouse?

I have not. My use-case includes JOIN leverage (yes, unfortunately we need joins). So idea was to join by uuid as both clickhouse and cockroach source have columns of that type. As I understand correctly, I would have to call toUUID every time I need to perform that join and this may lead to poor performance. Am I wrong?