You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "xylaaaaa (via GitHub)" <gi...@apache.org> on 2026/03/31 04:49:09 UTC
[PR] branch-4.1: [fix](fe) Fix Paimon JDBC driver registration for JNI scans (#61513) [doris]
xylaaaaa opened a new pull request, #61923:
URL: https://github.com/apache/doris/pull/61923
## Summary
- Cherry-pick #61513 onto `branch-4.1`
- Propagate JDBC driver metadata to BE for Paimon JDBC system-table JNI scans
- Register the JDBC driver in a DriverManager-visible classloader before Paimon table initialization
- Extend the regression case to cover all supported Paimon JDBC system tables
## Root Cause
Paimon JDBC system-table queries that ran through the BE JNI scanner could fail to initialize the PostgreSQL JDBC driver and returned `No suitable driver found`.
## Backport Note
- Resolved the cherry-pick conflict in `be/src/format/table/paimon_jni_reader.cpp` by keeping the `branch-4.1` JniReader construction path and porting the scan-level `paimon_options` fallback logic
## Validation
- `git diff --check origin/branch-4.1..HEAD`
- Not run: FE/BE unit tests or regression tests in this worktree
--
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@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] branch-4.1: [fix](fe) Fix Paimon JDBC driver registration for JNI scans (#61513) [doris]
Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei merged PR #61923:
URL: https://github.com/apache/doris/pull/61923
--
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@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] branch-4.1: [fix](fe) Fix Paimon JDBC driver registration for JNI scans (#61513) [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #61923:
URL: https://github.com/apache/doris/pull/61923#issuecomment-4161089319
# BE Regression && UT Coverage Report
Increment line coverage `0.00% (0/14)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/61923_918b41bbe5f064c01ce4f6c2de7ad1e6794e9268_merge/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/61923_918b41bbe5f064c01ce4f6c2de7ad1e6794e9268_merge/report/index.html)
| Category | Coverage |
|-------------------|--------------------|
| Function Coverage | 70.84% (25823/36452) |
| Line Coverage | 53.66% (271904/506713) |
| Region Coverage | 50.89% (224964/442072) |
| Branch Coverage | 52.40% (97636/186318) |
--
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@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] branch-4.1: [fix](fe) Fix Paimon JDBC driver registration for JNI scans (#61513) [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #61923:
URL: https://github.com/apache/doris/pull/61923#issuecomment-4161036978
# BE UT Coverage Report
Increment line coverage `0.00% (0/14)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/918b41bbe5f064c01ce4f6c2de7ad1e6794e9268_918b41bbe5f064c01ce4f6c2de7ad1e6794e9268/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/918b41bbe5f064c01ce4f6c2de7ad1e6794e9268_918b41bbe5f064c01ce4f6c2de7ad1e6794e9268/report/index.html)
| Category | Coverage |
|-------------------|--------------------|
| Function Coverage | 52.84% (19678/37244) |
| Line Coverage | 36.23% (184190/508423) |
| Region Coverage | 32.52% (142455/438110) |
| Branch Coverage | 33.70% (62618/185790) |
--
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@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] branch-4.1: [fix](fe) Fix Paimon JDBC driver registration for JNI scans (#61513) [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #61923:
URL: https://github.com/apache/doris/pull/61923#issuecomment-4159989021
# Cloud UT Coverage Report
Increment line coverage ` ` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/918b41bbe5f064c01ce4f6c2de7ad1e6794e9268_918b41bbe5f064c01ce4f6c2de7ad1e6794e9268_cloud/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/918b41bbe5f064c01ce4f6c2de7ad1e6794e9268_918b41bbe5f064c01ce4f6c2de7ad1e6794e9268_cloud/report/index.html)
| Category | Coverage |
|-------------------|--------------------|
| Function Coverage | 78.57% (1789/2277) |
| Line Coverage | 64.41% (32141/49898) |
| Region Coverage | 65.25% (16074/24633) |
| Branch Coverage | 55.80% (8569/15356) |
--
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@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] branch-4.1: [fix](fe) Fix Paimon JDBC driver registration for JNI scans (#61513) [doris]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #61923:
URL: https://github.com/apache/doris/pull/61923#issuecomment-4161571432
PR approved by at least one committer and no changes requested.
--
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@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] branch-4.1: [fix](fe) Fix Paimon JDBC driver registration for JNI scans (#61513) [doris]
Posted by "xylaaaaa (via GitHub)" <gi...@apache.org>.
xylaaaaa commented on PR #61923:
URL: https://github.com/apache/doris/pull/61923#issuecomment-4159865297
run buildall
--
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@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] branch-4.1: [fix](fe) Fix Paimon JDBC driver registration for JNI scans (#61513) [doris]
Posted by "Thearas (via GitHub)" <gi...@apache.org>.
Thearas commented on PR #61923:
URL: https://github.com/apache/doris/pull/61923#issuecomment-4159858968
Thank you for your contribution to Apache Doris.
Don't know what should be done next? See [How to process your PR](https://cwiki.apache.org/confluence/display/DORIS/How+to+process+your+PR).
Please clearly describe your PR:
1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
3. What features were added. Why was this function added?
4. Which code was refactored and why was this part of the code refactored?
5. Which functions were optimized and what is the difference before and after the optimization?
--
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@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] branch-4.1: [fix](fe) Fix Paimon JDBC driver registration for JNI scans (#61513) [doris]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #61923:
URL: https://github.com/apache/doris/pull/61923#discussion_r3013500640
##########
fe/be-java-extensions/paimon-scanner/src/test/java/org/apache/doris/paimon/PaimonJdbcDriverUtilsTest.java:
##########
@@ -0,0 +1,139 @@
+// 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.
+
+package org.apache.doris.paimon;
+
+import org.apache.doris.common.classloader.JniScannerClassLoader;
+
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.sql.Driver;
+import java.sql.DriverManager;
+import java.sql.DriverPropertyInfo;
+import java.sql.SQLFeatureNotSupportedException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.jar.JarEntry;
+import java.util.jar.JarOutputStream;
+import java.util.logging.Logger;
+
+public class PaimonJdbcDriverUtilsTest {
+ private final List<Driver> registeredDrivers = new ArrayList<>();
+ private final List<Path> tempJars = new ArrayList<>();
+
+ @After
+ public void tearDown() throws Exception {
+ for (Driver driver : registeredDrivers) {
+ DriverManager.deregisterDriver(driver);
+ }
+ registeredDrivers.clear();
+ for (Path tempJar : tempJars) {
+ Files.deleteIfExists(tempJar);
+ }
+ tempJars.clear();
+ }
+
+ @Test
+ public void testRegisterDriverIfNeeded() throws Exception {
+ Path driverJar = createDriverJar();
+ Map<String, String> params = new HashMap<>();
+ params.put(PaimonJdbcDriverUtils.PAIMON_JDBC_DRIVER_URL, driverJar.toUri().toURL().toString());
+ params.put(PaimonJdbcDriverUtils.PAIMON_JDBC_DRIVER_CLASS, DummyJdbcDriver.class.getName());
+
+ JniScannerClassLoader scannerClassLoader =
+ new JniScannerClassLoader("paimon-test", List.of(), ClassLoader.getPlatformClassLoader());
+ PaimonJdbcDriverUtils.registerDriverIfNeeded(params, scannerClassLoader);
+
+ Driver driver = DriverManager.getDriver("jdbc:dummy:test");
+ registeredDrivers.add(driver);
+ Assert.assertTrue(driver.acceptsURL("jdbc:dummy:test"));
+ }
+
+ @Test
+ public void testRegisterDriverIfNeededRequiresDriverClass() {
+ Map<String, String> params = new HashMap<>();
+ params.put(PaimonJdbcDriverUtils.PAIMON_JDBC_DRIVER_URL, "file:///tmp/postgresql-42.5.0.jar");
+
+ IllegalArgumentException exception = Assert.assertThrows(IllegalArgumentException.class,
+ () -> PaimonJdbcDriverUtils.registerDriverIfNeeded(params, getClass().getClassLoader()));
+ Assert.assertTrue(exception.getMessage().contains("driver_class"));
+ }
+
+ private Path createDriverJar() throws IOException {
+ Path jarPath = Files.createTempFile("paimon-jdbc-driver", ".jar");
+ tempJars.add(jarPath);
+ String resourceName = DummyJdbcDriver.class.getName().replace('.', '/') + ".class";
+ try (JarOutputStream jarOutputStream = new JarOutputStream(Files.newOutputStream(jarPath));
+ InputStream inputStream = DummyJdbcDriver.class.getClassLoader().getResourceAsStream(resourceName)) {
+ Assert.assertNotNull(inputStream);
+ jarOutputStream.putNextEntry(new JarEntry(resourceName));
+ byte[] buffer = new byte[4096];
+ int bytesRead;
+ while ((bytesRead = inputStream.read(buffer)) >= 0) {
Review Comment:
In createDriverJar(), the copy loop uses `while ((bytesRead = inputStream.read(buffer)) >= 0)`. Although uncommon, `InputStream.read(byte[])` is allowed to return `0`, which would make this loop potentially non-terminating and hang the test. Consider looping until `-1` and only writing when `bytesRead > 0` (or using a standard copy helper).
```suggestion
while ((bytesRead = inputStream.read(buffer)) > 0) {
```
--
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@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] branch-4.1: [fix](fe) Fix Paimon JDBC driver registration for JNI scans (#61513) [doris]
Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei commented on PR #61923:
URL: https://github.com/apache/doris/pull/61923#issuecomment-4161704325
skip buildall
--
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@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] branch-4.1: [fix](fe) Fix Paimon JDBC driver registration for JNI scans (#61513) [doris]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #61923:
URL: https://github.com/apache/doris/pull/61923#issuecomment-4161571668
PR approved by anyone and no changes requested.
--
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@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org