Skip to content

[client-v2] NativeFormatReader fails for non-null values of Nullable(String) #3137

Closed

Description

@donats11

I am using client-v2 0.10.0 with ClickHouseFormat.Native.

Given a table:

CREATE TABLE test_table
(
    id String,
    optionalValue Nullable(String)
)
ENGINE = MergeTree
ORDER BY id;

Working query

This works:

SELECT optionalValue
FROM test_table
WHERE optionalValue IS NULL;

Failing query

This fails:

SELECT optionalValue
FROM test_table
WHERE optionalValue IS NOT NULL;

with:

ClientException: Failed to read block
Caused by: EOFException: End of stream reached before reading all data
    at NativeFormatReader.readBlock(...)

Workaround

Casting the column to String works:

SELECT CAST(optionalValue AS String) AS optionalValue
FROM test_table;

Java code

QuerySettings settings =
        new QuerySettings().setFormat(ClickHouseFormat.Native);

try (QueryResponse response =
             client.query(sqlQuery, settings).get()) {

    NativeFormatReader reader =
            (NativeFormatReader) client.newBinaryFormatReader(response);
}

Environment

  • client-v2: 0.10.0
  • ClickHouse server: 25.9.3.48
  • Java: 21

Activity

  1. added this to the 0.11.0 milestone on Sep 17, 2026
  2. chernser commented on Sep 17, 2026

    @chernser
    Contributor

    Thank you for reporting @donats11 !

  3. added
    area:client-read
    on Sep 25, 2026
  4. chernser commented on Sep 25, 2026

    @chernser
    Contributor

    @polyglotAI-bot

    • verify this is an issue
    • fix the issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area:client-readbug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions