Skip to content

Commit be67860

Browse files
authored
Merge pull request #2821 from ClickHouse/04/10/26/fix_head_tests
Fix tests against HEAD
2 parents 32b348b + a5bd8a1 commit be67860

3 files changed

Lines changed: 16 additions & 7 deletions

File tree

clickhouse-jdbc/src/test/java/com/clickhouse/jdbc/GenericJDBCTest.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
package com.clickhouse.jdbc;
22

33
import org.testng.Assert;
4-
import org.testng.annotations.BeforeClass;
54
import org.testng.annotations.Test;
65

7-
import java.sql.*;
6+
import java.sql.Connection;
7+
import java.sql.PreparedStatement;
8+
import java.sql.ResultSet;
9+
import java.sql.SQLException;
10+
import java.sql.Statement;
811
import java.util.Properties;
912

13+
import static org.testng.Assert.assertFalse;
1014
import static org.testng.Assert.assertThrows;
1115

1216
@Test(groups = { "integration" })
@@ -33,7 +37,7 @@ public void connectionWithPropertiesTest() throws SQLException {
3337
properties.setProperty("user", "default");
3438
properties.setProperty("password", "FAKE123456FAKE");
3539

36-
assertThrows(SQLException.class, () -> getConnection(properties));
40+
assertFalse(getConnection(properties).isValid(10));
3741
}
3842

3943
@Test

jdbc-v2/src/main/java/com/clickhouse/jdbc/internal/JdbcConfiguration.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,14 +217,17 @@ private Map<String, String> parseUrl(String url) throws SQLException {
217217
String pathWithoutLeadingSlash = rawPath.startsWith("/") ? rawPath.substring(1) : rawPath;
218218
int lastSlashIndex = pathWithoutLeadingSlash.lastIndexOf('/');
219219

220+
String pathToDecode;
220221
if (lastSlashIndex > 0) {
221222
httpPath = "/" + pathWithoutLeadingSlash.substring(0, lastSlashIndex);
222-
database = URLDecoder.decode(pathWithoutLeadingSlash.substring(lastSlashIndex + 1), StandardCharsets.UTF_8);
223+
pathToDecode = pathWithoutLeadingSlash.substring(lastSlashIndex + 1);
223224
} else {
224225
// No slash found (lastSlashIndex == -1), so it's a single segment representing the database name.
225226
// Example: "mydb" -> httpPath="", database="mydb"
226-
database = URLDecoder.decode(pathWithoutLeadingSlash, StandardCharsets.UTF_8);
227+
pathToDecode = pathWithoutLeadingSlash;
227228
}
229+
// requires 10+ java database = URLDecoder.decode(pathWithoutLeadingSlash.substring(lastSlashIndex + 1), StandardCharsets.UTF_8);
230+
database = URLDecoder.decode(pathToDecode);
228231
}
229232

230233
// Build connection URL with HTTP path preserved

jdbc-v2/src/main/java/com/clickhouse/jdbc/internal/parser/javacc/ClickHouseSqlUtils.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,11 @@ private static Set<String> initAllowedKeywordAliases() {
6161
"USER", "VALID", "VALUES", "VARYING", "VIEW", "VISIBLE", "VOLUME", "WATCH", "WATERMARK", "WEEK",
6262
"WEEKS", "WHEN", "WITH_ITEMINDEX", "WK", "WORKER", "WORKLOAD", "WRITABLE", "WRITE", "WW",
6363
"YEAR", "YEARS", "YY", "YYYY", "ZKPATH",
64-
// Append 04/01/2026.
64+
// Appended 04/01/2026.
6565
"CENTURY", "DECADE", "DOW", "DOY", "EPOCH", "ISODOW", "ISOYEAR", "MILLENNIUM", "NATURAL", "SOME",
66-
"ZONE"
66+
"ZONE",
67+
// Appended 04/10/2026
68+
"PATH", "PLACING"
6769
);
6870
}
6971

0 commit comments

Comments
 (0)