Description
When retrieving a column, whose type is array, the inferred type is always Object[]; for example, it should be Long[] for Array(Int64).
Steps to reproduce
See code below.
Error Log or Exception StackTrace
See failing test below.
Expected Behaviour
Test should pass.
Code Example
@Test
void required_testJdbcWithArray() throws Exception {
final String url = "jdbc:ch://localhost:8123";
final Properties info = new Properties();
info.put("user", "default");
info.put("password", "");
try (final Connection conn = DriverManager.getConnection(url, info)) {
conn.prepareStatement("CREATE TABLE test_array_table"
+ " (id Int64, array_field Array(Int64)) ENGINE = MergeTree() ORDER BY id").execute();
conn.prepareStatement("INSERT INTO test_array_table VALUES (1, [1,2,3])").execute();
try (final Statement tableStatement = conn.createStatement();
final ResultSet resultSet = tableStatement.executeQuery("SELECT `array_field` FROM `test_array_table`")) {
resultSet.next();
final Array columnValue = resultSet.getArray(1);
// The 2 assertions below should pass: instead we retrieve Object[]
Assertions.assertThat(columnValue.getArray()).isExactlyInstanceOf(Long[].class);
Assertions.assertThat(JDBCType.valueOf(columnValue.getBaseType())).isEqualTo(JDBCType.BIGINT);
}
}
}
Configuration
Client Configuration
See above.
Environment
ClickHouse Server
- ClickHouse Server version: 25.3.3.42
- ClickHouse Server non-default settings, if any:
CREATE TABLE statements for tables involved:
- Sample data for all these tables, use clickhouse-obfuscator if necessary
Description
When retrieving a column, whose type is array, the inferred type is always
Object[]; for example, it should beLong[]forArray(Int64).Steps to reproduce
See code below.
Error Log or Exception StackTrace
See failing test below.
Expected Behaviour
Test should pass.
Code Example
Configuration
Client Configuration
See above.
Environment
ClickHouse Server
CREATE TABLEstatements for tables involved: