diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml
index 5726800c6..245294dc6 100644
--- a/.github/workflows/nightly.yml
+++ b/.github/workflows/nightly.yml
@@ -12,7 +12,7 @@ on:
env:
CHC_BRANCH: "main"
- CHC_VERSION: "0.4.1"
+ CHC_VERSION: "0.4.2"
jobs:
nightly:
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index e1448f0d1..3858a2c26 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -6,7 +6,7 @@ on:
version:
description: "Release version"
required: true
- default: "0.4.1-SNAPSHOT"
+ default: "0.4.2-SNAPSHOT"
jobs:
release:
diff --git a/.gitignore b/.gitignore
index 6ca6b5e30..f2ada3a6f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,7 @@
*.jar
*.war
*.ear
+*.out
# VSCode
.bloop
diff --git a/README.md b/README.md
index c69190ebb..824dd8ab4 100644
--- a/README.md
+++ b/README.md
@@ -69,7 +69,7 @@ The library can be downloaded from both [Github Releases](../../releases) and [M
com.clickhouse
clickhouse-http-client
- 0.4.0
+ 0.4.1
```
@@ -105,15 +105,9 @@ try (ClickHouseClient client = ClickHouseClient.newInstance(ClickHouseProtocol.H
com.clickhouse
clickhouse-jdbc
- 0.4.0
+ 0.4.1
all
-
-
- *
- *
-
-
```
diff --git a/clickhouse-benchmark/pom.xml b/clickhouse-benchmark/pom.xml
index c4e030cb9..bf567f310 100644
--- a/clickhouse-benchmark/pom.xml
+++ b/clickhouse-benchmark/pom.xml
@@ -141,6 +141,10 @@
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+
org.apache.maven.plugins
maven-shade-plugin
@@ -161,10 +165,21 @@
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
+
+ cc.blynk.clickhouse:clickhouse4j
+
+ net/**
+ org/**
+
+
*:*
+ **/maven
**/module-info.class
+ **/DEPENDENCIES*
+ **/LICENSE*
+ **/NOTICE*
META-INF/MANIFEST.MF
META-INF/*.SF
META-INF/*.DSA
diff --git a/clickhouse-cli-client/README.md b/clickhouse-cli-client/README.md
index 53d892341..f4e179116 100644
--- a/clickhouse-cli-client/README.md
+++ b/clickhouse-cli-client/README.md
@@ -20,7 +20,7 @@ Either [clickhouse](https://clickhouse.com/docs/en/interfaces/cli/) or [docker](
com.clickhouse
clickhouse-cli-client
- 0.4.0
+ 0.4.1
```
diff --git a/clickhouse-client/README.md b/clickhouse-client/README.md
index 4bc2a7652..1c48ca43a 100644
--- a/clickhouse-client/README.md
+++ b/clickhouse-client/README.md
@@ -38,7 +38,7 @@ client.connect("http://localhost/system")
com.clickhouse
clickhouse-http-client
- 0.4.0
+ 0.4.1
```
diff --git a/clickhouse-client/src/main/java/com/clickhouse/client/ClickHouseClient.java b/clickhouse-client/src/main/java/com/clickhouse/client/ClickHouseClient.java
index c365a3942..af1073a7f 100644
--- a/clickhouse-client/src/main/java/com/clickhouse/client/ClickHouseClient.java
+++ b/clickhouse-client/src/main/java/com/clickhouse/client/ClickHouseClient.java
@@ -329,7 +329,7 @@ static CompletableFuture dump(ClickHouseNode server,
return submit(() -> {
try (ClickHouseClient client = newInstance(theServer.getProtocol())) {
- ClickHouseRequest> request = client.connect(theServer).output(stream);
+ ClickHouseRequest> request = client.read(theServer).output(stream);
// FIXME what if the table name is `try me`?
if (theQuery.indexOf(' ') < 0) {
request.table(theQuery);
@@ -415,7 +415,7 @@ static CompletableFuture dump(ClickHouseNode server,
return submit(() -> {
try (ClickHouseClient client = newInstance(theServer.getProtocol())) {
- ClickHouseRequest> request = client.connect(theServer).compressServerResponse(compression)
+ ClickHouseRequest> request = client.read(theServer).compressServerResponse(compression)
.format(format).output(output);
// FIXME what if the table name is `try me`?
if (theQuery.indexOf(' ') < 0) {
@@ -485,7 +485,7 @@ static CompletableFuture load(ClickHouseNode server,
return submit(() -> {
try (ClickHouseClient client = newInstance(theServer.getProtocol());
- ClickHouseResponse response = client.connect(theServer).write().table(table).data(stream)
+ ClickHouseResponse response = client.write(theServer).table(table).data(stream)
.executeAndWait()) {
return response.getSummary();
}
@@ -516,7 +516,7 @@ static CompletableFuture load(ClickHouseNode server,
return submit(() -> {
try (ClickHouseClient client = newInstance(theServer.getProtocol());
- ClickHouseResponse response = client.connect(theServer).write().table(table).data(writer)
+ ClickHouseResponse response = client.write(theServer).table(table).data(writer)
.decompressClientRequest(compression).format(format).executeAndWait()) {
return response.getSummary();
}
@@ -611,7 +611,7 @@ static CompletableFuture load(ClickHouseNode server,
return submit(() -> {
try (ClickHouseClient client = newInstance(theServer.getProtocol());
- ClickHouseResponse response = client.connect(theServer).write().table(table).data(input)
+ ClickHouseResponse response = client.write(theServer).table(table).data(input)
.decompressClientRequest(compression).format(format).executeAndWait()) {
return response.getSummary();
} finally {
@@ -697,7 +697,7 @@ static CompletableFuture> send(ClickHouseNode se
try (ClickHouseClient client = ClickHouseClient.builder()
.nodeSelector(ClickHouseNodeSelector.of(theServer.getProtocol()))
.option(ClickHouseClientOption.ASYNC, false).build()) {
- ClickHouseRequest> request = client.connect(theServer).format(ClickHouseFormat.RowBinary);
+ ClickHouseRequest> request = client.read(theServer).format(ClickHouseFormat.RowBinary);
if ((boolean) ClickHouseDefaults.AUTO_SESSION.getEffectiveDefaultValue() && queries.size() > 1) {
request.session(request.getManager().createSessionId(), false);
}
@@ -736,7 +736,7 @@ static CompletableFuture send(ClickHouseNode server,
try (ClickHouseClient client = ClickHouseClient.builder()
.nodeSelector(ClickHouseNodeSelector.of(theServer.getProtocol()))
.option(ClickHouseClientOption.ASYNC, false).build();
- ClickHouseResponse resp = client.connect(theServer).format(ClickHouseFormat.RowBinary).query(sql)
+ ClickHouseResponse resp = client.read(theServer).format(ClickHouseFormat.RowBinary).query(sql)
.params(params).executeAndWait()) {
return resp.getSummary();
}
@@ -806,7 +806,7 @@ static CompletableFuture> send(ClickHouseNode se
.nodeSelector(ClickHouseNodeSelector.of(theServer.getProtocol()))
.option(ClickHouseClientOption.ASYNC, false).build()) {
// format doesn't matter here as we only need a summary
- ClickHouseRequest> request = client.connect(theServer).format(ClickHouseFormat.RowBinary).query(sql);
+ ClickHouseRequest> request = client.read(theServer).format(ClickHouseFormat.RowBinary).query(sql);
for (int i = 0; i < size; i++) {
Object[] o = params[i];
String[] arr = new String[len];
@@ -859,7 +859,7 @@ static CompletableFuture> send(ClickHouseNode se
.nodeSelector(ClickHouseNodeSelector.of(theServer.getProtocol()))
.option(ClickHouseClientOption.ASYNC, false).build()) {
// format doesn't matter here as we only need a summary
- ClickHouseRequest> request = client.connect(theServer).format(ClickHouseFormat.RowBinary);
+ ClickHouseRequest> request = client.read(theServer).format(ClickHouseFormat.RowBinary);
ClickHouseParameterizedQuery query = ClickHouseParameterizedQuery.of(request.getConfig(), sql);
StringBuilder builder = new StringBuilder();
for (String[] p : params) {
@@ -1093,7 +1093,7 @@ default boolean ping(ClickHouseNode server, int timeout) {
if (server.getProtocol() == ClickHouseProtocol.ANY) {
server = ClickHouseNode.probe(server.getHost(), server.getPort(), timeout);
}
- try (ClickHouseResponse resp = connect(server) // create request
+ try (ClickHouseResponse resp = read(server) // create request
.option(ClickHouseClientOption.ASYNC, false) // use current thread
.option(ClickHouseClientOption.CONNECTION_TIMEOUT, timeout)
.option(ClickHouseClientOption.SOCKET_TIMEOUT, timeout)
diff --git a/clickhouse-client/src/test/java/com/clickhouse/client/ClickHouseNodeTest.java b/clickhouse-client/src/test/java/com/clickhouse/client/ClickHouseNodeTest.java
index a0e2687c7..98f385c00 100644
--- a/clickhouse-client/src/test/java/com/clickhouse/client/ClickHouseNodeTest.java
+++ b/clickhouse-client/src/test/java/com/clickhouse/client/ClickHouseNodeTest.java
@@ -107,6 +107,17 @@ public void testBuildInOneGo() {
checkCustomValues(node, "", host, port, 1, protocol, database, null, new String[] { "read-only", "primary" });
}
+ @Test(groups = { "unit" })
+ public void testCredentials() {
+ ClickHouseNode node = ClickHouseNode.builder().build();
+ Assert.assertEquals(node.getCredentials().orElse(null), null);
+
+ ClickHouseCredentials credentials = ClickHouseCredentials.fromUserAndPassword("default", "password");
+ node = ClickHouseNode.builder().credentials(credentials).build();
+ Assert.assertEquals(node.getCredentials().orElse(null), credentials);
+ Assert.assertTrue(node.getCredentials().orElse(null) == credentials, "Should be the exact same instance");
+ }
+
@Test(groups = { "unit" })
public void testDatabase() {
ClickHouseConfig config = new ClickHouseConfig(
diff --git a/clickhouse-client/src/test/java/com/clickhouse/client/ClientIntegrationTest.java b/clickhouse-client/src/test/java/com/clickhouse/client/ClientIntegrationTest.java
index d4984c8dd..427c41f58 100644
--- a/clickhouse-client/src/test/java/com/clickhouse/client/ClientIntegrationTest.java
+++ b/clickhouse-client/src/test/java/com/clickhouse/client/ClientIntegrationTest.java
@@ -1441,6 +1441,8 @@ public void testCustomWriter() throws ClickHouseException {
try (ClickHouseResponse resp = req.data(w).executeAndWait()) {
Assert.assertNotNull(resp);
+ } catch (Exception e) {
+ Assert.fail("Failed to call executeAndWait(): async=" + b, e);
}
Assert.assertTrue(req.getInputStream().get().isClosed(), "Input stream should have been closed");
}
diff --git a/clickhouse-data/README.md b/clickhouse-data/README.md
index 56c795a97..0f513b588 100644
--- a/clickhouse-data/README.md
+++ b/clickhouse-data/README.md
@@ -8,7 +8,7 @@
com.clickhouse
clickhouse-data
- 0.4.0
+ 0.4.1
```
diff --git a/clickhouse-jdbc/README.md b/clickhouse-jdbc/README.md
index f8854a55a..2e1e1eeb2 100644
--- a/clickhouse-jdbc/README.md
+++ b/clickhouse-jdbc/README.md
@@ -10,15 +10,9 @@ Keep in mind that `clickhouse-jdbc` is synchronous, and in general it has more o
com.clickhouse
clickhouse-jdbc
- 0.4.0
+ 0.4.1
all
-
-
- *
- *
-
-
```
diff --git a/clickhouse-r2dbc/README.md b/clickhouse-r2dbc/README.md
index e9030a648..b0c2e954b 100644
--- a/clickhouse-r2dbc/README.md
+++ b/clickhouse-r2dbc/README.md
@@ -9,7 +9,7 @@
com.clickhouse
clickhouse-r2dbc
- 0.4.0
+ 0.4.1
all
diff --git a/examples/grpc/pom.xml b/examples/client/pom.xml
similarity index 87%
rename from examples/grpc/pom.xml
rename to examples/client/pom.xml
index 2ac897c4d..9bfff07c6 100644
--- a/examples/grpc/pom.xml
+++ b/examples/client/pom.xml
@@ -5,12 +5,12 @@
4.0.0
com.clickhouse
- grpc-examples
+ java-client-examples
1.0.0
jar
- grpc-examples
- gRPC Examples
+ java-client-examples
+ Java Client Examples
https://github.com/ClickHouse/clickhouse-java
2022
@@ -66,7 +66,7 @@
UTF-8
UTF-8
- 0.4.0
+ 0.4.1
3.8.1
@@ -76,8 +76,12 @@
com.clickhouse
- clickhouse-grpc-client
- ${clickhouse-grpc.version}
+
+ clickhouse-http-client
+ ${clickhouse-java.version}
shaded
diff --git a/examples/grpc/src/main/java/com/clickhouse/examples/jdbc/Main.java b/examples/client/src/main/java/com/clickhouse/examples/jdbc/Main.java
similarity index 92%
rename from examples/grpc/src/main/java/com/clickhouse/examples/jdbc/Main.java
rename to examples/client/src/main/java/com/clickhouse/examples/jdbc/Main.java
index 611a221c8..582ee4b19 100644
--- a/examples/grpc/src/main/java/com/clickhouse/examples/jdbc/Main.java
+++ b/examples/client/src/main/java/com/clickhouse/examples/jdbc/Main.java
@@ -88,13 +88,15 @@ static int query(ClickHouseNode server, String table) throws ClickHouseException
public static void main(String[] args) {
ClickHouseNode server = ClickHouseNode.builder()
- .host(System.getProperty("chHost", "127.0.0.1"))
- .port(ClickHouseProtocol.GRPC, Integer.parseInt(System.getProperty("chPort", "9100")))
+ .host(System.getProperty("chHost", "localhost"))
+ .port(ClickHouseProtocol.HTTP, Integer.getInteger("chPort", 8123))
+ // .port(ClickHouseProtocol.GRPC, Integer.getInteger("chPort", 9000))
+ // .port(ClickHouseProtocol.TCP, Integer.getInteger("chPort", 9100))
.database("system").credentials(ClickHouseCredentials.fromUserAndPassword(
System.getProperty("chUser", "default"), System.getProperty("chPassword", "")))
.build();
- String table = "grpc_example_table";
+ String table = "java_client_example_table";
try {
dropAndCreateTable(server, table);
diff --git a/examples/jdbc/pom.xml b/examples/jdbc/pom.xml
index 7cf6dd91a..0a1734a10 100644
--- a/examples/jdbc/pom.xml
+++ b/examples/jdbc/pom.xml
@@ -66,7 +66,7 @@
UTF-8
UTF-8
- 0.4.0
+ 0.4.1
4.0.3
3.8.1
@@ -78,14 +78,8 @@
com.clickhouse
clickhouse-jdbc
- ${clickhouse-jdbc.version}
+ ${clickhouse-java.version}
http
-
-
- *
- *
-
-
com.zaxxer
diff --git a/examples/r2dbc/clickhouse-r2dbc-spring-webflux-sample/pom.xml b/examples/r2dbc/clickhouse-r2dbc-spring-webflux-sample/pom.xml
index 4502d587d..409a8fbaf 100644
--- a/examples/r2dbc/clickhouse-r2dbc-spring-webflux-sample/pom.xml
+++ b/examples/r2dbc/clickhouse-r2dbc-spring-webflux-sample/pom.xml
@@ -37,7 +37,7 @@
com.clickhouse
clickhouse-r2dbc
- 0.4.0
+ 0.4.1
com.fasterxml.jackson.datatype
diff --git a/pom.xml b/pom.xml
index 3aebcc4fc..a93e9aef2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -84,7 +84,7 @@
- 0.4.1-SNAPSHOT
+ 0.4.2-SNAPSHOT
2023
UTF-8
UTF-8
@@ -157,7 +157,7 @@
${project.artifactId}
zhicwu
https://sonarcloud.io
- 0.4.0
+ 0.4.1
**/*0*.java,**/data/*Value.java,**/data/array/*Value.java,**/stream/*Stream.java