Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@

### Bug Fixes

- **[client-v2]** Fixed truncated LZ4 stream errors reporting literal `{0}` and `{1}` placeholders instead of the
number of bytes read and expected. (https://github.com/ClickHouse/clickhouse-java/issues/3108)
- **[jdbc-v2]** Fixed `DatabaseMetaData#getTables` reporting `TABLE_TYPE = TABLE` for a table with the `BigQuery`
engine (present in `system.table_engines` since ClickHouse `26.8`). The engine was missing from the
engine-to-table-type mapping, so it fell back to the default `TABLE`, and `getTables(..., types = {"REMOTE TABLE"})`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private boolean readFully(byte[] b, int off, int len) throws IOException {
if (n == 0) {
return false;
}
throw new IOException(ClickHouseUtils.format("Incomplete read: {0} of {1}", n, len));
throw new IOException(ClickHouseUtils.format("Incomplete read: %s of %s", n, len));
}
n += count;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.clickhouse.client.api.internal;

import java.io.ByteArrayInputStream;
import java.io.IOException;

import net.jpountz.lz4.LZ4Factory;
import org.testng.Assert;
import org.testng.annotations.Test;

public class ClickHouseLZ4InputStreamTest {

@Test
public void reportsActualByteCountsForTruncatedHeader() {
byte[] truncatedHeader = new byte[10];
ClickHouseLZ4InputStream input = new ClickHouseLZ4InputStream(
new ByteArrayInputStream(truncatedHeader),
LZ4Factory.fastestJavaInstance().fastDecompressor(),
8192);

IOException exception = Assert.expectThrows(IOException.class,
() -> input.read(new byte[1], 0, 1));

Assert.assertEquals(exception.getMessage(), "Incomplete read: 10 of 25");
}
}
Loading