Skip to content

Commit 6ec4d4a

Browse files
committed
fixed a few more bugs
1 parent 9a1c71c commit 6ec4d4a

File tree

5 files changed

+16
-11
lines changed

5 files changed

+16
-11
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ jobs:
184184
</toolchain>
185185
</toolchains>
186186
EOF
187+
- name: Build and install libraries
188+
run: mvn --batch-mode --no-transfer-progress --show-version --strict-checksums --threads 2 -Dmaven.wagon.rto=30000 -Dj8 -DskipITs install
187189
- name: Test Java client
188190
run: |
189191
mvn --also-make --batch-mode --no-transfer-progress --projects ${{ matrix.project }} -DclickhouseVersion=${{ matrix.clickhouse }} verify

clickhouse-client/src/test/java/com/clickhouse/client/ClientIntegrationTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,10 +580,11 @@ public void testCompressedRequest(ClickHouseCompression compression, int startLe
580580
.content(new ByteArrayInputStream("32\t1\n43\t2\n54\t3\n65\t4".getBytes()))
581581
.build())
582582
.query("select x.* from x inner join y on x.i = y.i where i in (select i from " + tableName
583-
+ ")")
583+
+ ") ORDER BY 1")
584584
.set("select_sequential_consistency", isCloud() ? 1 : null)
585585
.executeAndWait()) {
586586
int j = 0;
587+
587588
for (ClickHouseRecord r : response.records()) {
588589
Assert.assertEquals(r.getValue(0).asInteger(), j == 0 ? 1 : 4);
589590
Assert.assertEquals(r.getValue(1).asInteger(), j == 0 ? 23 : 56);

client-v2/src/main/java/com/clickhouse/client/api/data_formats/internal/ProcessParser.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ public static void parseSummary(String text, OperationMetrics metrics) {
1818
parser.nextToken(); // skip START_OBJECT
1919
JsonToken t = parser.nextToken();
2020

21+
for (ServerMetrics m : ServerMetrics.values()) {
22+
metrics.updateMetric(m, -1);
23+
}
2124
while (t != null) {
2225
if (t == JsonToken.FIELD_NAME) {
2326
String fieldName = parser.currentName();

client-v2/src/test/java/com/clickhouse/client/HttpTransportTests.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -358,13 +358,13 @@ public void testServerErrorHandling(ClickHouseFormat format, boolean serverCompr
358358
}
359359

360360

361-
try (QueryResponse response = client.query("CREATE TABLE table_from_csv AS SELECT * FROM file('empty.csv')", querySettings)
361+
try (QueryResponse response = client.query("CREATE TABLE table_from_csv ENGINE MergeTree ORDER BY () AS SELECT * FROM file('empty.csv') ", querySettings)
362362
.get(1, TimeUnit.SECONDS)) {
363363
Assert.fail("Expected exception");
364364
} catch (ServerException e) {
365365
e.printStackTrace();
366366
Assert.assertEquals(e.getCode(), 636);
367-
Assert.assertTrue(e.getMessage().startsWith("Code: 636. DB::Exception: The table structure cannot be extracted from a CSV format file. Error: The table structure cannot be extracted from a CSV format file: the file is empty. You can specify the structure manually: (in file/uri /var/lib/clickhouse/user_files/empty.csv). (CANNOT_EXTRACT_TABLE_STRUCTURE)"),
367+
Assert.assertTrue(e.getMessage().contains("You can specify the structure manually: (in file/uri /var/lib/clickhouse/user_files/empty.csv). (CANNOT_EXTRACT_TABLE_STRUCTURE)"),
368368
"Unexpected error message: " + e.getMessage());
369369
}
370370

@@ -617,8 +617,8 @@ public void testSSLAuthentication() throws Exception {
617617
}
618618
ClickHouseNode server = getSecureServer(ClickHouseProtocol.HTTP);
619619
try (Client client = new Client.Builder().addEndpoint(Protocol.HTTP, "localhost",server.getPort(), true)
620-
.setUsername("default")
621-
.setPassword("")
620+
.setUsername("dba")
621+
.setPassword("dba")
622622
.setRootCertificate("containers/clickhouse-server/certs/localhost.crt")
623623
.build()) {
624624

@@ -651,8 +651,8 @@ public void testPasswordAuthentication(String identifyWith, String identifyBy, b
651651
ClickHouseNode server = getServer(ClickHouseProtocol.HTTP);
652652

653653
try (Client client = new Client.Builder().addEndpoint(Protocol.HTTP, "localhost",server.getPort(), false)
654-
.setUsername("default")
655-
.setPassword("")
654+
.setUsername("dba")
655+
.setPassword("dba")
656656
.build()) {
657657

658658
try (CommandResponse resp = client.execute("DROP USER IF EXISTS some_user").get()) {
@@ -714,8 +714,8 @@ public void testAuthHeaderIsKeptFromUser() throws Exception {
714714
String identifyWith = "sha256_password";
715715
String identifyBy = "123§";
716716
try (Client client = new Client.Builder().addEndpoint(Protocol.HTTP, "localhost",server.getPort(), false)
717-
.setUsername("default")
718-
.setPassword("")
717+
.setUsername("dba")
718+
.setPassword("dba")
719719
.build()) {
720720

721721
try (CommandResponse resp = client.execute("DROP USER IF EXISTS some_user").get()) {

client-v2/src/test/java/com/clickhouse/client/query/QueryTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,7 +1362,6 @@ public void testQueryMetrics() throws Exception {
13621362
OperationMetrics metrics = response.getMetrics();
13631363

13641364
Assert.assertEquals(metrics.getMetric(ServerMetrics.NUM_ROWS_READ).getLong(), 30);
1365-
Assert.assertTrue(metrics.getMetric(ServerMetrics.ELAPSED_TIME).getLong() > 0);
13661365
Assert.assertTrue(metrics.getMetric(ServerMetrics.RESULT_ROWS).getLong() > 0);
13671366
}
13681367
}
@@ -1688,7 +1687,7 @@ public void testConcurrentQueries() throws Exception{
16881687
@Test(groups = {"integration"})
16891688
public void testQueryReadToPOJO() {
16901689
int limit = 10;
1691-
final String sql = "SELECT toInt32(rand32()) as id, toInt32(number * 10) as age, concat('name_', number + 1) as name " +
1690+
final String sql = "SELECT toInt32(rand32()) as id, toInt32(number * 10) as age, concat('name_', toString(number + 1)) as name " +
16921691
" FROM system.numbers LIMIT " + limit;
16931692
TableSchema schema = client.getTableSchemaFromQuery(sql);
16941693
client.register(SimplePOJO.class, schema);

0 commit comments

Comments
 (0)