Skip to content

Commit b061b48

Browse files
author
Paultagoras
committed
Adding tests and a helper method
1 parent d0853b4 commit b061b48

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

clickhouse-client/src/main/java/com/clickhouse/client/ClickHouseResponseSummary.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,10 @@ public long getResultRows() {
345345
return progress.get().getResultRows();
346346
}
347347

348+
public String getQueryId() {
349+
return progress.get().getQueryId();
350+
}
351+
348352
public boolean isEmpty() {
349353
return progress.get().isEmpty() && stats.get().isEmpty();
350354
}

clickhouse-http-client/src/test/java/com/clickhouse/client/http/ClickHouseHttpClientTest.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,21 @@ public void testPost() throws ClickHouseException {
414414
}
415415
}
416416

417+
@Test(groups = {"integration"})
418+
public void testQueryId() throws ClickHouseException {
419+
ClickHouseNode server = getServer(ClickHouseProtocol.HTTP);
420+
String uuid = UUID.randomUUID().toString();
421+
422+
try (ClickHouseClient client = ClickHouseClient.builder().options(getClientOptions())
423+
.defaultCredentials(ClickHouseCredentials.fromUserAndPassword("foo", "bar")).build()) {
424+
try (ClickHouseResponse resp = newRequest(client, server).compressServerResponse(false)
425+
.format(ClickHouseFormat.RowBinaryWithNamesAndTypes)
426+
.query("select 1,2", uuid).executeAndWait()) {
427+
Assert.assertEquals(resp.getSummary().getQueryId(), uuid);
428+
}
429+
}
430+
}
431+
417432
@Test(groups = {"integration"})
418433
public void testProxyConnection() throws ClickHouseException, IOException {
419434
ToxiproxyContainer toxiproxy = null;

0 commit comments

Comments
 (0)