Skip to content

NullPointerException when reading JDBC ResultSet.getDate() from a Timestamp column #146

@lukaseder

Description

@lukaseder

What happens?

This error occurs:

Exception in thread "main" java.lang.NullPointerException: Cannot load from object array because "this.varlen_data" is null
	at org.duckdb.DuckDBVector.getLazyString(DuckDBVector.java:224)
	at org.duckdb.DuckDBVector.getDate(DuckDBVector.java:280)
	at org.duckdb.DuckDBResultSet.getDate(DuckDBResultSet.java:366)
	at org.jooq.testscripts.JDBC.main(JDBC.java:42)

To Reproduce

try (Statement s = connection.createStatement();
    ResultSet rs = s.executeQuery("select now()")
) {
    while (rs.next()) {
        System.out.println(rs.getDate(1));
    }
}

Replace the call to rs.getDate(1) by rs.getTimestamp(1) as a workaround.

Note: I couldn't test with 0.10.1-SNAPSHOT due to duckdb/duckdb#11244

OS:

Microsoft Windows [Version 10.0.22631.3296]

DuckDB Version:

0.10.0

DuckDB Client:

JDBC

Full Name:

Lukas Eder

Affiliation:

Data Geekery

Have you tried this on the latest nightly build?

I have tested with a release build (and could not test with a nightly build)

Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?

  • Yes, I have

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions