Skip to content

Commit

Permalink
fixed a few more bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
chernser committed Dec 20, 2024
1 parent 9a1c71c commit 6ec4d4a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ jobs:
</toolchain>
</toolchains>
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand Down Expand Up @@ -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()) {

Expand Down Expand Up @@ -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()) {
Expand Down Expand Up @@ -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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 6ec4d4a

Please sign in to comment.