Skip to content

Commit

Permalink
Merge pull request #9489 from Mause/bugfix/jdbc-decimal-array
Browse files Browse the repository at this point in the history
fix(jdbc): support decimal arrays
  • Loading branch information
Mytherin committed Oct 27, 2023
2 parents b7260c7 + 6e4c90d commit 6a5db27
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Expand Up @@ -34,7 +34,7 @@ public DuckDBResultSetMetaData(int param_count, int column_count, String[] colum
this.column_types = column_types_al.toArray(this.column_types);

for (String column_type_detail : this.column_types_details) {
if (column_type_detail.startsWith("DECIMAL")) {
if (TypeNameToType(column_type_detail) == DuckDBColumnType.DECIMAL) {
column_types_meta.add(DuckDBColumnTypeMetaData.parseColumnTypeMetadata(column_type_detail));
} else {
column_types_meta.add(null);
Expand Down
5 changes: 5 additions & 0 deletions tools/jdbc/src/test/java/org/duckdb/test/TestDuckDBJDBC.java
Expand Up @@ -3287,6 +3287,11 @@ public static void test_list() throws Exception {
assertTrue(rs.next());
assertTrue(arrayToList(rs.getArray(1)).isEmpty());
}

try (ResultSet rs = statement.executeQuery("SELECT [0.0]::DECIMAL[]")) {
assertTrue(rs.next());
assertEquals(arrayToList(rs.getArray(1)), singletonList(new BigDecimal("0.000")));
}
}
}

Expand Down

0 comments on commit 6a5db27

Please sign in to comment.