ClickHouse / clickhouse-java

ClickHouse Java Clients & JDBC Driver
https://clickhouse.com
Apache License 2.0
1.43k stars 529 forks source link

Return java.sql.Struct for Tuple types instead of java.util.ArrayList in ClickHouse JDBC driver #1764

Open maxim-lixakov opened 1 month ago

maxim-lixakov commented 1 month ago

Currently, the ClickHouse JDBC driver returns java.util.ArrayList for Tuple types within ClickHouseTupleValue. This can create complications when integrating with java applications that interact with JDBC and expect structured data to be represented as java.sql.Struct.

Returning java.sql.Struct instead of java.util.ArrayList would be more consistent with JDBC standards and simplify integration with tools like Spark.

Below is the DDL used to create the table that demonstrates this issue:


CREATE TABLE tuple_table (
    tupleColumn Tuple(intField Int32, stringField String)
) ENGINE = TinyLog;
clickhouse Tuple_debuger_screen

In the attached screenshot, you can see the structure of the ResultSet returned by the JDBC driver when querying the Tuple column. The result is currently represented as a java.util.ArrayList, as shown in the ClickHouseTupleValue object:

chernser commented 1 month ago

@maxim-lixakov Thank you for pointing it out! We've just started with JDBC refactoring.