[ 
https://issues.apache.org/jira/browse/CAMEL-27950?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen updated CAMEL-27950:
--------------------------------
    Description: 
Found while improving the option descriptions of camel-duckdb for CAMEL-23832 
(commit 
https://github.com/apache/camel/commit/bad83878ac9bc088cb788df6bdc3ddc8def71f1a,
 pull request https://github.com/apache/camel/pull/31192).
These are separate problems of the component; the descriptions change only 
documents the current behavior.

h4. 1. resultFormat=JSON fails on date, timestamp, uuid, struct and list columns
{{DuckDbResultSetMapper.toJson}}: Jsoner.serialize throws 
IllegalArgumentException ("isn't JSON serializable") for values that are not 
String, Number, Boolean, Map, Collection or array; with duckdb_jdbc 2.0.0.1 
DATE gives LocalDate, TIMESTAMP gives java.sql.Timestamp and UUID gives 
java.util.UUID, so such queries fail.
Proposed change: convert other values to String (ISO text for java.time and 
Timestamp, toString for UUID), or map DuckDBArray/DuckDBStruct to List/Map; add 
a test.

h4. 2. Insert of a list of maps drops keys
{{DuckDbInsertSupport.insertMaps}} takes the column list from the keys of the 
first Map only: keys that only later rows have are dropped silently; only the 
first element is checked to be a Map, so a later non-Map fails with 
ClassCastException.
Proposed change: check every element, and fail when the key sets differ (or use 
the union of the keys).

h4. 3. Smaller issues
An unknown CamelDuckDbOperation value fails with the raw "No enum constant" 
IllegalArgumentException. The @UriPath databasePath has no defaultValue, while 
the default is :memory:. format=auto only recognizes .csv, .parquet and .json 
(not .csv.gz, .jsonl, .ndjson). The component dataSource option is autowired, 
so a single DataSource in the registry is used by every duckdb endpoint instead 
of databasePath or jdbcUrl.


_Claude Code on behalf of davsclaus_

  was:
Found while improving the option descriptions of camel-duckdb for CAMEL-23832 
(pull request https://github.com/apache/camel/pull/31192).
These are separate problems of the component; the descriptions change only 
documents the current behavior.

h4. 1. resultFormat=JSON fails on date, timestamp, uuid, struct and list columns
{{DuckDbResultSetMapper.toJson}}: Jsoner.serialize throws 
IllegalArgumentException ("isn't JSON serializable") for values that are not 
String, Number, Boolean, Map, Collection or array; with duckdb_jdbc 2.0.0.1 
DATE gives LocalDate, TIMESTAMP gives java.sql.Timestamp and UUID gives 
java.util.UUID, so such queries fail.
Proposed change: convert other values to String (ISO text for java.time and 
Timestamp, toString for UUID), or map DuckDBArray/DuckDBStruct to List/Map; add 
a test.

h4. 2. Insert of a list of maps drops keys
{{DuckDbInsertSupport.insertMaps}} takes the column list from the keys of the 
first Map only: keys that only later rows have are dropped silently; only the 
first element is checked to be a Map, so a later non-Map fails with 
ClassCastException.
Proposed change: check every element, and fail when the key sets differ (or use 
the union of the keys).

h4. 3. Smaller issues
An unknown CamelDuckDbOperation value fails with the raw "No enum constant" 
IllegalArgumentException. The @UriPath databasePath has no defaultValue, while 
the default is :memory:. format=auto only recognizes .csv, .parquet and .json 
(not .csv.gz, .jsonl, .ndjson). The component dataSource option is autowired, 
so a single DataSource in the registry is used by every duckdb endpoint instead 
of databasePath or jdbcUrl.


_Claude Code on behalf of davsclaus_


> camel-duckdb: JSON results fail on date, timestamp and uuid columns, 
> list-of-maps insert drops keys
> ---------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-27950
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27950
>             Project: Camel
>          Issue Type: Bug
>            Reporter: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.25.0
>
>
> Found while improving the option descriptions of camel-duckdb for CAMEL-23832 
> (commit 
> https://github.com/apache/camel/commit/bad83878ac9bc088cb788df6bdc3ddc8def71f1a,
>  pull request https://github.com/apache/camel/pull/31192).
> These are separate problems of the component; the descriptions change only 
> documents the current behavior.
> h4. 1. resultFormat=JSON fails on date, timestamp, uuid, struct and list 
> columns
> {{DuckDbResultSetMapper.toJson}}: Jsoner.serialize throws 
> IllegalArgumentException ("isn't JSON serializable") for values that are not 
> String, Number, Boolean, Map, Collection or array; with duckdb_jdbc 2.0.0.1 
> DATE gives LocalDate, TIMESTAMP gives java.sql.Timestamp and UUID gives 
> java.util.UUID, so such queries fail.
> Proposed change: convert other values to String (ISO text for java.time and 
> Timestamp, toString for UUID), or map DuckDBArray/DuckDBStruct to List/Map; 
> add a test.
> h4. 2. Insert of a list of maps drops keys
> {{DuckDbInsertSupport.insertMaps}} takes the column list from the keys of the 
> first Map only: keys that only later rows have are dropped silently; only the 
> first element is checked to be a Map, so a later non-Map fails with 
> ClassCastException.
> Proposed change: check every element, and fail when the key sets differ (or 
> use the union of the keys).
> h4. 3. Smaller issues
> An unknown CamelDuckDbOperation value fails with the raw "No enum constant" 
> IllegalArgumentException. The @UriPath databasePath has no defaultValue, 
> while the default is :memory:. format=auto only recognizes .csv, .parquet and 
> .json (not .csv.gz, .jsonl, .ndjson). The component dataSource option is 
> autowired, so a single DataSource in the registry is used by every duckdb 
> endpoint instead of databasePath or jdbcUrl.
> _Claude Code on behalf of davsclaus_



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

Reply via email to