Skip to content

[jdbc-v2] incorrect wasNull flag for Array #2266

Closed
@Onajk

Description

@Onajk

Describe the bug

After switching to jdbc-v2 there is a problem of reading Array right after NULL value. After debugging I have discovered that result set of array has wasNull flag set to True which is creating exception on Doobie side which I use to read data from ClickHouse in Scala code.

Steps to reproduce

  1. "SELECT NULL, ['value1', 'value2']"
  2. Check result set for second column (array)

Expected behaviour

In jdbc-v1 for version 0.7.2 there is no wasNull = true flag for that array and I would expect the same for jdbc-v2 for version 0.8.x

Code example

Statement stmt = conn.createStatement();
stmt.executeQuery("""
        SELECT NULL, ['value1', 'value2']
        """);
ResultSet rs = stmt.getResultSet();

And analyze the ResultSet (I don't know the methods since I was checking it in Scala)

Error log

Doobie is returning me NonNullableColumnRead error saying SQL 'NULL' read at column 2 (JDBC type Array) but mapping is to a non-Option type.
I have checked that this error is happening because wasNull flag was True after reading the array. By checking result set I could tell that it has correctly detected that first column is Null and second is array of two String values.

Configuration

"com.clickhouse" % "clickhouse-jdbc" % "0.8.2"

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions