-
Notifications
You must be signed in to change notification settings - Fork 615
Open
Labels
area:jdbc-metadataissue handling metadata things like getting type of columnissue handling metadata things like getting type of columnbugjdbc-v2jdbc-v2 issuesjdbc-v2 issues
Milestone
Description
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
- Cloud
- Client version:
- Language version:
- OS:
ClickHouse Server
- ClickHouse Server version: 25.3.3.42
- ClickHouse Server non-default settings, if any:
CREATE TABLEstatements for tables involved:- Sample data for all these tables, use clickhouse-obfuscator if necessary
enqueue and dolfinus
Metadata
Metadata
Assignees
Labels
area:jdbc-metadataissue handling metadata things like getting type of columnissue handling metadata things like getting type of columnbugjdbc-v2jdbc-v2 issuesjdbc-v2 issues