Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion automation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@
<dependency>
<groupId>com.clickhouse</groupId>
<artifactId>clickhouse-jdbc</artifactId>
<version>0.9.8</version>
<version>0.11.1</version>
<classifier>all</classifier>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ public class JdbcClickhouseTest extends AbstractTestcontainersTest {
// PXF protocol compression options passed via LOCATION user parameters.
private static final String PROTOCOL_COMPRESS_ENABLED = "compress=true";
private static final String PROTOCOL_COMPRESS_ALGORITHM_LZ4 = "compress_algorithm=lz4";
private static final String HTTP_CONNECTION_PROVIDER_APACHE = "http_connection_provider=APACHE_HTTP_CLIENT";

/** PXF external/foreign table column definitions — same for read and write tests. */
private static final String[] CLICKHOUSE_PXF_FIELDS = new String[] {
Expand Down Expand Up @@ -103,7 +102,7 @@ public static Object[][] clickhouseVersions() {
{ "24" },
// ClickHouse 25.10+ doesn't work with old JDBC drivers
// https://github.com/ClickHouse/clickhouse-java/issues/2636
{ "26.2" },
{ "26.9" },
};
}

Expand Down Expand Up @@ -137,11 +136,6 @@ public void readSupportedTypesWithProtocolCompression() throws Exception {
runReadSupportedTypes(clickhouseContainer.getInternalJdbcUrl(), clickhouseContainer.getJdbcUrl(), true);
}

@Test(groups = {"testcontainers", "pxf-jdbc"})
public void readSupportedTypesWithHttpConnectionProvider() throws Exception {
runReadSupportedTypes(clickhouseContainer.getInternalJdbcUrl(), clickhouseContainer.getJdbcUrl(), false, true);
}

@Test(groups = {"testcontainers", "pxf-jdbc"})
public void writeSupportedTypes() throws Exception {
runWriteSupportedTypes(clickhouseContainer.getInternalJdbcUrl(), clickhouseContainer.getJdbcUrl(), false);
Expand All @@ -152,21 +146,7 @@ public void writeSupportedTypesWithProtocolCompression() throws Exception {
runWriteSupportedTypes(clickhouseContainer.getInternalJdbcUrl(), clickhouseContainer.getJdbcUrl(), true);
}

@Test(groups = {"testcontainers", "pxf-jdbc"})
public void writeSupportedTypesWithHttpConnectionProvider() throws Exception {
runWriteSupportedTypes(clickhouseContainer.getInternalJdbcUrl(), clickhouseContainer.getJdbcUrl(), false, true);
}

@Test(groups = {"testcontainers", "pxf-jdbc"})
public void writeSupportedTypesWithHttpConnectionProviderAndCompression() throws Exception {
runWriteSupportedTypes(clickhouseContainer.getInternalJdbcUrl(), clickhouseContainer.getJdbcUrl(), true, true);
}

private void runReadSupportedTypes(String internalJdbcUrl, String externalJdbcUrl, boolean enableProtocolCompression) throws Exception {
runReadSupportedTypes(internalJdbcUrl, externalJdbcUrl, enableProtocolCompression, false);
}

private void runReadSupportedTypes(String internalJdbcUrl, String externalJdbcUrl, boolean enableProtocolCompression, boolean enableHttpConnectionProvider) throws Exception {
createAndSeedClickhouseReadTable(externalJdbcUrl);

ExternalTable pxfRead = TableFactory.getPxfJdbcReadableTable(
Expand All @@ -183,9 +163,6 @@ private void runReadSupportedTypes(String internalJdbcUrl, String externalJdbcUr
pxfRead.addUserParameter(PROTOCOL_COMPRESS_ENABLED);
pxfRead.addUserParameter(PROTOCOL_COMPRESS_ALGORITHM_LZ4);
}
if (enableHttpConnectionProvider) {
pxfRead.addUserParameter(HTTP_CONNECTION_PROVIDER_APACHE);
}
cloudberry.createTableAndVerify(pxfRead);

try {
Expand All @@ -196,10 +173,6 @@ private void runReadSupportedTypes(String internalJdbcUrl, String externalJdbcUr
}

private void runWriteSupportedTypes(String internalJdbcUrl, String externalJdbcUrl, boolean enableProtocolCompression) throws Exception {
runWriteSupportedTypes(internalJdbcUrl, externalJdbcUrl, enableProtocolCompression, false);
}

private void runWriteSupportedTypes(String internalJdbcUrl, String externalJdbcUrl, boolean enableProtocolCompression, boolean enableHttpConnectionProvider) throws Exception {
createClickhouseWriteTable(externalJdbcUrl);

ExternalTable pxfWrite = TableFactory.getPxfJdbcWritableTable(
Expand All @@ -216,9 +189,6 @@ private void runWriteSupportedTypes(String internalJdbcUrl, String externalJdbcU
pxfWrite.addUserParameter(PROTOCOL_COMPRESS_ENABLED);
pxfWrite.addUserParameter(PROTOCOL_COMPRESS_ALGORITHM_LZ4);
}
if (enableHttpConnectionProvider) {
pxfWrite.addUserParameter(HTTP_CONNECTION_PROVIDER_APACHE);
}
cloudberry.createTableAndVerify(pxfWrite);

ExternalTable pxfVerify = TableFactory.getPxfJdbcReadableTable(
Expand All @@ -235,9 +205,6 @@ private void runWriteSupportedTypes(String internalJdbcUrl, String externalJdbcU
pxfVerify.addUserParameter(PROTOCOL_COMPRESS_ENABLED);
pxfVerify.addUserParameter(PROTOCOL_COMPRESS_ALGORITHM_LZ4);
}
if (enableHttpConnectionProvider) {
pxfVerify.addUserParameter(HTTP_CONNECTION_PROVIDER_APACHE);
}
cloudberry.createTableAndVerify(pxfVerify);

try {
Expand Down
2 changes: 1 addition & 1 deletion docs/access-jdbc/jdbc_pxf_clickhouse.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ You do **not** need a `servers/clickhouse/jdbc-site.xml` if you pass connection

Automated tests exercise ClickHouse server versions **24** and **26** together with the ClickHouse JDBC drivers.

For ClickHouse we recommend latest clickhouse-jdbc-all:0.9.7 or newer (fat jar version with shaded dependencies). In case you observe HTTP reliably issues you can use Apache HttpClient: add the JDBC URL parameter `http_connection_provider=APACHE_HTTP_CLIENT` (for example `jdbc:clickhouse://clickhousehost:8123/default?http_connection_provider=APACHE_HTTP_CLIENT`).
For ClickHouse we recommend latest clickhouse-jdbc-all:0.11.1 or newer (fat jar version with shaded dependencies).


## Read from the ClickHouse Table
Expand Down
2 changes: 1 addition & 1 deletion server/pxf-jdbc-drivers/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dependencies {
// Its version is defined in server/build.gradle

// Clickhouse
implementation('com.clickhouse:clickhouse-jdbc:0.9.8:all') { transitive = false }
implementation('com.clickhouse:clickhouse-jdbc:0.11.1:all') { transitive = false }

// Oracle
implementation('com.oracle.database.jdbc:ojdbc11:23.3.0.23.09')
Expand Down
Loading