diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a921f0e2c..0c71f289c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -184,6 +184,8 @@ jobs: EOF + - name: Build and install libraries + run: mvn --batch-mode --no-transfer-progress --show-version --strict-checksums --threads 2 -Dmaven.wagon.rto=30000 -Dj8 -DskipITs install - name: Test Java client run: | mvn --also-make --batch-mode --no-transfer-progress --projects ${{ matrix.project }} -DclickhouseVersion=${{ matrix.clickhouse }} verify 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 fba14fa2a..4a6e360b6 100644 --- a/clickhouse-client/src/test/java/com/clickhouse/client/ClientIntegrationTest.java +++ b/clickhouse-client/src/test/java/com/clickhouse/client/ClientIntegrationTest.java @@ -580,10 +580,11 @@ public void testCompressedRequest(ClickHouseCompression compression, int startLe .content(new ByteArrayInputStream("32\t1\n43\t2\n54\t3\n65\t4".getBytes())) .build()) .query("select x.* from x inner join y on x.i = y.i where i in (select i from " + tableName - + ")") + + ") ORDER BY 1") .set("select_sequential_consistency", isCloud() ? 1 : null) .executeAndWait()) { int j = 0; + for (ClickHouseRecord r : response.records()) { Assert.assertEquals(r.getValue(0).asInteger(), j == 0 ? 1 : 4); Assert.assertEquals(r.getValue(1).asInteger(), j == 0 ? 23 : 56); diff --git a/client-v2/src/main/java/com/clickhouse/client/api/data_formats/internal/ProcessParser.java b/client-v2/src/main/java/com/clickhouse/client/api/data_formats/internal/ProcessParser.java index fb7ac0797..615b1dc19 100644 --- a/client-v2/src/main/java/com/clickhouse/client/api/data_formats/internal/ProcessParser.java +++ b/client-v2/src/main/java/com/clickhouse/client/api/data_formats/internal/ProcessParser.java @@ -18,6 +18,9 @@ public static void parseSummary(String text, OperationMetrics metrics) { parser.nextToken(); // skip START_OBJECT JsonToken t = parser.nextToken(); + for (ServerMetrics m : ServerMetrics.values()) { + metrics.updateMetric(m, -1); + } while (t != null) { if (t == JsonToken.FIELD_NAME) { String fieldName = parser.currentName(); diff --git a/client-v2/src/test/java/com/clickhouse/client/HttpTransportTests.java b/client-v2/src/test/java/com/clickhouse/client/HttpTransportTests.java index 5aaa8d424..02bcb7013 100644 --- a/client-v2/src/test/java/com/clickhouse/client/HttpTransportTests.java +++ b/client-v2/src/test/java/com/clickhouse/client/HttpTransportTests.java @@ -358,13 +358,13 @@ public void testServerErrorHandling(ClickHouseFormat format, boolean serverCompr } - try (QueryResponse response = client.query("CREATE TABLE table_from_csv AS SELECT * FROM file('empty.csv')", querySettings) + try (QueryResponse response = client.query("CREATE TABLE table_from_csv ENGINE MergeTree ORDER BY () AS SELECT * FROM file('empty.csv') ", querySettings) .get(1, TimeUnit.SECONDS)) { Assert.fail("Expected exception"); } catch (ServerException e) { e.printStackTrace(); Assert.assertEquals(e.getCode(), 636); - 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)"), + 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)"), "Unexpected error message: " + e.getMessage()); } @@ -617,8 +617,8 @@ public void testSSLAuthentication() throws Exception { } ClickHouseNode server = getSecureServer(ClickHouseProtocol.HTTP); try (Client client = new Client.Builder().addEndpoint(Protocol.HTTP, "localhost",server.getPort(), true) - .setUsername("default") - .setPassword("") + .setUsername("dba") + .setPassword("dba") .setRootCertificate("containers/clickhouse-server/certs/localhost.crt") .build()) { @@ -651,8 +651,8 @@ public void testPasswordAuthentication(String identifyWith, String identifyBy, b ClickHouseNode server = getServer(ClickHouseProtocol.HTTP); try (Client client = new Client.Builder().addEndpoint(Protocol.HTTP, "localhost",server.getPort(), false) - .setUsername("default") - .setPassword("") + .setUsername("dba") + .setPassword("dba") .build()) { try (CommandResponse resp = client.execute("DROP USER IF EXISTS some_user").get()) { @@ -714,8 +714,8 @@ public void testAuthHeaderIsKeptFromUser() throws Exception { String identifyWith = "sha256_password"; String identifyBy = "123ยง"; try (Client client = new Client.Builder().addEndpoint(Protocol.HTTP, "localhost",server.getPort(), false) - .setUsername("default") - .setPassword("") + .setUsername("dba") + .setPassword("dba") .build()) { try (CommandResponse resp = client.execute("DROP USER IF EXISTS some_user").get()) { diff --git a/client-v2/src/test/java/com/clickhouse/client/query/QueryTests.java b/client-v2/src/test/java/com/clickhouse/client/query/QueryTests.java index a738b8950..01c2467c3 100644 --- a/client-v2/src/test/java/com/clickhouse/client/query/QueryTests.java +++ b/client-v2/src/test/java/com/clickhouse/client/query/QueryTests.java @@ -1362,7 +1362,6 @@ public void testQueryMetrics() throws Exception { OperationMetrics metrics = response.getMetrics(); Assert.assertEquals(metrics.getMetric(ServerMetrics.NUM_ROWS_READ).getLong(), 30); - Assert.assertTrue(metrics.getMetric(ServerMetrics.ELAPSED_TIME).getLong() > 0); Assert.assertTrue(metrics.getMetric(ServerMetrics.RESULT_ROWS).getLong() > 0); } } @@ -1688,7 +1687,7 @@ public void testConcurrentQueries() throws Exception{ @Test(groups = {"integration"}) public void testQueryReadToPOJO() { int limit = 10; - final String sql = "SELECT toInt32(rand32()) as id, toInt32(number * 10) as age, concat('name_', number + 1) as name " + + final String sql = "SELECT toInt32(rand32()) as id, toInt32(number * 10) as age, concat('name_', toString(number + 1)) as name " + " FROM system.numbers LIMIT " + limit; TableSchema schema = client.getTableSchemaFromQuery(sql); client.register(SimplePOJO.class, schema);