Claus Ibsen created CAMEL-26149:
-----------------------------------
Summary: camel-duckdb - the query option replaces a non-empty body
though documented for an empty body, and COPY rejects a Path or byte[] body
Key: CAMEL-26149
URL: https://issues.apache.org/jira/browse/CAMEL-26149
Project: Camel
Issue Type: Bug
Reporter: Claus Ibsen
Fix For: 4.24.0
Found while adding the catalog body types of duckdb (CAMEL-24961, PR #28393).
h4. 1. The query option replaces a non-empty body
The {{query}} option is described as "Static SQL for query when the message
body is empty." ({{DuckDbEndpoint}}, main 2a465aa4814c, line 60), but
{{DuckDbProducer.resolveSql}} (line 192) takes the {{CamelDuckDbQuery}} header,
then the {{query}} option, and the body only when both are empty. So with the
option set, a non-empty body is ignored. Checked on 4.24.0-SNAPSHOT with an
embedded DuckDB.
Proposed: either use the option only when the body is empty, or change the
description to say that it takes precedence over the body.
h4. 2. A SELECT with operation execute, or DDL with operation query, fails
without a hint
{{DuckDbProducer.doExecute}} (main 2a465aa4814c, line 70) runs
{{executeUpdate}} and {{doQuery}} (line 82) runs {{executeQuery}}. Sending a
SELECT with the default {{execute}} operation, or DDL with {{query}}, fails
with the plain DuckDB driver error, which does not say that the operation is
the cause. Checked on 4.24.0-SNAPSHOT with an embedded DuckDB.
Proposed: add a hint to the error, e.g. "use operation=query for a statement
that returns rows".
h4. 3. COPY rejects a Path and a byte[] body
{{DuckDbProducer.resolveFilePath}} (main 2a465aa4814c, lines 165-176) accepts
only a {{File}}, a {{WrappedFile}} or a non-empty String, so a
{{java.nio.file.Path}} body or a byte[] holding the path fails with "Copy
operation expects a file path in the message body (File or String)". Checked on
4.24.0-SNAPSHOT with an embedded DuckDB.
Proposed: accept a Path, and convert other bodies to a String with the type
converter.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)