You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DuckDBArrayResultSet uses accessors of DuckDBVector to retrieve values. getInt and others however return a scalar type, i.e. int getInt(int idx) throws SQLException. The assignment to wasNull in org.duckdb.DuckDBArrayResultSet#getValue checking whether value was null will always return false, hence wasNull() will return the wrong result.
I tested 1.5.5.0 only, but expect similar results with older version and on all other scalar types:
Reproducer:
curl -O https://repo1.maven.org/maven2/org/duckdb/duckdb_jdbc/1.5.5.0/duckdb_jdbc-1.5.5.0.jar
cat <<- 'EOF' > Application.java
import java.sql.DriverManager;
import java.sql.SQLException;
void main() throws SQLException {
try (var connection = DriverManager.getConnection("jdbc:duckdb:");
var stmt = connection.createStatement();
var rs = stmt.executeQuery("SELECT [1, null] AS a");
) {
while (rs.next()) {
var a = rs.getArray("a");
var inner = a.getResultSet();
int i = 0;
inner.next();
var val = inner.getInt(2);
assert val == 1;
inner.next();
val = inner.getInt(2);
assert val == 0;
assert inner.wasNull() : "Array result did wrongly reported null state";
}
}
}
EOF
java --enable-native-access=ALL-UNNAMED -ea -cp duckdb_jdbc-1.5.5.0.jar Application.java
rm Application.java
Will yield
Exception in thread "main" java.lang.AssertionError: Array result did wrongly reported null state
at Application.main(Application.java:20)
I use
java -version
openjdk version "26" 2026-03-17
OpenJDK Runtime Environment Zulu26.28+59-CA (build 26+35)
OpenJDK 64-Bit Server VM Zulu26.28+59-CA (build 26+35, mixed mode, sharing)
Activity
Fix primitive nullability in ArrayResultSet
Fix primitive nullability in ArrayResultSet (1.5)
staticlibs commentedon Aug 25, 2026
Hi, thanks for the report! I added a fix in #839, snapshot with this fix (compatible with 1.5.5 extensions):
michael-simons commentedon Aug 25, 2026
Very nice, thank you!