This is an automated email from the ASF dual-hosted git repository.
jt2594838 pushed a commit to branch dev/1.3
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/dev/1.3 by this push:
new ec2d51ef82f Pipe: Load TsFile classes from parent class loader (#18579)
ec2d51ef82f is described below
commit ec2d51ef82f813d6c36c4381ffaa631b451757a0
Author: Caideyipi <[email protected]>
AuthorDate: Tue Sep 8 16:07:50 2026 +0800
Pipe: Load TsFile classes from parent class loader (#18579)
---
.../plugin/service/PipePluginClassLoader.java | 8 ++++-
.../plugin/service/PipePluginClassLoaderTest.java | 35 ++++++++++++++++++++++
2 files changed, 42 insertions(+), 1 deletion(-)
diff --git
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/agent/plugin/service/PipePluginClassLoader.java
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/agent/plugin/service/PipePluginClassLoader.java
index 745d93566fc..fb11975c226 100644
---
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/agent/plugin/service/PipePluginClassLoader.java
+++
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/agent/plugin/service/PipePluginClassLoader.java
@@ -36,7 +36,13 @@ import java.util.stream.Stream;
public class PipePluginClassLoader extends URLClassLoader {
private static final String[] PARENT_FIRST_CLASS_PREFIXES = {
- "java.", "javax.", "jdk.", "sun.", "org.slf4j.",
"org.apache.iotdb.pipe.api."
+ "java.",
+ "javax.",
+ "jdk.",
+ "sun.",
+ "org.slf4j.",
+ "org.apache.iotdb.pipe.api.",
+ "org.apache.tsfile."
};
private final String libRoot;
diff --git
a/iotdb-core/node-commons/src/test/java/org/apache/iotdb/commons/pipe/agent/plugin/service/PipePluginClassLoaderTest.java
b/iotdb-core/node-commons/src/test/java/org/apache/iotdb/commons/pipe/agent/plugin/service/PipePluginClassLoaderTest.java
index 39126656fc1..bff221bd2cc 100644
---
a/iotdb-core/node-commons/src/test/java/org/apache/iotdb/commons/pipe/agent/plugin/service/PipePluginClassLoaderTest.java
+++
b/iotdb-core/node-commons/src/test/java/org/apache/iotdb/commons/pipe/agent/plugin/service/PipePluginClassLoaderTest.java
@@ -45,6 +45,41 @@ import java.util.stream.Stream;
public class PipePluginClassLoaderTest {
+ @Test
+ public void testTsFileClassesShouldBeLoadedFromParent() throws Exception {
+ final Path tempDir =
Files.createTempDirectory("pipe-plugin-tsfile-classloader-test");
+ try {
+ final Path childSources =
Files.createDirectory(tempDir.resolve("child-sources"));
+ final Path childClasses =
Files.createDirectory(tempDir.resolve("child-classes"));
+ final String tabletClassName = "org.apache.tsfile.write.record.Tablet";
+ final String childTabletSource =
+ "package org.apache.tsfile.write.record;"
+ + "public class Tablet {"
+ + " public String source() {"
+ + " return \"child\";"
+ + " }"
+ + "}";
+ final Map<String, String> childSourceMap = new LinkedHashMap<>();
+ childSourceMap.put(tabletClassName, childTabletSource);
+ compile(childSources, childClasses, childSourceMap);
+
+ final Path childJar = tempDir.resolve("child.jar");
+ createJar(
+ childJar, childClasses,
Arrays.asList("org/apache/tsfile/write/record/Tablet.class"));
+
+ final ClassLoader parentClassLoader =
PipePluginClassLoaderTest.class.getClassLoader();
+ final Class<?> parentTabletClass = Class.forName(tabletClassName, true,
parentClassLoader);
+ try (final PipePluginClassLoader pluginClassLoader =
+ new PipePluginClassLoader(childJar.toString(), parentClassLoader)) {
+ final Class<?> pluginTabletClass = Class.forName(tabletClassName,
true, pluginClassLoader);
+ Assert.assertSame(parentTabletClass, pluginTabletClass);
+ Assert.assertNotSame(pluginClassLoader,
pluginTabletClass.getClassLoader());
+ }
+ } finally {
+ deleteRecursively(tempDir);
+ }
+ }
+
@Test
public void testPluginClassesShouldOverrideParentClasses() throws Exception {
final Path tempDir =
Files.createTempDirectory("pipe-plugin-classloader-test");