Skip to content

Question: How to fetch Array(UInt64) values? #984

@gothug

Description

@gothug

When trying to fetch the column of type Array(UInt64) via Java Http Client, the values in the client's response are of ClickHouseLongArrayValue type, but they do not represent unsigned long values correctly.

Example:

ClickHouseNode endpoint = ClickHouseNode.of("https://localhost");

try (ClickHouseClient client = ClickHouseClient.newInstance(ClickHouseProtocol.HTTP);
ClickHouseResponse response = client.connect(endpoint)
.format(ClickHouseFormat.RowBinaryWithNamesAndTypes)
.query("select array(toUInt64(9223372036854775808))").executeAndWait()) {

for (ClickHouseRecord r : response.records()) {
    String result = String.valueOf(r.getValue(0).asArray()[0]);
    System.out.println(result);
}

}

The result printed is -9223372036854775808, which is not the correct UInt64 number value that was inside the array (it becomes a negative number).

How could I parse the Array(UInt64) columns from CH to get correct results?

Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions