Skip to content

Commit 663a945

Browse files
authored
Merge branch 'main' into main
2 parents abbd25e + 5758ec5 commit 663a945

File tree

69 files changed

+1122
-838
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1122
-838
lines changed

.github/workflows/benchmarks.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Benchmarks
2+
description: Runs minimal JMH benchmark
3+
4+
on:
5+
schedule:
6+
- cron: "55 15 * * *"
7+
workflow_dispatch:
8+
inputs:
9+
pr:
10+
description: "Pull request#"
11+
required: false
12+
13+
env:
14+
CHC_BRANCH: "main"
15+
CH_VERSION: "24.8"
16+
JAVA_VERSION: 17
17+
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.number || github.sha }}
20+
cancel-in-progress: true
21+
22+
jobs:
23+
jmh:
24+
if: ${{ startsWith(github.repository, 'ClickHouse/') }}
25+
name: "Mininal JMH Benchmarks"
26+
runs-on: "ubuntu-latest"
27+
timeout-minutes: 20
28+
steps:
29+
- name: Check out Git repository
30+
uses: actions/checkout@v4
31+
with:
32+
ref: ${{ env.CHC_BRANCH }}
33+
- name: Check out PR
34+
run: |
35+
git fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 \
36+
origin pull/${{ github.event.inputs.pr }}/merge:merged-pr && git checkout merged-pr
37+
if: github.event.inputs.pr != ''
38+
- name: Install JDK and Maven
39+
uses: actions/setup-java@v4
40+
with:
41+
distribution: "temurin"
42+
java-version: ${{ env.JAVA_VERSION }}
43+
cache: "maven"
44+
- name: Build
45+
run: mvn --batch-mode --no-transfer-progress -Dj8 -DskipTests=true clean install
46+
- name: Prepare Dataset
47+
run: |
48+
cd ./performance &&
49+
mvn --batch-mode --no-transfer-progress clean compile exec:exec -Dexec.executable=java \
50+
-Dexec.args="-classpath %classpath com.clickhouse.benchmark.data.DataSetGenerator -input sample_dataset.sql -name default -rows 100000"
51+
- name: Run Benchmarks
52+
run: |
53+
cd ./performance &&
54+
mvn --batch-mode --no-transfer-progress clean compile exec:exec -Dexec.executable=java -Dexec.args="-classpath %classpath com.clickhouse.benchmark.BenchmarkRunner \
55+
-l 100000,10000 -m 3 -t 15 -b q,i -d file://default.csv"
56+
- name: Upload test results
57+
uses: actions/upload-artifact@v4
58+
if: success()
59+
with:
60+
name: result ${{ github.job }}
61+
path: |
62+
performance/jmh-results*

CHANGELOG.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
1-
## Latest
1+
## 0.8.3
22

3-
## 0.8.2
3+
### Improvements
4+
- [client-v2] Support for native LZ4 compression (https://github.com/ClickHouse/clickhouse-java/issues/2274)
45

5-
### New Features
6+
### Bug Fixes
7+
- [jdbc-v2] Fixed several issues with reading database metadata in JDBC driver. (https://github.com/ClickHouse/clickhouse-java/issues/2282)
8+
- [jdbc-v2] Fixed settings client name in JDBC. (https://github.com/ClickHouse/clickhouse-java/issues/2233)
9+
- [client-v2] Fixed reading data from columns defined as `Nullable(FixedString(N))`. (https://github.com/ClickHouse/clickhouse-java/issues/2218)
10+
- [jdbc-v2] Fixed SQL parser failure to parse SQL statement with comments (https://github.com/ClickHouse/clickhouse-java/issues/2217)
11+
- [client-v2] Fixed issue with excessive logging (https://github.com/ClickHouse/clickhouse-java/issues/2201)
12+
- [jdbc-v2] Fixed handling IP addresses (https://github.com/ClickHouse/clickhouse-java/issues/2140)
13+
- [jdbc] - Fixed missing LZ4 dependency in shaded package (https://github.com/ClickHouse/clickhouse-java/issues/2275)
14+
15+
## 0.8.2
616

717
### Bug Fixes
818
- [jdbc-v2] - Significantly improved performance of JDBC inserts. (https://github.com/ClickHouse/clickhouse-java/pull/2165)

clickhouse-data/src/main/java/com/clickhouse/data/ClickHouseColumn.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ private static ClickHouseColumn update(ClickHouseColumn column) {
129129
case Bool:
130130
column.template = ClickHouseBoolValue.ofNull();
131131
break;
132+
case Enum:
132133
case Enum8:
133134
case Enum16:
134135
column.template = ClickHouseEnumValue
@@ -746,7 +747,7 @@ public boolean isArray() {
746747
}
747748

748749
public boolean isEnum() {
749-
return dataType == ClickHouseDataType.Enum8 || dataType == ClickHouseDataType.Enum16;
750+
return dataType == ClickHouseDataType.Enum8 || dataType == ClickHouseDataType.Enum16 || dataType == ClickHouseDataType.Enum;
750751
}
751752

752753
public boolean isFixedLength() {

clickhouse-data/src/main/java/com/clickhouse/data/ClickHouseDataType.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public enum ClickHouseDataType {
5555
DateTime(LocalDateTime.class, true, false, false, 0, 29, 0, 0, 9, false, 0x11, "TIMESTAMP"),
5656
DateTime32(LocalDateTime.class, true, false, false, 4, 19, 0, 0, 0, false, 0x12),
5757
DateTime64(LocalDateTime.class, true, false, false, 8, 29, 3, 0, 9, false, 0x14), // we always write timezone as argument
58+
Enum(String.class, true, true, false, 0, 0, 0, 0, 0, false),
5859
Enum8(String.class, true, true, false, 1, 0, 0, 0, 0, false, 0x17, "ENUM"),
5960
Enum16(String.class, true, true, false, 2, 0, 0, 0, 0, false, 0x18),
6061
FixedString(String.class, true, true, false, 0, 0, 0, 0, 0, false, 0x16, "BINARY"),
@@ -90,6 +91,8 @@ public enum ClickHouseDataType {
9091
Decimal64(BigDecimal.class, true, false, true, 8, 18, 18, 0, 18, false, 0x1A),
9192
Decimal128(BigDecimal.class, true, false, true, 16, 38, 38, 0, 38, false, 0x1B),
9293
Decimal256(BigDecimal.class, true, false, true, 32, 76, 20, 0, 76, false, 0x1C),
94+
95+
BFloat16(Float.class, false, true, true, 2, 3, 0, 0, 16, false, 0x31),
9396
Float32(Float.class, false, true, true, 4, 12, 0, 0, 38, false, 0x0D, "FLOAT", "REAL", "SINGLE"),
9497
Float64(Double.class, false, true, true, 8, 22, 0, 0, 308, false, 0x0E, "DOUBLE", "DOUBLE PRECISION"),
9598
IPv4(Inet4Address.class, false, true, false, 4, 10, 0, 0, 0, false, 0x28, "INET4"),
@@ -99,10 +102,13 @@ public enum ClickHouseDataType {
99102
Polygon(Object.class, false, true, true, 0, 0, 0, 0, 0, true, 0x2C), // same as Array(Ring)
100103
MultiPolygon(Object.class, false, true, true, 0, 0, 0, 0, 0, true, 0x2C), // same as Array(Polygon)
101104
Ring(Object.class, false, true, true, 0, 0, 0, 0, 0, true, 0x2C), // same as Array(Point)
105+
LineString( Object.class, false, true, true, 0, 0, 0, 0, 0, true, 0x2C), // same as Array(Point)
106+
MultiLineString(Object.class, false, true, true, 0, 0, 0, 0, 0, true, 0x2C), // same as Array(Ring)
107+
102108
JSON(Object.class, false, false, false, 0, 0, 0, 0, 0, true, 0x30),
103109
@Deprecated
104110
Object(Object.class, true, true, false, 0, 0, 0, 0, 0, true),
105-
String(String.class, false, false, false, 0, 0, 0, 0, 0, false, 0x15, "BINARY LARGE OBJECT", "BINARY VARYING", "BLOB",
111+
String(String.class, false, true, false, 0, 0, 0, 0, 0, false, 0x15, "BINARY LARGE OBJECT", "BINARY VARYING", "BLOB",
106112
"BYTEA", "CHAR", "CHAR LARGE OBJECT", "CHAR VARYING", "CHARACTER", "CHARACTER LARGE OBJECT",
107113
"CHARACTER VARYING", "CLOB", "GEOMETRY", "LONGBLOB", "LONGTEXT", "MEDIUMBLOB", "MEDIUMTEXT",
108114
"NATIONAL CHAR", "NATIONAL CHAR VARYING", "NATIONAL CHARACTER", "NATIONAL CHARACTER LARGE OBJECT",
@@ -113,6 +119,8 @@ public enum ClickHouseDataType {
113119
Nested(Object.class, true, true, false, 0, 0, 0, 0, 0, true, 0x2F),
114120
Tuple(List.class, true, true, false, 0, 0, 0, 0, 0, true, 0x1F),
115121
Nothing(Object.class, false, true, false, 0, 0, 0, 0, 0, true, 0x00),
122+
LowCardinality(Object.class, true, true, false, 0, 0, 0, 0, 0, true, 0x26),
123+
Nullable( Object.class, true, true, false, 0, 0, 0, 0, 0, true, 0x23),
116124
SimpleAggregateFunction(String.class, true, true, false, 0, 0, 0, 0, 0, false, 0x2E),
117125
// implementation-defined intermediate state
118126
AggregateFunction(String.class, true, true, false, 0, 0, 0, 0, 0, true),
@@ -364,7 +372,7 @@ public byte getTag() {
364372
* @return true if the type name is an alias; false otherwise
365373
*/
366374
public static boolean isAlias(String typeName) {
367-
return typeName != null && !typeName.isEmpty() && allAliases.contains(typeName.trim().toUpperCase());
375+
return typeName != null && !typeName.isEmpty() && allAliases.contains(typeName.trim());
368376
}
369377

370378
/**

clickhouse-data/src/test/java/com/clickhouse/data/ClickHouseColumnTest.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,9 @@ public void testEnum(String typeName) {
253253
Assert.assertEquals(column.getEnumConstants().name(10), "Query'Finish");
254254
Assert.assertEquals(column.getEnumConstants().value("Query'Start"), 1);
255255
Assert.assertEquals(column.getEnumConstants().value("Query'Finish"), 10);
256-
Assert.assertTrue(column.isFixedLength(), "Should have fixed length in byte");
256+
if (column.getDataType() != ClickHouseDataType.Enum) { // virtual type
257+
Assert.assertTrue(column.isFixedLength(), "Should have fixed length in byte");
258+
}
257259
Assert.assertEquals(column.getEstimatedLength(), column.getDataType().getByteLength());
258260
}
259261

@@ -417,7 +419,8 @@ public boolean isWidenUnsignedTypes() {
417419
for (ClickHouseDataType type : ClickHouseDataType.values()) {
418420
// skip advanced types
419421
if (type.isNested() || type == ClickHouseDataType.AggregateFunction
420-
|| type == ClickHouseDataType.SimpleAggregateFunction) {
422+
|| type == ClickHouseDataType.SimpleAggregateFunction || type == ClickHouseDataType.Enum
423+
|| type == ClickHouseDataType.Nullable || type == ClickHouseDataType.BFloat16) {
421424
continue;
422425
}
423426

clickhouse-jdbc/pom.xml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@
4545
<groupId>org.apache.commons</groupId>
4646
<artifactId>commons-compress</artifactId>
4747
</dependency>
48-
49-
<dependency>
50-
<groupId>org.lz4</groupId>
51-
<artifactId>lz4-pure-java</artifactId>
52-
</dependency>
5348
<dependency>
5449
<groupId>com.google.code.gson</groupId>
5550
<artifactId>gson</artifactId>
@@ -90,7 +85,7 @@
9085
<dependency>
9186
<groupId>org.lz4</groupId>
9287
<artifactId>lz4-java</artifactId>
93-
<scope>provided</scope>
88+
<version>${lz4.version}</version>
9489
</dependency>
9590
<dependency>
9691
<groupId>com.github.luben</groupId>
@@ -425,7 +420,8 @@
425420
<include>org.apache.httpcomponents.core5:httpcore5</include>
426421
<include>org.apache.httpcomponents.core5:httpcore5-h2</include>
427422
<include>com.clickhouse:jdbc-v2</include>
428-
<include>org.lz4:lz4-pure-java</include>
423+
<include>org.apache.commons:commons-compress</include>
424+
<include>org.lz4:lz4-java</include>
429425
</includes>
430426
</artifactSet>
431427
<relocations>
@@ -495,7 +491,7 @@
495491
<include>org.apache.httpcomponents.client5:httpclient5</include>
496492
<include>org.apache.httpcomponents.core5:httpcore5</include>
497493
<include>org.apache.httpcomponents.core5:httpcore5-h2</include>
498-
<include>org.lz4:lz4-pure-java</include>
494+
<include>org.lz4:lz4-java</include>
499495
<include>com.clickhouse:jdbc-v2</include>
500496
<include>com.clickhouse:client-v2</include>
501497
</includes>
@@ -573,7 +569,7 @@
573569
<include>com.clickhouse:clickhouse-data</include>
574570
<include>com.clickhouse:clickhouse-client</include>
575571
<include>com.clickhouse:clickhouse-http-client</include>
576-
<include>org.lz4:lz4-pure-java</include>
572+
<include>org.lz4:lz4-java</include>
577573
</includes>
578574
</artifactSet>
579575
<relocations>

client-v2/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353

5454
<dependency>
5555
<groupId>org.lz4</groupId>
56-
<artifactId>lz4-pure-java</artifactId>
56+
<artifactId>lz4-java</artifactId>
5757
<version>${lz4.version}</version>
5858
</dependency>
5959

0 commit comments

Comments
 (0)