Skip to content

Fork CI for ClickHouse/clickhouse-java#3368 - #2

Open
Indian-boult wants to merge 11 commits into
mainfrom
fix/enum-duplicates
Open

Indian-boult wants to merge 11 commits into
mainfrom
fix/enum-duplicates

Conversation

@Indian-boult

Copy link
Copy Markdown
Owner

CI run inside the fork for ClickHouse#3368. This PR only triggers the repository workflows on the same code. It is not for merge.

polyglotAI-bot and others added 11 commits November 17, 2026 08:15
The User-Agent comment group now has an arch:<os.arch> entry after os,
for example (lv:java/17.0.21; os:Linux; arch:amd64; hc:ahc_5.6.4).
Client metadata can set arch to replace the value, as for lv, os and hc.

Implements: ClickHouse#2458

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Client.loadServerInfo() stored the server time zone as a String, but
Client.getServerTimeZone() casts the configuration value to TimeZone.
Every getServerTimeZone() call after loadServerInfo() failed with
ClassCastException.

Store the value through ClientConfigProperties.SERVER_TIMEZONE.parseValue(),
the same conversion that the client uses when it parses its configuration.

Closes ClickHouse#3357
…-user-agent-arch

[client-v2] Add the CPU architecture to the User-Agent header
The Native reader decodes some nested types (for example Array(Array(Int8))
or Map(String, Array(Nullable(Float64)))) with the RowBinary layout and reads
a wrong number of bytes. It then read the next bytes as a block header, for
example a block with no columns and some rows, and hasNext()/next() returned
the rows of that block. NativeFormatReaderDataSetTest failed for these two
types with "More rows than in the data set".

All blocks of one Native result have the same columns. The reader now keeps
the header of the first block and fails with ClientException if a later block
has other columns. It compares the length of each name and type before it
reads the bytes, so a length from wrong bytes cannot cause a large allocation.

Also:
- The schema is created only from the first block. Before, each block replaced
  the row buffers, so hasNext() at the end of a block changed the values that
  the getters returned for the current row.
- hasNext(), readRecord(Map) and readRecord(Object[]) use one method to move
  to the next row. readRecord(Map) no longer throws NullPointerException for an
  empty result or IndexOutOfBoundsException for a block without rows.
- A stream that ends inside the column count of a block now fails. Before, it
  was the end of the result.
- Javadoc explains the stream layout and how the reader reads rows.

Part of: ClickHouse#3365

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Native reader now compares each block with the first block, fails
with ClientException on a different block, keeps the schema of the
first block, skips blocks without rows, and has an idempotent hasNext().
Add this contract to the binary format readers entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ssage

Address review on ClickHouse#3367:
- Read the column count with BinaryStreamReader.readVarInt and end the
  result on EOFException, as before. No SequenceInputStream.
- Remove the private string helpers. Read names and types with
  BinaryStreamReader.readString and compare them with the first block.
- Make the block-check message short. It refers to the class Javadoc,
  which now explains the check, its causes, and the RowBinary workaround.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ytes

A later block that is read from wrong bytes can have a very large name or
type length. Reading the string first allocated that length, so the reader
could throw OutOfMemoryError instead of ClientException. The reader now
keeps the name and type bytes of the first block and compares the length of
each later string before it reads the bytes. The bytes are compared as the
server wrote them, so a name that is not UTF-8 still matches.

The commit also restores the CRLF line endings of NativeFormatReader.java,
as on main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The maintainer decided that the column count check is enough and that the
header strings are read with BinaryStreamReader.readString. This reverts the
code and the tests of the previous commit. NativeFormatReader.java keeps the
CRLF line endings of main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…fo-timezone-3357

fix(client-v2): keep server time zone as TimeZone in loadServerInfo
…ader-block-structure

[client-v2] Native reader: check each block against the first block
ClickHouseEnum did not check for repeated values or names, so a type like
Enum8('a' = 1, 'b' = 1) was accepted. Both labels were written with the
same value and 'b' read back as 'a'. The server rejects these types.

Check both constructors and throw IllegalArgumentException that names the
two entries.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants