Skip to content

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions