Repository navigation
Fork CI for ClickHouse/clickhouse-java#3379 - #10
Open
Indian-boult wants to merge 11 commits into
Open
Indian-boult wants to merge 11 commits into
Indian-boult wants to merge 11 commits into
Conversation
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
ResultSet#getArray and ResultSet#getObject threw SQLException for Array(Ring), Array(Geometry) and other arrays of geo types. The cause was a NullPointerException in the constructor of com.clickhouse.jdbc.types.Array. JdbcUtils.convert took the element class from convertToJavaClass, which is java.sql.Array for every geo type. convertList then converted each element with convert(value, java.sql.Array.class), which has no column, and new Array(null, ...) failed. Keep the elements as read when the element class is java.sql.Array. getArray() of the result is now an Object[] of nested Java arrays, for example a double[][] for each Ring.
Client V2 CoverageCoverage Report
Class Coverage
|
JDBC V2 CoverageCoverage Report
Class Coverage
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CI run inside the fork for ClickHouse#3379. This PR only triggers the repository workflows on the same code. It is not for merge.