You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by "ostinru (via GitHub)" <gi...@apache.org> on 2026/04/08 13:12:13 UTC
[PR] Testcontainers: Add ClickHouse JDBC test [cloudberry-pxf]
ostinru opened a new pull request, #97:
URL: https://github.com/apache/cloudberry-pxf/pull/97
### Add ClickHouse JDBC tests
Add new tests to cover Cloudberry -> PXF -> JDBC path. In this test we are verifying that main data Cloudberry and ClickHouse types can be converted back and forth.
Test covers ClickHouse 24.x and 26.x versions. Open-source ClickHouse has short support lifetime.
I tested following clickhouse-jdbc drivers:
* 0.6.x (`jdbc-v1`) - works well with old ClickHouse versions. In ClickHouse 25.10 `jdbc-v1` got broken https://github.com/ClickHouse/clickhouse-java/issues/2636 and all queries raised an "Magic is not correct" error message.
* 0.9.4 - fixes "Magic" issues, however has issue with String <-> bytea conversion `ERROR: PXF server error : Method: getBytes("bin") encountered an exception.`
* 0.9.7+ - works well
### Add jdbc-pxf-drivers project
Add new `jdbc-pxf-drivers` project to server. It excluded from default DEB-package build. Explicit actions required to install jdbc-drivers.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
Re: [PR] Testcontainers: Add ClickHouse JDBC test [cloudberry-pxf]
Posted by "ostinru (via GitHub)" <gi...@apache.org>.
ostinru commented on code in PR #97:
URL: https://github.com/apache/cloudberry-pxf/pull/97#discussion_r3056220323
##########
server/build.gradle:
##########
@@ -374,3 +375,11 @@ task stage(type: Copy) {
doLast { new File("${buildDir}/stage/version").text = "${version}\n" }
}
+
+task stageJdbcDrivers(type: Copy) {
+ description "Copy JDBC driver JARs from pxf-jdbc-drivers to build/stage/lib."
+ dependsOn ":pxf-jdbc-drivers:jar"
+ from(project(':pxf-jdbc-drivers').configurations.runtimeClasspath)
+ into("${buildDir}/stage/lib")
+ duplicatesStrategy = DuplicatesStrategy.INCLUDE
Review Comment:
Good point. Let's try `FAIL`. In this case it will force us to manually solve dependency hell.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
Re: [PR] Testcontainers: Add ClickHouse JDBC test [cloudberry-pxf]
Posted by "ostinru (via GitHub)" <gi...@apache.org>.
ostinru commented on code in PR #97:
URL: https://github.com/apache/cloudberry-pxf/pull/97#discussion_r3056191809
##########
server/build.gradle:
##########
@@ -212,8 +212,9 @@ configure(javaProjects) {
entry("avro")
entry("avro-mapred")
}
- // Zstd support for Avro/Parquet
+ // Compression support for Avro/Parquet
dependency("com.github.luben:zstd-jni:1.5.7-6")
+ dependency("at.yawk.lz4:lz4-java:1.10.3")
Review Comment:
Maven Central says that we should use `at.yawk.lz4:lz4-java`:
https://mvnrepository.com/artifact/org.lz4/lz4-java
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
Re: [PR] Testcontainers: Add ClickHouse JDBC test [cloudberry-pxf]
Posted by "ostinru (via GitHub)" <gi...@apache.org>.
ostinru commented on code in PR #97:
URL: https://github.com/apache/cloudberry-pxf/pull/97#discussion_r3056179427
##########
server/pxf-jdbc/src/main/java/org/apache/cloudberry/pxf/plugins/jdbc/JdbcResolver.java:
##########
@@ -506,4 +507,19 @@ private <T extends TemporalAccessor> T parseTemporalAccessor(String rawVal, Date
}
return value;
}
+
+ /**
+ * Converts a BYTEA field value to byte[]. The value can arrive
+ * as byte[] (OutputFormat.GPDBWritable from external-table)
+ * as ByteBuffer (OutputFormat.TEXT from FDW)
+ */
+ private static byte[] toByteArray(Object val) {
+ if (val instanceof byte[]) {
+ return (byte[]) val;
+ }
+ ByteBuffer bb = (ByteBuffer) val;
Review Comment:
There was a bug - it always expected `byte[]`.
Original PXF authors got following error for FDW:
```
ERROR: PXF server error : class java.io.DataInputStream cannot be cast to class [B (java.io.DataInputStream and [B are in module java.base of loader 'bootstrap')
```
I have seen:
```
ERROR: PXF server error : class java.nio.HeapByteBuffer cannot be cast to class [B (java.nio.HeapByteBuffer and [B are in module java.base of loader 'bootstrap')
```
So, here I am extending old (external-table) behaviour with one more data type. So, if it will be some other type - we will see new ClassCastException here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
Re: [PR] Testcontainers: Add ClickHouse JDBC test [cloudberry-pxf]
Posted by "MisterRaindrop (via GitHub)" <gi...@apache.org>.
MisterRaindrop commented on code in PR #97:
URL: https://github.com/apache/cloudberry-pxf/pull/97#discussion_r3056002607
##########
server/Makefile:
##########
@@ -95,6 +98,20 @@ stage-notest: prepare-gradle-wrapper
install -m 700 -d "build/stage/run"
install -m 700 -d "build/stage/keytabs"
+.PHONY: stage-jdbc-drivers
+stage-jdbc-drivers: prepare-gradle-wrapper
+ rm -rf build/stage/lib
+ ./gradlew $(PXF_GRADLE_PROPERTIES) stageJdbcDrivers
+
+.PHONY: install
Review Comment:
.PHONY: install-jdbc-drivers ?
##########
server/build.gradle:
##########
@@ -374,3 +375,11 @@ task stage(type: Copy) {
doLast { new File("${buildDir}/stage/version").text = "${version}\n" }
}
+
+task stageJdbcDrivers(type: Copy) {
+ description "Copy JDBC driver JARs from pxf-jdbc-drivers to build/stage/lib."
+ dependsOn ":pxf-jdbc-drivers:jar"
+ from(project(':pxf-jdbc-drivers').configurations.runtimeClasspath)
+ into("${buildDir}/stage/lib")
+ duplicatesStrategy = DuplicatesStrategy.INCLUDE
Review Comment:
INCLUDE duplicate files are all retained, with later ones silently overwriting earlier ones, so it's unclear which version ends up being the final one.
##########
server/pxf-jdbc/src/main/java/org/apache/cloudberry/pxf/plugins/jdbc/JdbcResolver.java:
##########
@@ -506,4 +507,19 @@ private <T extends TemporalAccessor> T parseTemporalAccessor(String rawVal, Date
}
return value;
}
+
+ /**
+ * Converts a BYTEA field value to byte[]. The value can arrive
+ * as byte[] (OutputFormat.GPDBWritable from external-table)
+ * as ByteBuffer (OutputFormat.TEXT from FDW)
+ */
+ private static byte[] toByteArray(Object val) {
+ if (val instanceof byte[]) {
+ return (byte[]) val;
+ }
+ ByteBuffer bb = (ByteBuffer) val;
Review Comment:
ByteBuffer bb = (ByteBuffer) val;
If the types do not match, a ClassCastException will be thrown directly is better?
##########
server/build.gradle:
##########
@@ -212,8 +212,9 @@ configure(javaProjects) {
entry("avro")
entry("avro-mapred")
}
- // Zstd support for Avro/Parquet
+ // Compression support for Avro/Parquet
dependency("com.github.luben:zstd-jni:1.5.7-6")
+ dependency("at.yawk.lz4:lz4-java:1.10.3")
Review Comment:
why not org.lz4:lz4-java ?
##########
server/pxf-jdbc-drivers/build.gradle:
##########
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+dependencies {
+ // PostgreSQL driver is used by PXF itself.
Review Comment:
PostgreSQL driver? this is clickhouse driver?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
Re: [PR] Testcontainers: Add ClickHouse JDBC test [cloudberry-pxf]
Posted by "ostinru (via GitHub)" <gi...@apache.org>.
ostinru commented on code in PR #97:
URL: https://github.com/apache/cloudberry-pxf/pull/97#discussion_r3056186739
##########
server/pxf-jdbc-drivers/build.gradle:
##########
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+dependencies {
+ // PostgreSQL driver is used by PXF itself.
Review Comment:
PostgreSQL driver included[1] into PXF distribution by default. No need to add it to libs. So, I left a comment about this.
[1] https://github.com/apache/cloudberry-pxf/blob/main/server/pxf-jdbc/build.gradle#L28
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
Re: [PR] Testcontainers: Add ClickHouse JDBC test [cloudberry-pxf]
Posted by "ostinru (via GitHub)" <gi...@apache.org>.
ostinru merged PR #97:
URL: https://github.com/apache/cloudberry-pxf/pull/97
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org