Skip to content

ClickhouseStatementImpl.executeUpdate does not throw on server error #836

@rzeigler

Description

@rzeigler

We have a specific use case where we send queries that construct temporaries that are used in subsequent queries. We have discovered that ClickhouseStatementImpl.executeWrite does not appear to throw correctly in the face of malformed CTAS statements (or possibly other remote failures).

What we observe is that we see something akin to the following in our logs (I added a specific nonsense column)

14:57:04.487 [qtp90045638-50] ERROR c.c.j.i.ClickHouseStatementImpl - can not close stream: Code: 47, e.displayText() = DB::Exception: Missing columns: 'frobfrob' while processing query: ' ... ' (version 21.4.1.1)
, server ClickHouseNode(addr=http:localhost:8123, db=default)@-713711043

Subsequently trying to reference the table is where we actually get the raised exception. This makes diagnosing the faulty queries challenging.

https://github.com/ClickHouse/clickhouse-jdbc/blob/master/clickhouse-jdbc/src/main/java/com/clickhouse/jdbc/internal/ClickHouseStatementImpl.java#L279
Inspecting the executeWrite this appears to be an attempt to swallow errors when closing the connection fails for some reason, however it seems like other errors are bubbling out and being swallowed as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions