Skip to content

Commit 3a9ff80

Browse files
committed
Merge branch 'main' into jdbc_fix_date_problem
2 parents 3d353a4 + 8dd90d4 commit 3a9ff80

File tree

94 files changed

+5938
-1421
lines changed

Some content is hidden

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

94 files changed

+5938
-1421
lines changed

.github/workflows/analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ on:
2828
required: false
2929

3030
env:
31-
PREFERRED_LTS_VERSION: "24.3"
31+
PREFERRED_LTS_VERSION: "25.3"
3232
PR_NUMBER: ${{ github.event.pull_request.number || '' }}
3333

3434
jobs:

.github/workflows/benchmarks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212

1313
env:
1414
CHC_BRANCH: "main"
15-
CH_VERSION: "24.8"
15+
CH_VERSION: "25.3"
1616
JAVA_VERSION: 17
1717

1818
concurrency:

.github/workflows/build.yml

Lines changed: 59 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ concurrency:
3232
cancel-in-progress: true
3333

3434
env:
35-
PREFERRED_LTS_VERSION: "24.3"
35+
PREFERRED_LTS_VERSION: "25.3"
3636

3737
jobs:
3838
compile:
@@ -57,53 +57,63 @@ jobs:
5757
cache: "maven"
5858
- name: Build and install libraries
5959
run: mvn --batch-mode --no-transfer-progress --show-version --strict-checksums --threads 2 -Dmaven.wagon.rto=30000 -Dj8 -DskipITs install
60+
- name: Copy Artifacts to Build dir
61+
run: |
62+
mkdir clickhouse-jdbc-artifacts
63+
cp -rf $HOME/.m2/repository/com/clickhouse/clickhouse-jdbc/* ./clickhouse-jdbc-artifacts/
6064
- name: Compile examples
6165
run: |
6266
export LIB_VER=$(grep '<revision>' pom.xml | sed -e 's|[[:space:]]*<[/]*revision>[[:space:]]*||g')
6367
find `pwd`/examples -type f -name pom.xml -exec sed -i -e "s|\(<clickhouse-java.version>\).*\(<\)|\1$LIB_VER\2|g" {} \;
6468
for d in $(ls -d `pwd`/examples/*/); do \
6569
if [ -e $d/pom.xml ]; then cd $d && mvn --batch-mode --no-transfer-progress clean compile; fi;
6670
if [ -e $d/gradlew ]; then cd $d && ./gradlew clean build; fi;
67-
done
68-
69-
test-multi-env:
70-
needs: compile
71-
strategy:
72-
matrix:
73-
# https://whichjdk.com/
74-
# https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#selecting-a-java-distribution
75-
# add "corretto", "liberica", "microsoft", "zulu" only when needed
76-
dist: ["temurin"]
77-
# fix issue on "macos-latest", "windows-latest"
78-
os: ["ubuntu-latest"]
79-
fail-fast: false
80-
runs-on: ${{ matrix.os }}
81-
timeout-minutes: 10
82-
name: ${{ matrix.dist }} JDK 17 on ${{ matrix.os }}
83-
steps:
84-
- name: Check out repository
85-
uses: actions/checkout@v4
86-
- name: Check out PR
87-
run: |
88-
git fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 \
89-
origin pull/${{ github.event.inputs.pr }}/merge:merged-pr && git checkout merged-pr
90-
if: github.event.inputs.pr != ''
91-
- name: Install JDK 17 and Maven
92-
uses: actions/setup-java@v4
93-
with:
94-
distribution: ${{ matrix.dist }}
95-
java-version: 17
96-
cache: "maven"
97-
- name: Test libraries
98-
run: mvn --batch-mode --no-transfer-progress -Dj8 -DskipITs verify
99-
- name: Upload test results
71+
done
72+
- name: Save clickhouse-jdbc-all for tests
10073
uses: actions/upload-artifact@v4
101-
if: failure()
10274
with:
103-
name: result ${{ github.job }}
104-
path: |
105-
**/target/failsafe-reports
106-
**/target/surefire-reports
75+
name: clickhouse-jdbc-archive
76+
path: clickhouse-jdbc-artifacts/
77+
retention-days: 5
78+
79+
# test-multi-env:
80+
# needs: compile
81+
# strategy:
82+
# matrix:
83+
# # https://whichjdk.com/
84+
# # https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#selecting-a-java-distribution
85+
# # add "corretto", "liberica", "microsoft", "zulu" only when needed
86+
# dist: ["temurin"]
87+
# # fix issue on "macos-latest", "windows-latest"
88+
# os: ["ubuntu-latest"]
89+
# fail-fast: false
90+
# runs-on: ${{ matrix.os }}
91+
# timeout-minutes: 10
92+
# name: ${{ matrix.dist }} JDK 17 on ${{ matrix.os }}
93+
# steps:
94+
# - name: Check out repository
95+
# uses: actions/checkout@v4
96+
# - name: Check out PR
97+
# run: |
98+
# git fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 \
99+
# origin pull/${{ github.event.inputs.pr }}/merge:merged-pr && git checkout merged-pr
100+
# if: github.event.inputs.pr != ''
101+
# - name: Install JDK 17 and Maven
102+
# uses: actions/setup-java@v4
103+
# with:
104+
# distribution: ${{ matrix.dist }}
105+
# java-version: 17
106+
# cache: "maven"
107+
# - name: Test libraries
108+
# run: mvn --batch-mode --no-transfer-progress -Dj8 -DskipITs verify
109+
# - name: Upload test results
110+
# uses: actions/upload-artifact@v4
111+
# if: failure()
112+
# with:
113+
# name: result ${{ github.job }}
114+
# path: |
115+
# **/target/failsafe-reports
116+
# **/target/surefire-reports
107117

108118
test-native-image:
109119
runs-on: ubuntu-latest
@@ -122,8 +132,7 @@ jobs:
122132
uses: graalvm/setup-graalvm@v1
123133
with:
124134
version: "latest"
125-
java-version: "17"
126-
components: "native-image"
135+
java-version: "21"
127136
github-token: ${{ secrets.GITHUB_TOKEN }}
128137
- name: Build native image
129138
run: mvn --batch-mode --no-transfer-progress -Pnative -Dj8 -DskipTests install
@@ -145,7 +154,7 @@ jobs:
145154
matrix:
146155
# most recent LTS releases as well as latest stable builds
147156
# https://github.com/ClickHouse/ClickHouse/pulls?q=is%3Aopen+is%3Apr+label%3Arelease
148-
clickhouse: ["24.3", "24.8", "latest"]
157+
clickhouse: ["25.3", "25.8", "latest"]
149158
project: ["clickhouse-http-client", "client-v2"]
150159
fail-fast: false
151160
timeout-minutes: 15
@@ -197,16 +206,18 @@ jobs:
197206
path: |
198207
**/target/failsafe-reports
199208
**/target/surefire-reports
209+
retention-days: 5
200210

201211
test-with-cloud:
202212
runs-on: ubuntu-latest
203-
needs: compile
213+
needs: test-jdbc-driver
204214
strategy:
205215
matrix:
206216
# most recent LTS releases as well as latest stable builds
207217
# https://github.com/ClickHouse/ClickHouse/pulls?q=is%3Aopen+is%3Apr+label%3Arelease
208218
clickhouse: ["cloud"]
209-
project: ["clickhouse-http-client", "clickhouse-jdbc", "client-v2", "jdbc-v2"]
219+
# project: ["clickhouse-http-client", "clickhouse-jdbc", "client-v2", "jdbc-v2"]
220+
project: ["client-v2", "jdbc-v2"]
210221
fail-fast: false
211222
timeout-minutes: 20
212223
name: ${{ matrix.project }} + CH ${{ matrix.clickhouse }}
@@ -265,10 +276,10 @@ jobs:
265276
266277
test-jdbc-driver:
267278
runs-on: ubuntu-latest
268-
needs: compile
279+
needs: test-java-client
269280
strategy:
270281
matrix:
271-
clickhouse: ["24.3", "24.8", "latest"]
282+
clickhouse: ["25.3", "25.8", "latest"]
272283
# here http, http_client and apache_http_client represent different value of http_connection_provider
273284
# protocol: ["http", "http_client", "apache_http_client"]
274285
protocol: ["apache_http_client"]
@@ -328,10 +339,10 @@ jobs:
328339
329340
test-r2dbc-driver:
330341
runs-on: ubuntu-latest
331-
needs: compile
342+
needs: test-jdbc-driver
332343
strategy:
333344
matrix:
334-
clickhouse: ["24.3", "24.8", "latest"]
345+
clickhouse: ["25.3", "25.8", "latest"]
335346
# grpc is not fully supported, and http_client and apache_http_client do not work in CI environment(due to limited threads?)
336347
protocol: ["http"]
337348
r2dbc: ["1.0.0.RELEASE", "0.9.1.RELEASE"]

.github/workflows/nightly.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313
env:
1414
CHC_BRANCH: "main"
1515
# CHC_VERSION: "0.9.0"
16-
CH_VERSION: "24.8"
16+
CH_VERSION: "25.3"
1717

1818
jobs:
1919
nightly:

.github/workflows/release.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
required: true
99

1010
env:
11-
CH_VERSION: "24.8"
11+
CH_VERSION: "25.3"
1212

1313
jobs:
1414
release:
@@ -84,6 +84,7 @@ jobs:
8484
clickhouse-data/target/clickhouse*.jar
8585
clickhouse-http-client/target/clickhouse*.jar
8686
clickhouse-jdbc/target/clickhouse*.jar
87+
clickhouse-jdbc/target/bundle/clickhouse*.jar
8788
clickhouse-r2dbc/target/clickhouse*.jar
8889
client-v2/target/client-v2*.jar
8990
jdbc-v2/target/jdbc-v2*.jar

.github/workflows/run_examples.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ on:
66
ch_version:
77
description: ClickHouse Version
88
required: false
9-
default: 24.8
9+
default: 25.8
1010
client_version:
11-
description: ClickHouse Java Version
11+
description: Build Type
1212
type: choice
1313
options:
14-
- latest
15-
- pre_release
16-
pre_release_version:
17-
description: Client Release Version
14+
- head
15+
- nightly
16+
nightly_version:
17+
description: Nightly Version
1818
required: false
19-
default: 0.9.0
19+
default: 0.9.2-SNAPSHOT
2020

2121
concurrency:
2222
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.number || github.sha }}
@@ -25,7 +25,7 @@ concurrency:
2525

2626
jobs:
2727
run-examples-with-8-jdk-and-latest:
28-
if: github.event.inputs.client_version == 'latest'
28+
if: github.event.inputs.client_version == 'head'
2929
runs-on: ubuntu-latest
3030
timeout-minutes: 15
3131
name: Run Examples With HEAD on JVM 8
@@ -56,7 +56,7 @@ jobs:
5656
mvn --batch-mode --no-transfer-progress --show-version clean compile
5757
mvn --no-transfer-progress exec:java -Dexec.mainClass="com.clickhouse.examples.jdbc.Basic" -DchPassword=secret -DfailOnError=true
5858
run-examples-with-8-jdk-and-staging-release:
59-
if: github.event.inputs.client_version == 'pre_release'
59+
if: github.event.inputs.client_version == 'nightly'
6060
runs-on: ubuntu-latest
6161
timeout-minutes: 15
6262
name: Run Examples With Pre-Release on JVM 8
@@ -69,12 +69,11 @@ jobs:
6969
distribution: "temurin"
7070
java-version: 8
7171
cache: "maven"
72-
- name: Run Examples
72+
- name: Run JDBC Example
7373
run: |
7474
java -version
7575
docker run -d -q --name demo-service-db -e CLICKHOUSE_USER=default -e CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT=1 -e CLICKHOUSE_PASSWORD=secret -p 8123:8123 clickhouse/clickhouse-server:${{ github.event.inputs.ch_version }}
7676
cd examples/jdbc
77-
sed -i "s|<clickhouse-java.version>.*<\/clickhouse-java.version>|<clickhouse-java.version>${{ github.event.inputs.pre_release_version }}<\/clickhouse-java.version>|g" pom.xml
78-
sed -i "s|<url>https:\/\/s01\.oss\.sonatype\.org\/content\/repositories\/snapshots\/<\/url>|<url>https:\/\/s01\.oss\.sonatype\.org\/content\/groups\/staging\/<\/url>|g" pom.xml
77+
sed -i "s|<clickhouse-java.version>.*<\/clickhouse-java.version>|<clickhouse-java.version>${{ github.event.inputs.nightly_version }}<\/clickhouse-java.version>|g" pom.xml
7978
mvn --batch-mode --no-transfer-progress --show-version clean compile
8079
mvn --no-transfer-progress exec:java -Dexec.mainClass="com.clickhouse.examples.jdbc.Basic" -DchPassword=secret -DfailOnError=true

CHANGELOG.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,36 @@
1+
## 0.9.2
2+
3+
### Improvements
4+
- [jdbc-v2] `ResultSetImpl.getObject()` handles `java.time.Instant`
5+
6+
### Improvements
7+
- [jdbc-v2] Classes `com.clickhouse.jdbc.ClientInfoProperties` and `com.clickhouse.jdbc.DriverProperties` moved to public
8+
API. (https://github.com/ClickHouse/clickhouse-java/pull/2521)
9+
- [jdbc-v2] Implemented `isBeforeFirst`, `isAfterLast`, `isFirst`, `isLast` methods for `ResultSet` and `ResultSetMetaData`.
10+
Improved test coverage for `ResultSetImpl`. (https://github.com/ClickHouse/clickhouse-java/pull/2530)
11+
- [jdbc-v2] Implemented `createArray` and `createStruct` methods for `Connection` interface. Method `createStruct`
12+
should be used to create `Tuple` values and `createArray` to create various arrays. (https://github.com/ClickHouse/clickhouse-java/pull/2523)
13+
- [jdbc-v2] Implemented `setNetworkTimeout` of `Connection` interface. Used to fail fast when network operation fails. Related to
14+
stale connection problem. (https://github.com/ClickHouse/clickhouse-java/pull/2522)
15+
- [client-v2] Added support for JSON with predefined paths. Previously columns with definition like `JSON(a string, b.c Int32)`
16+
were not supported. (https://github.com/ClickHouse/clickhouse-java/pull/2531)
17+
18+
### Bug Fixes
19+
- [jdbc-v2] Fixed issue creating array of tuples with `createArray` method of `Connection` interface.
20+
(https://github.com/ClickHouse/clickhouse-java/issues/2360)
21+
- [jdbc-v2] Fixed issue with reading nested arrays. (https://github.com/ClickHouse/clickhouse-java/issues/2539)
22+
- [jdbc-v2] Fixed issue with not shaded antlr4-runtime dependency. Potential problem for Apache Spark users. (https://github.com/ClickHouse/clickhouse-java/issues/2553)
23+
- [jdbc-v2] Fixed issue with parsing CTE for prepared statement. (https://github.com/ClickHouse/clickhouse-java/issues/2551)
24+
- [jdbc-v2] Fixed issue with parsing SQL containing view parameters. (https://github.com/ClickHouse/clickhouse-java/issues/2547)
25+
- [jdbc-v2] Fixed issue with `InsertSettings` when two concurrent insert operations sharing same settings object may be insert
26+
wrong columns or to a wrong table. (https://github.com/ClickHouse/clickhouse-java/pull/2550)
27+
- [jdbc-v2] Fixed issue with batch insert when it is not cleared after execution. Now batch is cleared after execution even on failure. (https://github.com/ClickHouse/clickhouse-java/issues/2548)
28+
- [jdbc-v2] Fixed `DatabaseMetadataImpl` to return result set with defined by spec structure. Resolves issue for many database tools
29+
relying on metadata. (https://github.com/ClickHouse/clickhouse-java/issues/2396)
30+
- [jdbc-v2] Fixed `DatabaseMetadataImpl` to return empty result set where appropriate. (https://github.com/ClickHouse/clickhouse-java/issues/2517)
31+
- [jdbc-v2] Fixed issue with verbose logging. (https://github.com/ClickHouse/clickhouse-java/issues/2148)
32+
- [client-v2] Fixed issue with reading JSON with predefined paths. (https://github.com/ClickHouse/clickhouse-java/issues/2462)
33+
134
## 0.9.1
235

336
### New Features

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

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,41 @@ public static ClickHouseColumn of(String columnName, String columnType) {
639639
return list.get(0);
640640
}
641641

642+
public static ClickHouseColumn of(ClickHouseDataType dataType) {
643+
return ClickHouseColumn.of(dataType, false);
644+
}
645+
646+
public static ClickHouseColumn of(ClickHouseDataType dataType, boolean nullable) {
647+
return ClickHouseColumn.of("", dataType, nullable);
648+
}
649+
650+
public static ClickHouseColumn nullable(ClickHouseDataType dataType) {
651+
return ClickHouseColumn.of(dataType, true);
652+
}
653+
654+
public static ClickHouseColumn string(boolean nullable) {
655+
return ClickHouseColumn.of(ClickHouseDataType.String, nullable);
656+
}
657+
658+
public static ClickHouseColumn string() {
659+
return ClickHouseColumn.of(ClickHouseDataType.String, false);
660+
}
661+
662+
public static ClickHouseColumn array(String columnName, boolean nullable, ClickHouseColumn innerColumn) {
663+
return ClickHouseColumn.of(columnName, ClickHouseDataType.Array, nullable, innerColumn);
664+
}
665+
666+
public static ClickHouseColumn map(String columnName, boolean nullable, ClickHouseDataType keyColumn, ClickHouseColumn valueColumn) {
667+
return ClickHouseColumn.of(columnName, ClickHouseDataType.Map, nullable,
668+
ClickHouseColumn.of(keyColumn),
669+
valueColumn);
670+
}
671+
672+
public static ClickHouseColumn tuple(String columnName, boolean nullable, ClickHouseColumn... innerColumn) {
673+
return ClickHouseColumn.of(columnName, ClickHouseDataType.Tuple, nullable, innerColumn);
674+
}
675+
676+
642677
public static List<ClickHouseColumn> parse(String args) {
643678
if (args == null || args.isEmpty()) {
644679
return Collections.emptyList();

0 commit comments

Comments
 (0)