Claus Ibsen created CAMEL-26150:
-----------------------------------

             Summary: camel-clickhouse - query results in binary formats 
(RowBinary, Native, Parquet) are corrupted by decoding them as UTF-8 text
                 Key: CAMEL-26150
                 URL: https://issues.apache.org/jira/browse/CAMEL-26150
             Project: Camel
          Issue Type: Bug
            Reporter: Claus Ibsen
             Fix For: 4.24.0


Found while adding the catalog body types of clickhouse (CAMEL-24961, PR 
#28393).

h4. 1. Query results in binary formats are corrupted

{{ClickHouseProducer.doQuery}} (main 2a465aa4814c, line 160) reads the response 
stream into {{new String(bytes, UTF_8)}} whatever the {{format}} is. With a 
binary format such as RowBinary, Native or Parquet, the bytes that are not 
valid UTF-8 are replaced, so the body cannot be decoded and no error is raised. 
Checked on 4.24.0-SNAPSHOT with ClickHouse 26.9 in Docker.

Proposed: set the body as byte[] (or an InputStream) for binary formats, and 
keep a String for text formats.

h4. 2. Inserting a List of Maps, or of POJOs that are not registered, fails 
with an NPE

{{ClickHouseProducer.insertList}} (main 2a465aa4814c, line 127) passes the List 
to {{client.insert(target, data, settings)}}. client-v2 only supports POJOs 
whose class was registered with the client, so a List of Maps or of other POJOs 
fails with a NullPointerException inside client-v2 that does not say why. 
Checked on 4.24.0-SNAPSHOT with ClickHouse 26.9 in Docker.

Proposed: check the element type before the call and fail with a clear message 
(Maps not supported, POJO class not registered).

h4. 3. Doc: CamelClickHouseReadRows is the rows the server read, not the rows 
returned

{{ClickHouseConstants.READ_ROWS}} (main 2a465aa4814c, lines 34-35) is described 
as "The number of rows read by a query operation", and {{doQuery}} (line 163) 
sets it from {{response.getReadRows()}}, which is the number of rows the server 
scanned. For a query with a WHERE or a LIMIT this is not the number of rows in 
the result. Checked on 4.24.0-SNAPSHOT with ClickHouse 26.9 in Docker.

Proposed: describe the header as the rows the server read (scanned), not the 
rows returned.

_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to