Return java.sql.Struct for Tuple types instead of java.util.ArrayList in ClickHouse JDBC driver
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;
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:
- Query Executed:
SELECT "tupleColumn" FROM tuple_table - Returned Type:
java.util.ArrayList
@maxim-lixakov Thank you for pointing it out! We've just started with JDBC refactoring.
Dedicated type Tuple will be in the jdbc-v2.
CC: @mzitnik