You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ju...@apache.org on 2025/11/17 03:05:24 UTC

(iotdb) branch dev/1.3 updated: [To dev/1.3] Pipe: support path exclusion under tree model (#16632) (#16763)

This is an automated email from the ASF dual-hosted git repository.

justinchen 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 3d79e36bdf7 [To dev/1.3] Pipe: support path exclusion under tree model (#16632) (#16763)
3d79e36bdf7 is described below

commit 3d79e36bdf70a5afd5d922a2b51ca184d27e25cb
Author: VGalaxies <vg...@apache.org>
AuthorDate: Mon Nov 17 11:05:18 2025 +0800

    [To dev/1.3] Pipe: support path exclusion under tree model (#16632) (#16763)
    
    * setup
    
    * FIN
---
 .../it/autocreate/IoTDBPipePatternFormatIT.java    | 616 ++++++++++++---------
 .../iotdb/pipe/it/manual/IoTDBPipeInclusionIT.java |  74 +++
 .../receiver/protocol/IoTDBConfigNodeReceiver.java |   9 +-
 .../PipeConfigPhysicalPlanPatternParseVisitor.java |  44 +-
 ...eConfigPhysicalPlanPatternParseVisitorTest.java |   7 +-
 .../agent/task/connection/PipeEventCollector.java  |   5 +-
 .../TsFileInsertionDataContainerProvider.java      |   6 +-
 .../protocol/thrift/IoTDBDataNodeReceiver.java     |   9 +-
 .../visitor/PipeStatementPatternParseVisitor.java  |  22 +-
 .../source/dataregion/IoTDBDataRegionSource.java   |   6 +-
 .../schemaregion/PipePlanPatternParseVisitor.java  |  39 +-
 .../db/pipe/pattern/PipePatternCoverageTest.java   | 133 +++++
 .../sink/PipeStatementPatternParseVisitorTest.java | 207 ++++---
 .../source/PipePlanPatternParseVisitorTest.java    |   7 +-
 .../pipe/config/constant/PipeSourceConstant.java   |   4 +
 .../datastructure/pattern/IoTDBPipePattern.java    |  62 ++-
 .../pattern/IoTDBPipePatternOperations.java        |  48 ++
 .../pipe/datastructure/pattern/PipePattern.java    | 338 +++++++++--
 .../datastructure/pattern/PrefixPipePattern.java   |  65 ++-
 .../datastructure/pattern/SinglePipePattern.java   |  53 --
 .../pattern/UnionIoTDBPipePattern.java             | 115 ++--
 .../datastructure/pattern/UnionPipePattern.java    |  17 +-
 .../pattern/WithExclusionIoTDBPipePattern.java     | 201 +++++++
 .../pattern/WithExclusionPipePattern.java          | 112 ++++
 .../pipe/source/IoTDBNonDataRegionSource.java      |  10 +-
 25 files changed, 1625 insertions(+), 584 deletions(-)

diff --git a/integration-test/src/test/java/org/apache/iotdb/pipe/it/autocreate/IoTDBPipePatternFormatIT.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/autocreate/IoTDBPipePatternFormatIT.java
index 2ef920a9cd2..e5ebc61d105 100644
--- a/integration-test/src/test/java/org/apache/iotdb/pipe/it/autocreate/IoTDBPipePatternFormatIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/pipe/it/autocreate/IoTDBPipePatternFormatIT.java
@@ -36,6 +36,7 @@ import org.junit.runner.RunWith;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
@@ -196,323 +197,400 @@ public class IoTDBPipePatternFormatIT extends AbstractPipeDualAutoIT {
     }
   }
 
-  @Test
-  public void testMultiplePrefixPatternHistoricalData() throws Exception {
-    final DataNodeWrapper receiverDataNode = receiverEnv.getDataNodeWrapper(0);
-
-    final String receiverIp = receiverDataNode.getIp();
-    final int receiverPort = receiverDataNode.getPort();
-
-    try (final SyncConfigNodeIServiceClient client =
-        (SyncConfigNodeIServiceClient) senderEnv.getLeaderConfigNodeConnection()) {
-      final Map<String, String> extractorAttributes = new HashMap<>();
-      final Map<String, String> processorAttributes = new HashMap<>();
-      final Map<String, String> connectorAttributes = new HashMap<>();
-
-      extractorAttributes.put("extractor.pattern", "root.db.d1.s, root.db2.d1.s");
-      extractorAttributes.put("extractor.inclusion", "data.insert");
-
-      connectorAttributes.put("connector", "iotdb-thrift-connector");
-      connectorAttributes.put("connector.batch.enable", "false");
-      connectorAttributes.put("connector.ip", receiverIp);
-      connectorAttributes.put("connector.port", Integer.toString(receiverPort));
-
-      if (!TestUtils.tryExecuteNonQueriesWithRetry(
-          senderEnv,
-          Arrays.asList(
-              "insert into root.db.d1(time, s, s1) values (1, 1, 1)",
-              "insert into root.db.d2(time, s) values (2, 2)",
-              "insert into root.db2.d1(time, s) values (3, 3)"))) {
-        return;
-      }
-
-      final TSStatus status =
-          client.createPipe(
-              new TCreatePipeReq("p1", connectorAttributes)
-                  .setExtractorAttributes(extractorAttributes)
-                  .setProcessorAttributes(processorAttributes));
-
-      Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode());
+  //////////////////////////// Multiple & Exclusion ////////////////////////////
 
-      Assert.assertEquals(
-          TSStatusCode.SUCCESS_STATUS.getStatusCode(), client.startPipe("p1").getCode());
+  private void testPipeWithMultiplePatterns(
+      final Map<String, String> extractorAttributes,
+      final List<String> insertQueries,
+      final boolean isHistorical,
+      final String validationSelectQuery,
+      final String validationSelectHeader,
+      final Set<String> expectedResultSet)
+      throws Exception {
 
-      final Set<String> expectedResSet = new HashSet<>();
-      expectedResSet.add("1,null,1.0,1.0,");
-      expectedResSet.add("3,3.0,null,null,");
-      TestUtils.assertDataEventuallyOnEnv(
-          receiverEnv,
-          "select * from root.db2.**,root.db.**",
-          "Time,root.db2.d1.s,root.db.d1.s,root.db.d1.s1,",
-          expectedResSet);
-    }
-  }
-
-  @Test
-  public void testMultipleIoTDBPatternHistoricalData() throws Exception {
+    // 1. Get receiver connection details
     final DataNodeWrapper receiverDataNode = receiverEnv.getDataNodeWrapper(0);
-
     final String receiverIp = receiverDataNode.getIp();
     final int receiverPort = receiverDataNode.getPort();
 
     try (final SyncConfigNodeIServiceClient client =
         (SyncConfigNodeIServiceClient) senderEnv.getLeaderConfigNodeConnection()) {
-      final Map<String, String> extractorAttributes = new HashMap<>();
+
+      // 2. Define standard processor and connector attributes
       final Map<String, String> processorAttributes = new HashMap<>();
       final Map<String, String> connectorAttributes = new HashMap<>();
-
-      extractorAttributes.put("extractor.path", "root.db.**, root.db2.d1.*");
-      extractorAttributes.put("extractor.inclusion", "data.insert");
-
       connectorAttributes.put("connector", "iotdb-thrift-connector");
       connectorAttributes.put("connector.batch.enable", "false");
       connectorAttributes.put("connector.ip", receiverIp);
       connectorAttributes.put("connector.port", Integer.toString(receiverPort));
 
-      if (!TestUtils.tryExecuteNonQueriesWithRetry(
-          senderEnv,
-          Arrays.asList(
-              "insert into root.db.d1(time, s, s1) values (1, 1, 1)",
-              "insert into root.db.d2(time, s) values (2, 2)",
-              "insert into root.db2.d1(time, s, t) values (3, 3, 3)",
-              "insert into root.db3.d1(time, s) values (4, 4)"))) {
-        return;
+      // 3. Handle historical data insertion (if applicable)
+      if (isHistorical) {
+        if (!TestUtils.tryExecuteNonQueriesWithRetry(senderEnv, insertQueries)) {
+          return;
+        }
       }
 
-      final TSStatus status =
+      // 4. Create the pipe
+      final TSStatus createStatus =
           client.createPipe(
               new TCreatePipeReq("p1", connectorAttributes)
                   .setExtractorAttributes(extractorAttributes)
                   .setProcessorAttributes(processorAttributes));
+      Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), createStatus.getCode());
 
-      Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode());
+      // 5. Start the pipe
+      final TSStatus startStatus = client.startPipe("p1");
+      Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), startStatus.getCode());
 
-      Assert.assertEquals(
-          TSStatusCode.SUCCESS_STATUS.getStatusCode(), client.startPipe("p1").getCode());
+      // 6. Handle realtime data insertion (if applicable)
+      if (!isHistorical) {
+        if (!TestUtils.tryExecuteNonQueriesWithRetry(senderEnv, insertQueries)) {
+          return;
+        }
+      }
 
-      final Set<String> expectedResSet = new HashSet<>();
-      expectedResSet.add("1,null,null,1.0,1.0,null,");
-      expectedResSet.add("2,null,null,null,null,2.0,");
-      expectedResSet.add("3,3.0,3.0,null,null,null,");
+      // 7. Validate data eventually arrives on the receiver
       TestUtils.assertDataEventuallyOnEnv(
-          receiverEnv,
-          "select * from root.db2.**,root.db.**",
-          "Time,root.db2.d1.s,root.db2.d1.t,root.db.d1.s,root.db.d1.s1,root.db.d2.s,",
-          expectedResSet);
+          receiverEnv, validationSelectQuery, validationSelectHeader, expectedResultSet);
     }
   }
 
   @Test
-  public void testMultipleHybridPatternHistoricalData() throws Exception {
-    final DataNodeWrapper receiverDataNode = receiverEnv.getDataNodeWrapper(0);
-
-    final String receiverIp = receiverDataNode.getIp();
-    final int receiverPort = receiverDataNode.getPort();
-
-    try (final SyncConfigNodeIServiceClient client =
-        (SyncConfigNodeIServiceClient) senderEnv.getLeaderConfigNodeConnection()) {
-      final Map<String, String> extractorAttributes = new HashMap<>();
-      final Map<String, String> processorAttributes = new HashMap<>();
-      final Map<String, String> connectorAttributes = new HashMap<>();
-
-      extractorAttributes.put("extractor.path", "root.db.d1.*");
-      extractorAttributes.put("extractor.pattern", "root.db2.d1.s");
-      extractorAttributes.put("extractor.inclusion", "data.insert");
-
-      connectorAttributes.put("connector", "iotdb-thrift-connector");
-      connectorAttributes.put("connector.batch.enable", "false");
-      connectorAttributes.put("connector.ip", receiverIp);
-      connectorAttributes.put("connector.port", Integer.toString(receiverPort));
-
-      if (!TestUtils.tryExecuteNonQueriesWithRetry(
-          senderEnv,
-          Arrays.asList(
-              "insert into root.db.d1(time, s, s1) values (1, 1, 1)",
-              "insert into root.db2.d1(time, s) values (2, 2)",
-              "insert into root.db3.d1(time, s) values (3, 3)"))) {
-        return;
-      }
-
-      final TSStatus status =
-          client.createPipe(
-              new TCreatePipeReq("p1", connectorAttributes)
-                  .setExtractorAttributes(extractorAttributes)
-                  .setProcessorAttributes(processorAttributes));
-
-      Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode());
-
-      Assert.assertEquals(
-          TSStatusCode.SUCCESS_STATUS.getStatusCode(), client.startPipe("p1").getCode());
-
-      final Set<String> expectedResSet = new HashSet<>();
-      expectedResSet.add("1,1.0,1.0,null,");
-      expectedResSet.add("2,null,null,2.0,");
-
-      TestUtils.assertDataEventuallyOnEnv(
-          receiverEnv,
-          "select * from root.db.**,root.db2.**",
-          "Time,root.db.d1.s,root.db.d1.s1,root.db2.d1.s,",
-          expectedResSet);
-    }
+  public void testMultiplePrefixPatternHistoricalData() throws Exception {
+    // Define extractor attributes
+    final Map<String, String> extractorAttributes = new HashMap<>();
+    extractorAttributes.put("extractor.pattern", "root.db.d1.s, root.db2.d1.s");
+    extractorAttributes.put("extractor.inclusion", "data.insert");
+
+    // Define data to be inserted
+    final List<String> insertQueries =
+        Arrays.asList(
+            "insert into root.db.d1(time, s, s1) values (1, 1, 1)",
+            "insert into root.db.d2(time, s) values (2, 2)",
+            "insert into root.db2.d1(time, s) values (3, 3)");
+
+    // Define expected results on receiver
+    final Set<String> expectedResSet = new HashSet<>();
+    expectedResSet.add("1,null,1.0,1.0,");
+    expectedResSet.add("3,3.0,null,null,");
+
+    // Execute the common test logic
+    testPipeWithMultiplePatterns(
+        extractorAttributes,
+        insertQueries,
+        true, // isHistorical = true
+        "select * from root.db2.**,root.db.**",
+        "Time,root.db2.d1.s,root.db.d1.s,root.db.d1.s1,",
+        expectedResSet);
   }
 
   @Test
   public void testMultiplePrefixPatternRealtimeData() throws Exception {
-    final DataNodeWrapper receiverDataNode = receiverEnv.getDataNodeWrapper(0);
-
-    final String receiverIp = receiverDataNode.getIp();
-    final int receiverPort = receiverDataNode.getPort();
-
-    try (final SyncConfigNodeIServiceClient client =
-        (SyncConfigNodeIServiceClient) senderEnv.getLeaderConfigNodeConnection()) {
-      final Map<String, String> extractorAttributes = new HashMap<>();
-      final Map<String, String> processorAttributes = new HashMap<>();
-      final Map<String, String> connectorAttributes = new HashMap<>();
-
-      extractorAttributes.put("extractor.pattern", "root.db.d1.s, root.db2.d1.s");
-      extractorAttributes.put("extractor.inclusion", "data.insert");
-
-      connectorAttributes.put("connector", "iotdb-thrift-connector");
-      connectorAttributes.put("connector.batch.enable", "false");
-      connectorAttributes.put("connector.ip", receiverIp);
-      connectorAttributes.put("connector.port", Integer.toString(receiverPort));
-
-      final TSStatus status =
-          client.createPipe(
-              new TCreatePipeReq("p1", connectorAttributes)
-                  .setExtractorAttributes(extractorAttributes)
-                  .setProcessorAttributes(processorAttributes));
-
-      Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode());
-
-      Assert.assertEquals(
-          TSStatusCode.SUCCESS_STATUS.getStatusCode(), client.startPipe("p1").getCode());
-
-      if (!TestUtils.tryExecuteNonQueriesWithRetry(
-          senderEnv,
-          Arrays.asList(
-              "insert into root.db.d1(time, s, s1) values (1, 1, 1)",
-              "insert into root.db.d2(time, s) values (2, 2)",
-              "insert into root.db2.d1(time, s) values (3, 3)"))) {
-        return;
-      }
+    final Map<String, String> extractorAttributes = new HashMap<>();
+    extractorAttributes.put("extractor.pattern", "root.db.d1.s, root.db2.d1.s");
+    extractorAttributes.put("extractor.inclusion", "data.insert");
+
+    final List<String> insertQueries =
+        Arrays.asList(
+            "insert into root.db.d1(time, s, s1) values (1, 1, 1)",
+            "insert into root.db.d2(time, s) values (2, 2)",
+            "insert into root.db2.d1(time, s) values (3, 3)");
+
+    final Set<String> expectedResSet = new HashSet<>();
+    expectedResSet.add("1,null,1.0,1.0,");
+    expectedResSet.add("3,3.0,null,null,");
+
+    testPipeWithMultiplePatterns(
+        extractorAttributes,
+        insertQueries,
+        false, // isHistorical = false
+        "select * from root.db2.**,root.db.**",
+        "Time,root.db2.d1.s,root.db.d1.s,root.db.d1.s1,",
+        expectedResSet);
+  }
 
-      final Set<String> expectedResSet = new HashSet<>();
-      expectedResSet.add("1,null,1.0,1.0,");
-      expectedResSet.add("3,3.0,null,null,");
-      TestUtils.assertDataEventuallyOnEnv(
-          receiverEnv,
-          "select * from root.db2.**,root.db.**",
-          "Time,root.db2.d1.s,root.db.d1.s,root.db.d1.s1,",
-          expectedResSet);
-    }
+  @Test
+  public void testMultipleIoTDBPatternHistoricalData() throws Exception {
+    final Map<String, String> extractorAttributes = new HashMap<>();
+    extractorAttributes.put("extractor.path", "root.db.**, root.db2.d1.*");
+    extractorAttributes.put("extractor.inclusion", "data.insert");
+
+    final List<String> insertQueries =
+        Arrays.asList(
+            "insert into root.db.d1(time, s, s1) values (1, 1, 1)",
+            "insert into root.db.d2(time, s) values (2, 2)",
+            "insert into root.db2.d1(time, s, t) values (3, 3, 3)",
+            "insert into root.db3.d1(time, s) values (4, 4)");
+
+    final Set<String> expectedResSet = new HashSet<>();
+    expectedResSet.add("1,null,null,1.0,1.0,null,");
+    expectedResSet.add("2,null,null,null,null,2.0,");
+    expectedResSet.add("3,3.0,3.0,null,null,null,");
+
+    testPipeWithMultiplePatterns(
+        extractorAttributes,
+        insertQueries,
+        true, // isHistorical = true
+        "select * from root.db2.**,root.db.**",
+        "Time,root.db2.d1.s,root.db2.d1.t,root.db.d1.s,root.db.d1.s1,root.db.d2.s,",
+        expectedResSet);
   }
 
   @Test
   public void testMultipleIoTDBPatternRealtimeData() throws Exception {
-    final DataNodeWrapper receiverDataNode = receiverEnv.getDataNodeWrapper(0);
-
-    final String receiverIp = receiverDataNode.getIp();
-    final int receiverPort = receiverDataNode.getPort();
-
-    try (final SyncConfigNodeIServiceClient client =
-        (SyncConfigNodeIServiceClient) senderEnv.getLeaderConfigNodeConnection()) {
-      final Map<String, String> extractorAttributes = new HashMap<>();
-      final Map<String, String> processorAttributes = new HashMap<>();
-      final Map<String, String> connectorAttributes = new HashMap<>();
-
-      extractorAttributes.put("extractor.path", "root.db.**, root.db2.d1.*");
-      extractorAttributes.put("extractor.inclusion", "data.insert");
-
-      connectorAttributes.put("connector", "iotdb-thrift-connector");
-      connectorAttributes.put("connector.batch.enable", "false");
-      connectorAttributes.put("connector.ip", receiverIp);
-      connectorAttributes.put("connector.port", Integer.toString(receiverPort));
-
-      final TSStatus status =
-          client.createPipe(
-              new TCreatePipeReq("p1", connectorAttributes)
-                  .setExtractorAttributes(extractorAttributes)
-                  .setProcessorAttributes(processorAttributes));
-
-      Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode());
-
-      Assert.assertEquals(
-          TSStatusCode.SUCCESS_STATUS.getStatusCode(), client.startPipe("p1").getCode());
-
-      if (!TestUtils.tryExecuteNonQueriesWithRetry(
-          senderEnv,
-          Arrays.asList(
-              "insert into root.db.d1(time, s, s1) values (1, 1, 1)",
-              "insert into root.db.d2(time, s) values (2, 2)",
-              "insert into root.db2.d1(time, s, t) values (3, 3, 3)",
-              "insert into root.db3.d1(time, s) values (4, 4)"))) {
-        return;
-      }
+    final Map<String, String> extractorAttributes = new HashMap<>();
+    extractorAttributes.put("extractor.path", "root.db.**, root.db2.d1.*");
+    extractorAttributes.put("extractor.inclusion", "data.insert");
+
+    final List<String> insertQueries =
+        Arrays.asList(
+            "insert into root.db.d1(time, s, s1) values (1, 1, 1)",
+            "insert into root.db.d2(time, s) values (2, 2)",
+            "insert into root.db2.d1(time, s, t) values (3, 3, 3)",
+            "insert into root.db3.d1(time, s) values (4, 4)");
+
+    final Set<String> expectedResSet = new HashSet<>();
+    expectedResSet.add("1,null,null,1.0,1.0,null,");
+    expectedResSet.add("2,null,null,null,null,2.0,");
+    expectedResSet.add("3,3.0,3.0,null,null,null,");
+
+    testPipeWithMultiplePatterns(
+        extractorAttributes,
+        insertQueries,
+        false, // isHistorical = false
+        "select * from root.db2.**,root.db.**",
+        "Time,root.db2.d1.s,root.db2.d1.t,root.db.d1.s,root.db.d1.s1,root.db.d2.s,",
+        expectedResSet);
+  }
 
-      final Set<String> expectedResSet = new HashSet<>();
-      expectedResSet.add("1,null,null,1.0,1.0,null,");
-      expectedResSet.add("2,null,null,null,null,2.0,");
-      expectedResSet.add("3,3.0,3.0,null,null,null,");
-      TestUtils.assertDataEventuallyOnEnv(
-          receiverEnv,
-          "select * from root.db2.**,root.db.**",
-          "Time,root.db2.d1.s,root.db2.d1.t,root.db.d1.s,root.db.d1.s1,root.db.d2.s,",
-          expectedResSet);
-    }
+  @Test
+  public void testMultipleHybridPatternHistoricalData() throws Exception {
+    final Map<String, String> extractorAttributes = new HashMap<>();
+    extractorAttributes.put("extractor.path", "root.db.d1.*");
+    extractorAttributes.put("extractor.pattern", "root.db2.d1.s");
+    extractorAttributes.put("extractor.inclusion", "data.insert");
+
+    final List<String> insertQueries =
+        Arrays.asList(
+            "insert into root.db.d1(time, s, s1) values (1, 1, 1)",
+            "insert into root.db2.d1(time, s) values (2, 2)",
+            "insert into root.db3.d1(time, s) values (3, 3)");
+
+    final Set<String> expectedResSet = new HashSet<>();
+    expectedResSet.add("1,1.0,1.0,null,");
+    expectedResSet.add("2,null,null,2.0,");
+
+    testPipeWithMultiplePatterns(
+        extractorAttributes,
+        insertQueries,
+        true, // isHistorical = true
+        "select * from root.db.**,root.db2.**",
+        "Time,root.db.d1.s,root.db.d1.s1,root.db2.d1.s,",
+        expectedResSet);
   }
 
   @Test
   public void testMultipleHybridPatternRealtimeData() throws Exception {
-    final DataNodeWrapper receiverDataNode = receiverEnv.getDataNodeWrapper(0);
-
-    final String receiverIp = receiverDataNode.getIp();
-    final int receiverPort = receiverDataNode.getPort();
-
-    try (final SyncConfigNodeIServiceClient client =
-        (SyncConfigNodeIServiceClient) senderEnv.getLeaderConfigNodeConnection()) {
-      final Map<String, String> extractorAttributes = new HashMap<>();
-      final Map<String, String> processorAttributes = new HashMap<>();
-      final Map<String, String> connectorAttributes = new HashMap<>();
-
-      extractorAttributes.put("extractor.path", "root.db.d1.*");
-      extractorAttributes.put("extractor.pattern", "root.db2.d1.s");
-      extractorAttributes.put("extractor.inclusion", "data.insert");
-
-      connectorAttributes.put("connector", "iotdb-thrift-connector");
-      connectorAttributes.put("connector.batch.enable", "false");
-      connectorAttributes.put("connector.ip", receiverIp);
-      connectorAttributes.put("connector.port", Integer.toString(receiverPort));
+    final Map<String, String> extractorAttributes = new HashMap<>();
+    extractorAttributes.put("extractor.path", "root.db.d1.*");
+    extractorAttributes.put("extractor.pattern", "root.db2.d1.s");
+    extractorAttributes.put("extractor.inclusion", "data.insert");
+
+    final List<String> insertQueries =
+        Arrays.asList(
+            "insert into root.db.d1(time, s, s1) values (1, 1, 1)",
+            "insert into root.db2.d1(time, s) values (2, 2)",
+            "insert into root.db3.d1(time, s) values (3, 3)");
+
+    final Set<String> expectedResSet = new HashSet<>();
+    expectedResSet.add("1,1.0,1.0,null,");
+    expectedResSet.add("2,null,null,2.0,");
+
+    testPipeWithMultiplePatterns(
+        extractorAttributes,
+        insertQueries,
+        false, // isHistorical = false
+        "select * from root.db.**,root.db2.**",
+        "Time,root.db.d1.s,root.db.d1.s1,root.db2.d1.s,",
+        expectedResSet);
+  }
 
-      final TSStatus status =
-          client.createPipe(
-              new TCreatePipeReq("p1", connectorAttributes)
-                  .setExtractorAttributes(extractorAttributes)
-                  .setProcessorAttributes(processorAttributes));
+  @Test
+  public void testPrefixPatternWithExclusionHistoricalData() throws Exception {
+    final Map<String, String> extractorAttributes = new HashMap<>();
+    // Inclusion: Match everything under root.db.d1 and root.db.d2
+    extractorAttributes.put("extractor.pattern", "root.db.d1, root.db.d2");
+    // Exclusion: Exclude anything with the prefix root.db.d1.s1
+    extractorAttributes.put("extractor.pattern.exclusion", "root.db.d1.s1");
+    extractorAttributes.put("extractor.inclusion", "data.insert");
+
+    final List<String> insertQueries =
+        Arrays.asList(
+            // s matches, s1 is excluded
+            "insert into root.db.d1(time, s, s1) values (1, 1, 1)",
+            // s matches
+            "insert into root.db.d2(time, s) values (2, 2)",
+            "insert into root.db1.d1(time, s) values (3, 3)");
+
+    final Set<String> expectedResSet = new HashSet<>();
+    expectedResSet.add("1,1.0,null,");
+    expectedResSet.add("2,null,2.0,");
+
+    testPipeWithMultiplePatterns(
+        extractorAttributes,
+        insertQueries,
+        true, // isHistorical = true
+        "select * from root.db.**",
+        "Time,root.db.d1.s,root.db.d2.s,",
+        expectedResSet);
+  }
 
-      Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode());
+  @Test
+  public void testPrefixPatternWithExclusionRealtimeData() throws Exception {
+    final Map<String, String> extractorAttributes = new HashMap<>();
+    extractorAttributes.put("extractor.pattern", "root.db.d1, root.db.d2");
+    extractorAttributes.put("extractor.pattern.exclusion", "root.db.d1.s1");
+    extractorAttributes.put("extractor.inclusion", "data.insert");
+
+    final List<String> insertQueries =
+        Arrays.asList(
+            "insert into root.db.d1(time, s, s1) values (1, 1, 1)",
+            "insert into root.db.d2(time, s) values (2, 2)",
+            "insert into root.db1.d1(time, s) values (3, 3)");
+
+    final Set<String> expectedResSet = new HashSet<>();
+    expectedResSet.add("1,1.0,null,");
+    expectedResSet.add("2,null,2.0,");
+
+    testPipeWithMultiplePatterns(
+        extractorAttributes,
+        insertQueries,
+        false, // isHistorical = false
+        "select * from root.db.**",
+        "Time,root.db.d1.s,root.db.d2.s,",
+        expectedResSet);
+  }
 
-      Assert.assertEquals(
-          TSStatusCode.SUCCESS_STATUS.getStatusCode(), client.startPipe("p1").getCode());
+  @Test
+  public void testIoTDBPatternWithExclusionHistoricalData() throws Exception {
+    final Map<String, String> extractorAttributes = new HashMap<>();
+    // Inclusion: Match everything under root.db
+    extractorAttributes.put("extractor.path", "root.db.**");
+    // Exclusion: Exclude root.db.d1.s* and root.db.d3.*
+    extractorAttributes.put("extractor.path.exclusion", "root.db.d1.s*, root.db.d3.*");
+    extractorAttributes.put("extractor.inclusion", "data.insert");
+
+    final List<String> insertQueries =
+        Arrays.asList(
+            // s, s1 excluded, t matches
+            "insert into root.db.d1(time, s, s1, t) values (1, 1, 1, 1)",
+            // s matches
+            "insert into root.db.d2(time, s) values (2, 2)",
+            // s excluded
+            "insert into root.db.d3(time, s) values (3, 3)",
+            "insert into root.db1.d1(time, s) values (4, 4)");
+
+    final Set<String> expectedResSet = new HashSet<>();
+    expectedResSet.add("1,1.0,null,");
+    expectedResSet.add("2,null,2.0,");
+
+    testPipeWithMultiplePatterns(
+        extractorAttributes,
+        insertQueries,
+        true, // isHistorical = true
+        "select * from root.db.**",
+        "Time,root.db.d1.t,root.db.d2.s,",
+        expectedResSet);
+  }
 
-      if (!TestUtils.tryExecuteNonQueriesWithRetry(
-          senderEnv,
-          Arrays.asList(
-              "insert into root.db.d1(time, s, s1) values (1, 1, 1)",
-              "insert into root.db2.d1(time, s) values (2, 2)",
-              "insert into root.db3.d1(time, s) values (3, 3)"))) {
-        return;
-      }
+  @Test
+  public void testIoTDBPatternWithExclusionRealtimeData() throws Exception {
+    final Map<String, String> extractorAttributes = new HashMap<>();
+    extractorAttributes.put("extractor.path", "root.db.**");
+    extractorAttributes.put("extractor.path.exclusion", "root.db.d1.s*, root.db.d3.*");
+    extractorAttributes.put("extractor.inclusion", "data.insert");
+
+    final List<String> insertQueries =
+        Arrays.asList(
+            "insert into root.db.d1(time, s, s1, t) values (1, 1, 1, 1)",
+            "insert into root.db.d2(time, s) values (2, 2)",
+            "insert into root.db.d3(time, s) values (3, 3)",
+            "insert into root.db1.d1(time, s) values (4, 4)");
+
+    final Set<String> expectedResSet = new HashSet<>();
+    expectedResSet.add("1,1.0,null,");
+    expectedResSet.add("2,null,2.0,");
+
+    testPipeWithMultiplePatterns(
+        extractorAttributes,
+        insertQueries,
+        false, // isHistorical = false
+        "select * from root.db.**",
+        "Time,root.db.d1.t,root.db.d2.s,",
+        expectedResSet);
+  }
 
-      final Set<String> expectedResSet = new HashSet<>();
-      expectedResSet.add("1,1.0,1.0,null,");
-      expectedResSet.add("2,null,null,2.0,");
+  @Test
+  public void testHybridPatternWithHybridExclusionHistoricalData() throws Exception {
+    final Map<String, String> extractorAttributes = new HashMap<>();
+    // Inclusion: Match root.db.** (IoTDB) AND root.db2.d1 (Prefix)
+    extractorAttributes.put("extractor.path", "root.db.**");
+    extractorAttributes.put("extractor.pattern", "root.db2.d1");
+    // Exclusion: Exclude root.db.d1.* (IoTDB) AND root.db2.d1.s (Prefix)
+    extractorAttributes.put("extractor.path.exclusion", "root.db.d1.*");
+    extractorAttributes.put("extractor.pattern.exclusion", "root.db2.d1.s");
+    extractorAttributes.put("extractor.inclusion", "data.insert");
+
+    final List<String> insertQueries =
+        Arrays.asList(
+            // s, s1 excluded by path.exclusion
+            "insert into root.db.d1(time, s, s1) values (1, 1, 1)",
+            // s matches
+            "insert into root.db.d2(time, s) values (2, 2)",
+            // s excluded by pattern.exclusion, t matches
+            "insert into root.db2.d1(time, s, t) values (3, 3, 3)",
+            "insert into root.db3.d1(time, s) values (4, 4)");
+
+    final Set<String> expectedResSet = new HashSet<>();
+    expectedResSet.add("2,2.0,null,");
+    expectedResSet.add("3,null,3.0,");
+
+    testPipeWithMultiplePatterns(
+        extractorAttributes,
+        insertQueries,
+        true, // isHistorical = true
+        "select * from root.db.**,root.db2.**",
+        "Time,root.db.d2.s,root.db2.d1.t,",
+        expectedResSet);
+  }
 
-      TestUtils.assertDataEventuallyOnEnv(
-          receiverEnv,
-          "select * from root.db.**,root.db2.**",
-          "Time,root.db.d1.s,root.db.d1.s1,root.db2.d1.s,",
-          expectedResSet);
-    }
+  @Test
+  public void testHybridPatternWithHybridExclusionRealtimeData() throws Exception {
+    final Map<String, String> extractorAttributes = new HashMap<>();
+    extractorAttributes.put("extractor.path", "root.db.**");
+    extractorAttributes.put("extractor.pattern", "root.db2.d1");
+    extractorAttributes.put("extractor.path.exclusion", "root.db.d1.*");
+    extractorAttributes.put("extractor.pattern.exclusion", "root.db2.d1.s");
+    extractorAttributes.put("extractor.inclusion", "data.insert");
+
+    final List<String> insertQueries =
+        Arrays.asList(
+            "insert into root.db.d1(time, s, s1) values (1, 1, 1)",
+            "insert into root.db.d2(time, s) values (2, 2)",
+            "insert into root.db2.d1(time, s, t) values (3, 3, 3)",
+            "insert into root.db3.d1(time, s) values (4, 4)");
+
+    final Set<String> expectedResSet = new HashSet<>();
+    expectedResSet.add("2,2.0,null,");
+    expectedResSet.add("3,null,3.0,");
+
+    testPipeWithMultiplePatterns(
+        extractorAttributes,
+        insertQueries,
+        false, // isHistorical = false
+        "select * from root.db.**,root.db2.**",
+        "Time,root.db.d2.s,root.db2.d1.t,",
+        expectedResSet);
   }
 }
diff --git a/integration-test/src/test/java/org/apache/iotdb/pipe/it/manual/IoTDBPipeInclusionIT.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/manual/IoTDBPipeInclusionIT.java
index 661027160bf..ede619caafc 100644
--- a/integration-test/src/test/java/org/apache/iotdb/pipe/it/manual/IoTDBPipeInclusionIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/pipe/it/manual/IoTDBPipeInclusionIT.java
@@ -177,6 +177,80 @@ public class IoTDBPipeInclusionIT extends AbstractPipeDualManualIT {
     }
   }
 
+  @Test
+  public void testPureSchemaInclusionWithExclusionPattern() throws Exception {
+    final DataNodeWrapper receiverDataNode = receiverEnv.getDataNodeWrapper(0);
+
+    final String receiverIp = receiverDataNode.getIp();
+    final int receiverPort = receiverDataNode.getPort();
+
+    try (final SyncConfigNodeIServiceClient client =
+        (SyncConfigNodeIServiceClient) senderEnv.getLeaderConfigNodeConnection()) {
+      final Map<String, String> extractorAttributes = new HashMap<>();
+      final Map<String, String> processorAttributes = new HashMap<>();
+      final Map<String, String> connectorAttributes = new HashMap<>();
+
+      extractorAttributes.put("extractor.inclusion", "schema");
+      // Include root.ln.**
+      extractorAttributes.put("path", "root.ln.**");
+      // Exclude root.ln.wf02.* and root.ln.wf03.wt01.status
+      extractorAttributes.put("path.exclusion", "root.ln.wf02.**, root.ln.wf03.wt01.status");
+
+      connectorAttributes.put("connector", "iotdb-thrift-connector");
+      connectorAttributes.put("connector.ip", receiverIp);
+      connectorAttributes.put("connector.port", Integer.toString(receiverPort));
+
+      final TSStatus status =
+          client.createPipe(
+              new TCreatePipeReq("testPipe", connectorAttributes)
+                  .setExtractorAttributes(extractorAttributes)
+                  .setProcessorAttributes(processorAttributes));
+
+      Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(), status.getCode());
+
+      Assert.assertEquals(
+          TSStatusCode.SUCCESS_STATUS.getStatusCode(), client.startPipe("testPipe").getCode());
+
+      // Do not fail if the failure has nothing to do with pipe
+      // Because the failures will randomly generate due to resource limitation
+      if (TestUtils.tryExecuteNonQueriesWithRetry(
+          senderEnv,
+          Arrays.asList(
+              // Should be included
+              "create timeseries root.ln.wf01.wt01.status with datatype=BOOLEAN,encoding=PLAIN",
+              "ALTER timeseries root.ln.wf01.wt01.status ADD TAGS tag3=v3",
+              "ALTER timeseries root.ln.wf01.wt01.status ADD ATTRIBUTES attr4=v4",
+              // Should be excluded by root.ln.wf02.*
+              "create timeseries root.ln.wf02.wt01.status with datatype=BOOLEAN,encoding=PLAIN",
+              "ALTER timeseries root.ln.wf02.wt01.status ADD TAGS tag3=v3",
+              "ALTER timeseries root.ln.wf02.wt01.status ADD ATTRIBUTES attr4=v4",
+              // Should be excluded by root.ln.wf03.wt01.status
+              "create timeseries root.ln.wf03.wt01.status with datatype=BOOLEAN,encoding=PLAIN",
+              "ALTER timeseries root.ln.wf03.wt01.status ADD TAGS tag3=v3",
+              "ALTER timeseries root.ln.wf03.wt01.status ADD ATTRIBUTES attr4=v4"))) {
+        return;
+      }
+
+      TestUtils.assertDataEventuallyOnEnv(
+          receiverEnv,
+          "show timeseries root.ln.**",
+          "Timeseries,Alias,Database,DataType,Encoding,Compression,Tags,Attributes,Deadband,DeadbandParameters,ViewType,",
+          // Only wf01 should be synced
+          Collections.singleton(
+              "root.ln.wf01.wt01.status,null,root.ln,BOOLEAN,PLAIN,LZ4,{\"tag3\":\"v3\"},{\"attr4\":\"v4\"},null,null,BASE,"));
+
+      if (!TestUtils.tryExecuteNonQueriesWithRetry(
+          senderEnv,
+          Arrays.asList(
+              "insert into root.ln.wf01.wt01(time, status) values(now(), false)", "flush"))) {
+        return;
+      }
+
+      TestUtils.assertDataAlwaysOnEnv(
+          receiverEnv, "select * from root.ln.**", "Time,", Collections.emptySet());
+    }
+  }
+
   @Test
   public void testAuthExclusion() throws Exception {
     final DataNodeWrapper receiverDataNode = receiverEnv.getDataNodeWrapper(0);
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/receiver/protocol/IoTDBConfigNodeReceiver.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/receiver/protocol/IoTDBConfigNodeReceiver.java
index 5ba70f80890..aa32211e9af 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/receiver/protocol/IoTDBConfigNodeReceiver.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/receiver/protocol/IoTDBConfigNodeReceiver.java
@@ -26,8 +26,8 @@ import org.apache.iotdb.commons.conf.IoTDBConstant;
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.commons.path.PathPatternTree;
 import org.apache.iotdb.commons.pipe.datastructure.pattern.IoTDBPipePattern;
+import org.apache.iotdb.commons.pipe.datastructure.pattern.IoTDBPipePatternOperations;
 import org.apache.iotdb.commons.pipe.datastructure.pattern.PipePattern;
-import org.apache.iotdb.commons.pipe.datastructure.pattern.UnionIoTDBPipePattern;
 import org.apache.iotdb.commons.pipe.receiver.IoTDBFileReceiver;
 import org.apache.iotdb.commons.pipe.receiver.PipeReceiverStatusHandler;
 import org.apache.iotdb.commons.pipe.sink.payload.airgap.AirGapPseudoTPipeTransferRequest;
@@ -530,14 +530,13 @@ public class IoTDBConfigNodeReceiver extends IoTDBFileReceiver {
     final Set<ConfigPhysicalPlanType> executionTypes =
         PipeConfigRegionSnapshotEvent.getConfigPhysicalPlanTypeSet(
             parameters.get(ColumnHeaderConstant.TYPE));
-    final List<PipePattern> pipePatterns =
-        PipePattern.parseMultiplePatterns(
+    final PipePattern pipePattern =
+        PipePattern.parsePatternFromString(
             parameters.get(ColumnHeaderConstant.PATH_PATTERN), IoTDBPipePattern::new);
-    final PipePattern pipePattern = PipePattern.buildUnionPattern(pipePatterns);
     final List<TSStatus> results = new ArrayList<>();
     while (generator.hasNext()) {
       IoTDBConfigRegionSource.PATTERN_PARSE_VISITOR
-          .process(generator.next(), (UnionIoTDBPipePattern) pipePattern)
+          .process(generator.next(), (IoTDBPipePatternOperations) pipePattern)
           .filter(configPhysicalPlan -> executionTypes.contains(configPhysicalPlan.getType()))
           .ifPresent(
               configPhysicalPlan ->
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/source/PipeConfigPhysicalPlanPatternParseVisitor.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/source/PipeConfigPhysicalPlanPatternParseVisitor.java
index c8beb49181c..60d918ae79b 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/source/PipeConfigPhysicalPlanPatternParseVisitor.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/source/PipeConfigPhysicalPlanPatternParseVisitor.java
@@ -22,8 +22,8 @@ package org.apache.iotdb.confignode.manager.pipe.source;
 import org.apache.iotdb.commons.auth.entity.PrivilegeType;
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.commons.path.PathPatternTree;
+import org.apache.iotdb.commons.pipe.datastructure.pattern.IoTDBPipePatternOperations;
 import org.apache.iotdb.commons.pipe.datastructure.pattern.PipePattern;
-import org.apache.iotdb.commons.pipe.datastructure.pattern.UnionIoTDBPipePattern;
 import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
 import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanVisitor;
 import org.apache.iotdb.confignode.consensus.request.write.auth.AuthorPlan;
@@ -59,12 +59,12 @@ import java.util.stream.Stream;
 
 /**
  * The {@link PipeConfigPhysicalPlanPatternParseVisitor} will transform the schema {@link
- * ConfigPhysicalPlan}s using {@link UnionIoTDBPipePattern}. Rule:
+ * ConfigPhysicalPlan}s using {@link IoTDBPipePatternOperations}. Rule:
  *
  * <p>1. All patterns in the output {@link ConfigPhysicalPlan} will be the intersection of the
- * original {@link ConfigPhysicalPlan}'s patterns and the given {@link UnionIoTDBPipePattern}.
+ * original {@link ConfigPhysicalPlan}'s patterns and the given {@link IoTDBPipePatternOperations}.
  *
- * <p>2. If a pattern does not intersect with the {@link UnionIoTDBPipePattern}, it's dropped.
+ * <p>2. If a pattern does not intersect with the {@link IoTDBPipePatternOperations}, it's dropped.
  *
  * <p>3. If all the patterns in the {@link ConfigPhysicalPlan} is dropped, the {@link
  * ConfigPhysicalPlan} is dropped.
@@ -73,13 +73,13 @@ import java.util.stream.Stream;
  * one is used in the {@link PipeConfigRegionWritePlanEvent} in {@link ConfigRegionListeningQueue}.
  */
 public class PipeConfigPhysicalPlanPatternParseVisitor
-    extends ConfigPhysicalPlanVisitor<Optional<ConfigPhysicalPlan>, UnionIoTDBPipePattern> {
+    extends ConfigPhysicalPlanVisitor<Optional<ConfigPhysicalPlan>, IoTDBPipePatternOperations> {
   private static final Logger LOGGER =
       LoggerFactory.getLogger(PipeConfigPhysicalPlanPatternParseVisitor.class);
 
   @Override
   public Optional<ConfigPhysicalPlan> visitPlan(
-      final ConfigPhysicalPlan plan, final UnionIoTDBPipePattern pattern) {
+      final ConfigPhysicalPlan plan, final IoTDBPipePatternOperations pattern) {
     return Optional.of(plan);
   }
 
@@ -91,7 +91,7 @@ public class PipeConfigPhysicalPlanPatternParseVisitor
   // Other matches using "matchPrefixPath" are with the same principle.
   @Override
   public Optional<ConfigPhysicalPlan> visitCreateDatabase(
-      final DatabaseSchemaPlan createDatabasePlan, final UnionIoTDBPipePattern pattern) {
+      final DatabaseSchemaPlan createDatabasePlan, final IoTDBPipePatternOperations pattern) {
     return pattern.matchPrefixPath(createDatabasePlan.getSchema().getName())
         ? Optional.of(createDatabasePlan)
         : Optional.empty();
@@ -99,7 +99,7 @@ public class PipeConfigPhysicalPlanPatternParseVisitor
 
   @Override
   public Optional<ConfigPhysicalPlan> visitAlterDatabase(
-      final DatabaseSchemaPlan alterDatabasePlan, final UnionIoTDBPipePattern pattern) {
+      final DatabaseSchemaPlan alterDatabasePlan, final IoTDBPipePatternOperations pattern) {
     return pattern.matchPrefixPath(alterDatabasePlan.getSchema().getName())
         ? Optional.of(alterDatabasePlan)
         : Optional.empty();
@@ -107,7 +107,7 @@ public class PipeConfigPhysicalPlanPatternParseVisitor
 
   @Override
   public Optional<ConfigPhysicalPlan> visitDeleteDatabase(
-      final DeleteDatabasePlan deleteDatabasePlan, final UnionIoTDBPipePattern pattern) {
+      final DeleteDatabasePlan deleteDatabasePlan, final IoTDBPipePatternOperations pattern) {
     return pattern.matchPrefixPath(deleteDatabasePlan.getName())
         ? Optional.of(deleteDatabasePlan)
         : Optional.empty();
@@ -116,7 +116,7 @@ public class PipeConfigPhysicalPlanPatternParseVisitor
   @Override
   public Optional<ConfigPhysicalPlan> visitCreateSchemaTemplate(
       final CreateSchemaTemplatePlan createSchemaTemplatePlan,
-      final UnionIoTDBPipePattern pattern) {
+      final IoTDBPipePatternOperations pattern) {
     // This is a deserialized template and can be arbitrarily altered
     final Template template = createSchemaTemplatePlan.getTemplate();
     template.getSchemaMap().keySet().removeIf(measurement -> !pattern.matchTailNode(measurement));
@@ -128,7 +128,7 @@ public class PipeConfigPhysicalPlanPatternParseVisitor
   @Override
   public Optional<ConfigPhysicalPlan> visitCommitSetSchemaTemplate(
       final CommitSetSchemaTemplatePlan commitSetSchemaTemplatePlan,
-      final UnionIoTDBPipePattern pattern) {
+      final IoTDBPipePatternOperations pattern) {
     return pattern.matchPrefixPath(commitSetSchemaTemplatePlan.getPath())
         ? Optional.of(commitSetSchemaTemplatePlan)
         : Optional.empty();
@@ -137,7 +137,7 @@ public class PipeConfigPhysicalPlanPatternParseVisitor
   @Override
   public Optional<ConfigPhysicalPlan> visitPipeUnsetSchemaTemplate(
       final PipeUnsetSchemaTemplatePlan pipeUnsetSchemaTemplatePlan,
-      final UnionIoTDBPipePattern pattern) {
+      final IoTDBPipePatternOperations pattern) {
     return pattern.matchPrefixPath(pipeUnsetSchemaTemplatePlan.getPath())
         ? Optional.of(pipeUnsetSchemaTemplatePlan)
         : Optional.empty();
@@ -146,7 +146,7 @@ public class PipeConfigPhysicalPlanPatternParseVisitor
   @Override
   public Optional<ConfigPhysicalPlan> visitExtendSchemaTemplate(
       final ExtendSchemaTemplatePlan extendSchemaTemplatePlan,
-      final UnionIoTDBPipePattern pattern) {
+      final IoTDBPipePatternOperations pattern) {
     final TemplateExtendInfo extendInfo = extendSchemaTemplatePlan.getTemplateExtendInfo();
     final int[] filteredIndexes =
         IntStream.range(0, extendInfo.getMeasurements().size())
@@ -166,30 +166,30 @@ public class PipeConfigPhysicalPlanPatternParseVisitor
 
   @Override
   public Optional<ConfigPhysicalPlan> visitGrantUser(
-      final AuthorPlan grantUserPlan, final UnionIoTDBPipePattern pattern) {
+      final AuthorPlan grantUserPlan, final IoTDBPipePatternOperations pattern) {
     return visitPathRelatedAuthorPlan(grantUserPlan, pattern);
   }
 
   @Override
   public Optional<ConfigPhysicalPlan> visitRevokeUser(
-      final AuthorPlan revokeUserPlan, final UnionIoTDBPipePattern pattern) {
+      final AuthorPlan revokeUserPlan, final IoTDBPipePatternOperations pattern) {
     return visitPathRelatedAuthorPlan(revokeUserPlan, pattern);
   }
 
   @Override
   public Optional<ConfigPhysicalPlan> visitGrantRole(
-      final AuthorPlan revokeUserPlan, final UnionIoTDBPipePattern pattern) {
+      final AuthorPlan revokeUserPlan, final IoTDBPipePatternOperations pattern) {
     return visitPathRelatedAuthorPlan(revokeUserPlan, pattern);
   }
 
   @Override
   public Optional<ConfigPhysicalPlan> visitRevokeRole(
-      final AuthorPlan revokeUserPlan, final UnionIoTDBPipePattern pattern) {
+      final AuthorPlan revokeUserPlan, final IoTDBPipePatternOperations pattern) {
     return visitPathRelatedAuthorPlan(revokeUserPlan, pattern);
   }
 
   private Optional<ConfigPhysicalPlan> visitPathRelatedAuthorPlan(
-      final AuthorPlan pathRelatedAuthorPlan, final UnionIoTDBPipePattern pattern) {
+      final AuthorPlan pathRelatedAuthorPlan, final IoTDBPipePatternOperations pattern) {
     final List<PartialPath> intersectedPaths =
         pathRelatedAuthorPlan.getNodeNameList().stream()
             .map(pattern::getIntersection)
@@ -218,7 +218,7 @@ public class PipeConfigPhysicalPlanPatternParseVisitor
   @Override
   public Optional<ConfigPhysicalPlan> visitPipeDeleteTimeSeries(
       final PipeDeleteTimeSeriesPlan pipeDeleteTimeSeriesPlan,
-      final UnionIoTDBPipePattern pattern) {
+      final IoTDBPipePatternOperations pattern) {
     try {
       final PathPatternTree intersectedTree =
           pattern.getIntersection(
@@ -237,7 +237,7 @@ public class PipeConfigPhysicalPlanPatternParseVisitor
   @Override
   public Optional<ConfigPhysicalPlan> visitPipeDeleteLogicalView(
       final PipeDeleteLogicalViewPlan pipeDeleteLogicalViewPlan,
-      final UnionIoTDBPipePattern pattern) {
+      final IoTDBPipePatternOperations pattern) {
     try {
       final PathPatternTree intersectedTree =
           pattern.getIntersection(
@@ -256,7 +256,7 @@ public class PipeConfigPhysicalPlanPatternParseVisitor
   @Override
   public Optional<ConfigPhysicalPlan> visitPipeDeactivateTemplate(
       final PipeDeactivateTemplatePlan pipeDeactivateTemplatePlan,
-      final UnionIoTDBPipePattern pattern) {
+      final IoTDBPipePatternOperations pattern) {
     final Map<PartialPath, List<Template>> newTemplateSetInfo =
         pipeDeactivateTemplatePlan.getTemplateSetInfo().entrySet().stream()
             .flatMap(
@@ -279,7 +279,7 @@ public class PipeConfigPhysicalPlanPatternParseVisitor
 
   @Override
   public Optional<ConfigPhysicalPlan> visitTTL(
-      final SetTTLPlan setTTLPlan, final UnionIoTDBPipePattern pattern) {
+      final SetTTLPlan setTTLPlan, final IoTDBPipePatternOperations pattern) {
     final PartialPath partialPath = new PartialPath(setTTLPlan.getPathPattern());
     final List<PartialPath> intersectionList =
         pattern.matchPrefixPath(partialPath.getFullPath())
diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/manager/pipe/source/PipeConfigPhysicalPlanPatternParseVisitorTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/manager/pipe/source/PipeConfigPhysicalPlanPatternParseVisitorTest.java
index 18430fcb981..8125a980acd 100644
--- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/manager/pipe/source/PipeConfigPhysicalPlanPatternParseVisitorTest.java
+++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/manager/pipe/source/PipeConfigPhysicalPlanPatternParseVisitorTest.java
@@ -23,6 +23,7 @@ import org.apache.iotdb.commons.exception.IllegalPathException;
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.commons.path.PathPatternTree;
 import org.apache.iotdb.commons.pipe.datastructure.pattern.IoTDBPipePattern;
+import org.apache.iotdb.commons.pipe.datastructure.pattern.IoTDBPipePatternOperations;
 import org.apache.iotdb.commons.pipe.datastructure.pattern.UnionIoTDBPipePattern;
 import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
 import org.apache.iotdb.confignode.consensus.request.write.auth.AuthorPlan;
@@ -55,11 +56,11 @@ import java.util.List;
 
 public class PipeConfigPhysicalPlanPatternParseVisitorTest {
 
-  private final UnionIoTDBPipePattern prefixPathPattern =
+  private final IoTDBPipePatternOperations prefixPathPattern =
       new UnionIoTDBPipePattern(new IoTDBPipePattern("root.db.device.**"));
-  private final UnionIoTDBPipePattern fullPathPattern =
+  private final IoTDBPipePatternOperations fullPathPattern =
       new UnionIoTDBPipePattern(new IoTDBPipePattern("root.db.device.s1"));
-  private final UnionIoTDBPipePattern multiplePathPattern =
+  private final IoTDBPipePatternOperations multiplePathPattern =
       new UnionIoTDBPipePattern(
           Arrays.asList(
               new IoTDBPipePattern("root.db.device.s1"),
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/connection/PipeEventCollector.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/connection/PipeEventCollector.java
index e5f1101e40c..e3f8203251c 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/connection/PipeEventCollector.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/connection/PipeEventCollector.java
@@ -21,7 +21,7 @@ package org.apache.iotdb.db.pipe.agent.task.connection;
 
 import org.apache.iotdb.commons.pipe.agent.task.connection.UnboundedBlockingPendingQueue;
 import org.apache.iotdb.commons.pipe.agent.task.progress.PipeEventCommitManager;
-import org.apache.iotdb.commons.pipe.datastructure.pattern.UnionIoTDBPipePattern;
+import org.apache.iotdb.commons.pipe.datastructure.pattern.IoTDBPipePatternOperations;
 import org.apache.iotdb.commons.pipe.event.EnrichedEvent;
 import org.apache.iotdb.commons.pipe.event.ProgressReportEvent;
 import org.apache.iotdb.db.pipe.agent.PipeDataNodeAgent;
@@ -158,7 +158,8 @@ public class PipeEventCollector implements EventCollector {
     // delete data event does not have progress index currently
     IoTDBSchemaRegionSource.PATTERN_PARSE_VISITOR
         .process(
-            deleteDataEvent.getPlanNode(), (UnionIoTDBPipePattern) deleteDataEvent.getPipePattern())
+            deleteDataEvent.getPlanNode(),
+            (IoTDBPipePatternOperations) deleteDataEvent.getPipePattern())
         .map(
             planNode ->
                 new PipeSchemaRegionWritePlanEvent(
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tsfile/container/TsFileInsertionDataContainerProvider.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tsfile/container/TsFileInsertionDataContainerProvider.java
index b6c24365f3e..59d630a90ce 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tsfile/container/TsFileInsertionDataContainerProvider.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tsfile/container/TsFileInsertionDataContainerProvider.java
@@ -21,8 +21,8 @@ package org.apache.iotdb.db.pipe.event.common.tsfile.container;
 
 import org.apache.iotdb.commons.pipe.agent.task.meta.PipeTaskMeta;
 import org.apache.iotdb.commons.pipe.config.PipeConfig;
+import org.apache.iotdb.commons.pipe.datastructure.pattern.IoTDBPipePatternOperations;
 import org.apache.iotdb.commons.pipe.datastructure.pattern.PipePattern;
-import org.apache.iotdb.commons.pipe.datastructure.pattern.UnionIoTDBPipePattern;
 import org.apache.iotdb.db.pipe.event.common.tsfile.PipeTsFileInsertionEvent;
 import org.apache.iotdb.db.pipe.event.common.tsfile.container.query.TsFileInsertionQueryDataContainer;
 import org.apache.iotdb.db.pipe.event.common.tsfile.container.scan.TsFileInsertionScanDataContainer;
@@ -94,8 +94,8 @@ public class TsFileInsertionDataContainerProvider {
           isWithMod);
     }
 
-    if (pattern instanceof UnionIoTDBPipePattern
-        && !((UnionIoTDBPipePattern) pattern).mayMatchMultipleTimeSeriesInOneDevice()) {
+    if (pattern instanceof IoTDBPipePatternOperations
+        && !((IoTDBPipePatternOperations) pattern).mayMatchMultipleTimeSeriesInOneDevice()) {
       // If the pattern matches only one time series in one device, use query container here
       // because there is no timestamps merge overhead.
       //
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/thrift/IoTDBDataNodeReceiver.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/thrift/IoTDBDataNodeReceiver.java
index a8654103349..86ff22ebae9 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/thrift/IoTDBDataNodeReceiver.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/thrift/IoTDBDataNodeReceiver.java
@@ -26,8 +26,8 @@ import org.apache.iotdb.commons.exception.pipe.PipeRuntimeOutOfMemoryCriticalExc
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.commons.pipe.config.PipeConfig;
 import org.apache.iotdb.commons.pipe.datastructure.pattern.IoTDBPipePattern;
+import org.apache.iotdb.commons.pipe.datastructure.pattern.IoTDBPipePatternOperations;
 import org.apache.iotdb.commons.pipe.datastructure.pattern.PipePattern;
-import org.apache.iotdb.commons.pipe.datastructure.pattern.UnionIoTDBPipePattern;
 import org.apache.iotdb.commons.pipe.receiver.IoTDBFileReceiver;
 import org.apache.iotdb.commons.pipe.receiver.PipeReceiverStatusHandler;
 import org.apache.iotdb.commons.pipe.resource.log.PipeLogger;
@@ -512,10 +512,9 @@ public class IoTDBDataNodeReceiver extends IoTDBFileReceiver {
     final Set<StatementType> executionTypes =
         PipeSchemaRegionSnapshotEvent.getStatementTypeSet(
             parameters.get(ColumnHeaderConstant.TYPE));
-    final List<PipePattern> pipePatterns =
-        PipePattern.parseMultiplePatterns(
+    final PipePattern pipePattern =
+        PipePattern.parsePatternFromString(
             parameters.get(ColumnHeaderConstant.PATH_PATTERN), IoTDBPipePattern::new);
-    final PipePattern pipePattern = PipePattern.buildUnionPattern(pipePatterns);
 
     // Clear to avoid previous exceptions
     batchVisitor.clear();
@@ -530,7 +529,7 @@ public class IoTDBDataNodeReceiver extends IoTDBFileReceiver {
       // Here we apply the statements as many as possible
       // Even if there are failed statements
       STATEMENT_PATTERN_PARSE_VISITOR
-          .process(originalStatement, (UnionIoTDBPipePattern) pipePattern)
+          .process(originalStatement, (IoTDBPipePatternOperations) pipePattern)
           .flatMap(parsedStatement -> batchVisitor.process(parsedStatement, null))
           .ifPresent(statement -> results.add(executeStatementAndClassifyExceptions(statement)));
     }
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/visitor/PipeStatementPatternParseVisitor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/visitor/PipeStatementPatternParseVisitor.java
index c5d1dab6a10..3c00db290b2 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/visitor/PipeStatementPatternParseVisitor.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/visitor/PipeStatementPatternParseVisitor.java
@@ -19,8 +19,8 @@
 
 package org.apache.iotdb.db.pipe.receiver.visitor;
 
+import org.apache.iotdb.commons.pipe.datastructure.pattern.IoTDBPipePatternOperations;
 import org.apache.iotdb.commons.pipe.datastructure.pattern.PipePattern;
-import org.apache.iotdb.commons.pipe.datastructure.pattern.UnionIoTDBPipePattern;
 import org.apache.iotdb.db.queryengine.plan.statement.Statement;
 import org.apache.iotdb.db.queryengine.plan.statement.StatementNode;
 import org.apache.iotdb.db.queryengine.plan.statement.StatementVisitor;
@@ -37,12 +37,12 @@ import java.util.stream.IntStream;
 
 /**
  * The {@link PipeStatementPatternParseVisitor} will transform the schema {@link Statement}s using
- * {@link UnionIoTDBPipePattern}. Rule:
+ * {@link IoTDBPipePatternOperations}. Rule:
  *
  * <p>1. All patterns in the output {@link Statement} will be the intersection of the original
- * {@link Statement}'s patterns and the given {@link UnionIoTDBPipePattern}.
+ * {@link Statement}'s patterns and the given {@link IoTDBPipePatternOperations}.
  *
- * <p>2. If a pattern does not intersect with the {@link UnionIoTDBPipePattern}, it's dropped.
+ * <p>2. If a pattern does not intersect with the {@link IoTDBPipePatternOperations}, it's dropped.
  *
  * <p>3. If all the patterns in the {@link Statement} is dropped, the {@link Statement} is dropped.
  *
@@ -50,16 +50,16 @@ import java.util.stream.IntStream;
  * from the {@link SRStatementGenerator} and will no longer be used.
  */
 public class PipeStatementPatternParseVisitor
-    extends StatementVisitor<Optional<Statement>, UnionIoTDBPipePattern> {
+    extends StatementVisitor<Optional<Statement>, IoTDBPipePatternOperations> {
   @Override
   public Optional<Statement> visitNode(
-      final StatementNode statement, final UnionIoTDBPipePattern pattern) {
+      final StatementNode statement, final IoTDBPipePatternOperations pattern) {
     return Optional.of((Statement) statement);
   }
 
   @Override
   public Optional<Statement> visitCreateTimeseries(
-      final CreateTimeSeriesStatement statement, final UnionIoTDBPipePattern pattern) {
+      final CreateTimeSeriesStatement statement, final IoTDBPipePatternOperations pattern) {
     return pattern.matchesMeasurement(
             statement.getPath().getDevice(), statement.getPath().getMeasurement())
         ? Optional.of(statement)
@@ -68,7 +68,7 @@ public class PipeStatementPatternParseVisitor
 
   @Override
   public Optional<Statement> visitCreateAlignedTimeseries(
-      final CreateAlignedTimeSeriesStatement statement, final UnionIoTDBPipePattern pattern) {
+      final CreateAlignedTimeSeriesStatement statement, final IoTDBPipePatternOperations pattern) {
     final int[] filteredIndexes =
         IntStream.range(0, statement.getMeasurements().size())
             .filter(
@@ -109,7 +109,7 @@ public class PipeStatementPatternParseVisitor
   @Override
   public Optional<Statement> visitAlterTimeSeries(
       final AlterTimeSeriesStatement alterTimeSeriesStatement,
-      final UnionIoTDBPipePattern pattern) {
+      final IoTDBPipePatternOperations pattern) {
     return pattern.matchesMeasurement(
             alterTimeSeriesStatement.getPath().getDevice(),
             alterTimeSeriesStatement.getPath().getMeasurement())
@@ -120,7 +120,7 @@ public class PipeStatementPatternParseVisitor
   @Override
   public Optional<Statement> visitActivateTemplate(
       final ActivateTemplateStatement activateTemplateStatement,
-      final UnionIoTDBPipePattern pattern) {
+      final IoTDBPipePatternOperations pattern) {
     return pattern.matchDevice(activateTemplateStatement.getPath().getFullPath())
         ? Optional.of(activateTemplateStatement)
         : Optional.empty();
@@ -129,7 +129,7 @@ public class PipeStatementPatternParseVisitor
   @Override
   public Optional<Statement> visitCreateLogicalView(
       final CreateLogicalViewStatement createLogicalViewStatement,
-      final UnionIoTDBPipePattern pattern) {
+      final IoTDBPipePatternOperations pattern) {
     final int[] filteredIndexes =
         IntStream.range(0, createLogicalViewStatement.getTargetPathList().size())
             .filter(
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/IoTDBDataRegionSource.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/IoTDBDataRegionSource.java
index ec99ed2abaf..77195ab58df 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/IoTDBDataRegionSource.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/IoTDBDataRegionSource.java
@@ -21,8 +21,8 @@ package org.apache.iotdb.db.pipe.source.dataregion;
 
 import org.apache.iotdb.commons.consensus.DataRegionId;
 import org.apache.iotdb.commons.pipe.agent.task.PipeTaskAgent;
+import org.apache.iotdb.commons.pipe.datastructure.pattern.IoTDBPipePatternOperations;
 import org.apache.iotdb.commons.pipe.datastructure.pattern.PipePattern;
-import org.apache.iotdb.commons.pipe.datastructure.pattern.UnionIoTDBPipePattern;
 import org.apache.iotdb.commons.pipe.source.IoTDBSource;
 import org.apache.iotdb.consensus.ConsensusFactory;
 import org.apache.iotdb.db.conf.IoTDBDescriptor;
@@ -227,8 +227,8 @@ public class IoTDBDataRegionSource extends IoTDBSource {
     }
 
     if (shouldExtractDeletion
-        && !(pattern instanceof UnionIoTDBPipePattern
-            && (((UnionIoTDBPipePattern) pattern).isPrefixOrFullPath()))) {
+        && !(pattern instanceof IoTDBPipePatternOperations
+            && (((IoTDBPipePatternOperations) pattern).isPrefixOrFullPath()))) {
       throw new IllegalArgumentException(
           String.format(
               "The path pattern %s is not valid for the source. Only prefix or full path is allowed.",
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/schemaregion/PipePlanPatternParseVisitor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/schemaregion/PipePlanPatternParseVisitor.java
index edfe437b44f..9b876c41a8e 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/schemaregion/PipePlanPatternParseVisitor.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/schemaregion/PipePlanPatternParseVisitor.java
@@ -20,8 +20,8 @@
 package org.apache.iotdb.db.pipe.source.schemaregion;
 
 import org.apache.iotdb.commons.path.PartialPath;
+import org.apache.iotdb.commons.pipe.datastructure.pattern.IoTDBPipePatternOperations;
 import org.apache.iotdb.commons.pipe.datastructure.pattern.PipePattern;
-import org.apache.iotdb.commons.pipe.datastructure.pattern.UnionIoTDBPipePattern;
 import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
 import org.apache.iotdb.db.pipe.event.common.schema.PipeSchemaRegionWritePlanEvent;
 import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanNode;
@@ -53,12 +53,12 @@ import java.util.stream.IntStream;
 
 /**
  * The {@link PipePlanPatternParseVisitor} will transform the schema {@link PlanNode}s using {@link
- * UnionIoTDBPipePattern}. Rule:
+ * IoTDBPipePatternOperations}. Rule:
  *
  * <p>1. All patterns in the output {@link PlanNode} will be the intersection of the original {@link
- * PlanNode}'s patterns and the given {@link UnionIoTDBPipePattern}.
+ * PlanNode}'s patterns and the given {@link IoTDBPipePatternOperations}.
  *
- * <p>2. If a pattern does not intersect with the {@link UnionIoTDBPipePattern}, it's dropped.
+ * <p>2. If a pattern does not intersect with the {@link IoTDBPipePatternOperations}, it's dropped.
  *
  * <p>3. If all the patterns in the {@link PlanNode} is dropped, the {@link PlanNode} is dropped.
  *
@@ -66,15 +66,16 @@ import java.util.stream.IntStream;
  * one is used in the {@link PipeSchemaRegionWritePlanEvent} in {@link SchemaRegionListeningQueue}.
  */
 public class PipePlanPatternParseVisitor
-    extends PlanVisitor<Optional<PlanNode>, UnionIoTDBPipePattern> {
+    extends PlanVisitor<Optional<PlanNode>, IoTDBPipePatternOperations> {
   @Override
-  public Optional<PlanNode> visitPlan(final PlanNode node, final UnionIoTDBPipePattern pattern) {
+  public Optional<PlanNode> visitPlan(
+      final PlanNode node, final IoTDBPipePatternOperations pattern) {
     return Optional.of(node);
   }
 
   @Override
   public Optional<PlanNode> visitCreateTimeSeries(
-      final CreateTimeSeriesNode node, final UnionIoTDBPipePattern pattern) {
+      final CreateTimeSeriesNode node, final IoTDBPipePatternOperations pattern) {
     return pattern.matchesMeasurement(node.getPath().getDevice(), node.getPath().getMeasurement())
         ? Optional.of(node)
         : Optional.empty();
@@ -82,7 +83,7 @@ public class PipePlanPatternParseVisitor
 
   @Override
   public Optional<PlanNode> visitCreateAlignedTimeSeries(
-      final CreateAlignedTimeSeriesNode node, final UnionIoTDBPipePattern pattern) {
+      final CreateAlignedTimeSeriesNode node, final IoTDBPipePatternOperations pattern) {
     final int[] filteredIndexes =
         IntStream.range(0, node.getMeasurements().size())
             .filter(
@@ -107,7 +108,7 @@ public class PipePlanPatternParseVisitor
 
   @Override
   public Optional<PlanNode> visitCreateMultiTimeSeries(
-      final CreateMultiTimeSeriesNode node, final UnionIoTDBPipePattern pattern) {
+      final CreateMultiTimeSeriesNode node, final IoTDBPipePatternOperations pattern) {
     final Map<PartialPath, MeasurementGroup> filteredMeasurementGroupMap =
         node.getMeasurementGroupMap().entrySet().stream()
             .filter(entry -> pattern.matchPrefixPath(entry.getKey().getFullPath()))
@@ -126,7 +127,7 @@ public class PipePlanPatternParseVisitor
   }
 
   private static MeasurementGroup trimMeasurementGroup(
-      final String device, final MeasurementGroup group, final UnionIoTDBPipePattern pattern) {
+      final String device, final MeasurementGroup group, final IoTDBPipePatternOperations pattern) {
     final int[] filteredIndexes =
         IntStream.range(0, group.size())
             .filter(index -> pattern.matchesMeasurement(device, group.getMeasurements().get(index)))
@@ -161,7 +162,7 @@ public class PipePlanPatternParseVisitor
 
   @Override
   public Optional<PlanNode> visitAlterTimeSeries(
-      final AlterTimeSeriesNode node, final UnionIoTDBPipePattern pattern) {
+      final AlterTimeSeriesNode node, final IoTDBPipePatternOperations pattern) {
     return pattern.matchesMeasurement(node.getPath().getDevice(), node.getPath().getMeasurement())
         ? Optional.of(node)
         : Optional.empty();
@@ -169,7 +170,7 @@ public class PipePlanPatternParseVisitor
 
   @Override
   public Optional<PlanNode> visitInternalCreateTimeSeries(
-      final InternalCreateTimeSeriesNode node, final UnionIoTDBPipePattern pattern) {
+      final InternalCreateTimeSeriesNode node, final IoTDBPipePatternOperations pattern) {
     final MeasurementGroup group =
         pattern.matchPrefixPath(node.getDevicePath().getFullPath())
             ? trimMeasurementGroup(
@@ -184,7 +185,7 @@ public class PipePlanPatternParseVisitor
 
   @Override
   public Optional<PlanNode> visitActivateTemplate(
-      final ActivateTemplateNode node, final UnionIoTDBPipePattern pattern) {
+      final ActivateTemplateNode node, final IoTDBPipePatternOperations pattern) {
     return pattern.matchDevice(node.getActivatePath().getFullPath())
         ? Optional.of(node)
         : Optional.empty();
@@ -192,7 +193,7 @@ public class PipePlanPatternParseVisitor
 
   @Override
   public Optional<PlanNode> visitInternalBatchActivateTemplate(
-      final InternalBatchActivateTemplateNode node, final UnionIoTDBPipePattern pattern) {
+      final InternalBatchActivateTemplateNode node, final IoTDBPipePatternOperations pattern) {
     final Map<PartialPath, Pair<Integer, Integer>> filteredTemplateActivationMap =
         node.getTemplateActivationMap().entrySet().stream()
             .filter(entry -> pattern.matchDevice(entry.getKey().getFullPath()))
@@ -206,7 +207,7 @@ public class PipePlanPatternParseVisitor
 
   @Override
   public Optional<PlanNode> visitInternalCreateMultiTimeSeries(
-      final InternalCreateMultiTimeSeriesNode node, final UnionIoTDBPipePattern pattern) {
+      final InternalCreateMultiTimeSeriesNode node, final IoTDBPipePatternOperations pattern) {
     final Map<PartialPath, Pair<Boolean, MeasurementGroup>> filteredDeviceMap =
         node.getDeviceMap().entrySet().stream()
             .filter(entry -> pattern.matchPrefixPath(entry.getKey().getFullPath()))
@@ -230,7 +231,7 @@ public class PipePlanPatternParseVisitor
 
   @Override
   public Optional<PlanNode> visitBatchActivateTemplate(
-      final BatchActivateTemplateNode node, final UnionIoTDBPipePattern pattern) {
+      final BatchActivateTemplateNode node, final IoTDBPipePatternOperations pattern) {
     final Map<PartialPath, Pair<Integer, Integer>> filteredTemplateActivationMap =
         node.getTemplateActivationMap().entrySet().stream()
             .filter(entry -> pattern.matchDevice(entry.getKey().getFullPath()))
@@ -243,7 +244,7 @@ public class PipePlanPatternParseVisitor
 
   @Override
   public Optional<PlanNode> visitCreateLogicalView(
-      final CreateLogicalViewNode node, final UnionIoTDBPipePattern pattern) {
+      final CreateLogicalViewNode node, final IoTDBPipePatternOperations pattern) {
     final Map<PartialPath, ViewExpression> filteredViewPathToSourceMap =
         node.getViewPathToSourceExpressionMap().entrySet().stream()
             .filter(
@@ -258,7 +259,7 @@ public class PipePlanPatternParseVisitor
 
   @Override
   public Optional<PlanNode> visitAlterLogicalView(
-      final AlterLogicalViewNode node, final UnionIoTDBPipePattern pattern) {
+      final AlterLogicalViewNode node, final IoTDBPipePatternOperations pattern) {
     final Map<PartialPath, ViewExpression> filteredViewPathToSourceMap =
         node.getViewPathToSourceMap().entrySet().stream()
             .filter(
@@ -273,7 +274,7 @@ public class PipePlanPatternParseVisitor
 
   @Override
   public Optional<PlanNode> visitDeleteData(
-      final DeleteDataNode node, final UnionIoTDBPipePattern pattern) {
+      final DeleteDataNode node, final IoTDBPipePatternOperations pattern) {
     final List<PartialPath> intersectedPaths =
         node.getPathList().stream()
             .map(pattern::getIntersection)
diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/pattern/PipePatternCoverageTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/pattern/PipePatternCoverageTest.java
new file mode 100644
index 00000000000..0290717b54d
--- /dev/null
+++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/pattern/PipePatternCoverageTest.java
@@ -0,0 +1,133 @@
+/*
+ * 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.iotdb.db.pipe.pattern;
+
+import org.apache.iotdb.commons.pipe.datastructure.pattern.IoTDBPipePattern;
+import org.apache.iotdb.commons.pipe.datastructure.pattern.PipePattern;
+import org.apache.iotdb.commons.pipe.datastructure.pattern.PrefixPipePattern;
+import org.apache.iotdb.commons.pipe.datastructure.pattern.UnionIoTDBPipePattern;
+import org.apache.iotdb.pipe.api.exception.PipeException;
+
+import org.junit.Test;
+
+import java.util.Arrays;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertThrows;
+
+/**
+ * Test class for {@link PipePattern#checkAndLogPatternCoverage(PipePattern, PipePattern)}. It
+ * verifies the returned counts for different coverage scenarios.
+ */
+public class PipePatternCoverageTest {
+
+  // ========================================================================
+  // Helper Methods
+  // ========================================================================
+
+  private IoTDBPipePattern iotdb(final String pattern) {
+    return new IoTDBPipePattern(pattern);
+  }
+
+  private PrefixPipePattern prefix(final String pattern) {
+    return new PrefixPipePattern(pattern);
+  }
+
+  private UnionIoTDBPipePattern union(final IoTDBPipePattern... patterns) {
+    return new UnionIoTDBPipePattern(Arrays.asList(patterns));
+  }
+
+  // ========================================================================
+  // Test Cases
+  // ========================================================================
+
+  @Test
+  public void testFullCoverageIoTDB() {
+    final PipePattern inclusion = iotdb("root.a.b.c");
+    final PipePattern exclusion = iotdb("root.a.**");
+
+    // Verify that a PipeException is thrown
+    final PipeException e =
+        assertThrows(
+            PipeException.class,
+            () -> PipePattern.checkAndLogPatternCoverage(inclusion, exclusion));
+  }
+
+  @Test
+  public void testPartialCoverageIoTDB() {
+    final PipePattern inclusion =
+        union(
+            iotdb("root.a.b.c"), // covered
+            iotdb("root.x.y.z") // not covered
+            );
+    final PipePattern exclusion = iotdb("root.a.**"); // only covers the first one
+
+    // 2 inclusion paths, 1 covered
+    final int[] counts = PipePattern.checkAndLogPatternCoverage(inclusion, exclusion);
+    assertArrayEquals(new int[] {1, 2}, counts);
+  }
+
+  @Test
+  public void testNoCoverage() {
+    final PipePattern inclusion = iotdb("root.a.b.c");
+    final PipePattern exclusion = iotdb("root.x.y.z");
+
+    // 1 inclusion path, 0 covered
+    final int[] counts = PipePattern.checkAndLogPatternCoverage(inclusion, exclusion);
+    assertArrayEquals(new int[] {0, 1}, counts);
+  }
+
+  @Test
+  public void testFullCoveragePrefix() {
+    // Prefix "root.a.b" corresponds to 4 variants
+    // (root.a.b, root.a.b*, root.a.b.**, root.a.b*.**)
+    final PipePattern inclusion = prefix("root.a.b");
+    // IoTDB "root.a.**" should cover all 4 variants
+    final PipePattern exclusion = iotdb("root.a.**");
+
+    // Verify that a PipeException is thrown
+    final PipeException e =
+        assertThrows(
+            PipeException.class,
+            () -> PipePattern.checkAndLogPatternCoverage(inclusion, exclusion));
+  }
+
+  @Test
+  public void testPartialCoveragePrefix() {
+    // Prefix "root.a.b" corresponds to 4 variants
+    final PipePattern inclusion = prefix("root.a.b");
+    // IoTDB "root.a.b" only includes the exact "root.a.b" path
+    final PipePattern exclusion = iotdb("root.a.b");
+
+    // 4 inclusion paths, 1 covered
+    final int[] counts = PipePattern.checkAndLogPatternCoverage(inclusion, exclusion);
+    assertArrayEquals(new int[] {1, 4}, counts);
+  }
+
+  @Test
+  public void testPrefixNoCoverage() {
+    final PipePattern inclusion = prefix("root.a.b");
+    final PipePattern exclusion = iotdb("root.x.y.z");
+
+    // 4 inclusion paths, 0 covered
+    final int[] counts = PipePattern.checkAndLogPatternCoverage(inclusion, exclusion);
+    assertArrayEquals(new int[] {0, 4}, counts);
+  }
+}
diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/sink/PipeStatementPatternParseVisitorTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/sink/PipeStatementPatternParseVisitorTest.java
index 04d3696b2ad..0c286e3f1f3 100644
--- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/sink/PipeStatementPatternParseVisitorTest.java
+++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/sink/PipeStatementPatternParseVisitorTest.java
@@ -20,9 +20,12 @@
 package org.apache.iotdb.db.pipe.sink;
 
 import org.apache.iotdb.commons.exception.IllegalPathException;
+import org.apache.iotdb.commons.path.MeasurementPath;
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.commons.pipe.datastructure.pattern.IoTDBPipePattern;
+import org.apache.iotdb.commons.pipe.datastructure.pattern.IoTDBPipePatternOperations;
 import org.apache.iotdb.commons.pipe.datastructure.pattern.UnionIoTDBPipePattern;
+import org.apache.iotdb.commons.pipe.datastructure.pattern.WithExclusionIoTDBPipePattern;
 import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimeSeriesViewOperand;
 import org.apache.iotdb.db.pipe.receiver.visitor.PipeStatementPatternParseVisitor;
 import org.apache.iotdb.db.queryengine.plan.statement.metadata.AlterTimeSeriesStatement;
@@ -43,145 +46,215 @@ import java.util.Map;
 
 public class PipeStatementPatternParseVisitorTest {
 
-  private final UnionIoTDBPipePattern prefixPathPattern =
+  private final IoTDBPipePatternOperations prefixPathPattern =
       new UnionIoTDBPipePattern(new IoTDBPipePattern("root.db.device.**"));
-  private final UnionIoTDBPipePattern fullPathPattern =
+  private final IoTDBPipePatternOperations fullPathPattern =
       new UnionIoTDBPipePattern(new IoTDBPipePattern("root.db.device.s1"));
-  private final UnionIoTDBPipePattern multiplePathPattern =
+  private final IoTDBPipePatternOperations multiplePathPattern =
       new UnionIoTDBPipePattern(
           Arrays.asList(
               new IoTDBPipePattern("root.db.device.s1"),
               new IoTDBPipePattern("root.db.device.s2")));
+  private final IoTDBPipePatternOperations exclusionPattern =
+      new WithExclusionIoTDBPipePattern(
+          new UnionIoTDBPipePattern(
+              new IoTDBPipePattern("root.db.device.**")), // Inclusion: root.db.device.**
+          new UnionIoTDBPipePattern(
+              new IoTDBPipePattern("root.db.device.s2")) // Exclusion: root.db.device.s2
+          );
 
   @Test
   public void testCreateTimeSeries() throws IllegalPathException {
-    final CreateTimeSeriesStatement createTimeSeriesStatement = new CreateTimeSeriesStatement();
-    createTimeSeriesStatement.setPath(new PartialPath("root.db.device.s1"));
-    createTimeSeriesStatement.setDataType(TSDataType.FLOAT);
-    createTimeSeriesStatement.setEncoding(TSEncoding.RLE);
-    createTimeSeriesStatement.setCompressor(CompressionType.SNAPPY);
-    createTimeSeriesStatement.setProps(Collections.emptyMap());
-    createTimeSeriesStatement.setTags(Collections.emptyMap());
-    createTimeSeriesStatement.setAttributes(Collections.emptyMap());
-    createTimeSeriesStatement.setAlias("a1");
+    final CreateTimeSeriesStatement createTimeSeriesStatementS1 = new CreateTimeSeriesStatement();
+    createTimeSeriesStatementS1.setPath(new MeasurementPath("root.db.device.s1"));
+    createTimeSeriesStatementS1.setDataType(TSDataType.FLOAT);
+    createTimeSeriesStatementS1.setEncoding(TSEncoding.RLE);
+    createTimeSeriesStatementS1.setCompressor(CompressionType.SNAPPY);
+    createTimeSeriesStatementS1.setProps(Collections.emptyMap());
+    createTimeSeriesStatementS1.setTags(Collections.emptyMap());
+    createTimeSeriesStatementS1.setAttributes(Collections.emptyMap());
+    createTimeSeriesStatementS1.setAlias("a1");
+
+    final CreateTimeSeriesStatement createTimeSeriesStatementS2 = new CreateTimeSeriesStatement();
+    createTimeSeriesStatementS2.setPath(new MeasurementPath("root.db.device.s2"));
+    createTimeSeriesStatementS2.setDataType(TSDataType.INT32);
+    createTimeSeriesStatementS2.setEncoding(TSEncoding.PLAIN);
+    createTimeSeriesStatementS2.setCompressor(CompressionType.SNAPPY);
+    createTimeSeriesStatementS2.setProps(Collections.emptyMap());
+    createTimeSeriesStatementS2.setTags(Collections.emptyMap());
+    createTimeSeriesStatementS2.setAttributes(Collections.emptyMap());
+    createTimeSeriesStatementS2.setAlias("a2");
 
     final CreateTimeSeriesStatement createTimeSeriesStatementToFilter =
         new CreateTimeSeriesStatement();
-    createTimeSeriesStatementToFilter.setPath(new PartialPath("root.db1.device.s1"));
+    createTimeSeriesStatementToFilter.setPath(new MeasurementPath("root.db1.device.s1"));
     createTimeSeriesStatementToFilter.setDataType(TSDataType.FLOAT);
     createTimeSeriesStatementToFilter.setEncoding(TSEncoding.RLE);
     createTimeSeriesStatementToFilter.setCompressor(CompressionType.SNAPPY);
     createTimeSeriesStatementToFilter.setProps(Collections.emptyMap());
     createTimeSeriesStatementToFilter.setTags(Collections.emptyMap());
     createTimeSeriesStatementToFilter.setAttributes(Collections.emptyMap());
-    createTimeSeriesStatementToFilter.setAlias("a2");
+    createTimeSeriesStatementToFilter.setAlias("a3");
 
     Assert.assertEquals(
-        createTimeSeriesStatement,
+        createTimeSeriesStatementS1,
         new PipeStatementPatternParseVisitor()
-            .visitCreateTimeseries(createTimeSeriesStatement, prefixPathPattern)
+            .visitCreateTimeseries(createTimeSeriesStatementS1, prefixPathPattern)
             .orElseThrow(AssertionError::new));
     Assert.assertFalse(
         new PipeStatementPatternParseVisitor()
             .visitCreateTimeseries(createTimeSeriesStatementToFilter, prefixPathPattern)
             .isPresent());
+
     Assert.assertEquals(
-        createTimeSeriesStatement,
+        createTimeSeriesStatementS1,
         new PipeStatementPatternParseVisitor()
-            .visitCreateTimeseries(createTimeSeriesStatement, multiplePathPattern)
+            .visitCreateTimeseries(createTimeSeriesStatementS1, multiplePathPattern)
             .orElseThrow(AssertionError::new));
     Assert.assertFalse(
         new PipeStatementPatternParseVisitor()
             .visitCreateTimeseries(createTimeSeriesStatementToFilter, multiplePathPattern)
             .isPresent());
+
+    Assert.assertEquals(
+        createTimeSeriesStatementS1,
+        new PipeStatementPatternParseVisitor()
+            .visitCreateTimeseries(createTimeSeriesStatementS1, exclusionPattern)
+            .orElseThrow(AssertionError::new));
+    Assert.assertFalse(
+        new PipeStatementPatternParseVisitor()
+            .visitCreateTimeseries(createTimeSeriesStatementS2, exclusionPattern)
+            .isPresent());
+    Assert.assertFalse(
+        new PipeStatementPatternParseVisitor()
+            .visitCreateTimeseries(createTimeSeriesStatementToFilter, exclusionPattern)
+            .isPresent());
   }
 
   @Test
   public void testCreateAlignedTimeSeries() throws IllegalPathException {
-    final CreateAlignedTimeSeriesStatement expectedCreateAlignedTimeSeriesStatement =
-        new CreateAlignedTimeSeriesStatement();
-    expectedCreateAlignedTimeSeriesStatement.setDevicePath(new PartialPath("root.db.device"));
-    expectedCreateAlignedTimeSeriesStatement.setMeasurements(Collections.singletonList("s1"));
-    expectedCreateAlignedTimeSeriesStatement.setDataTypes(
-        Collections.singletonList(TSDataType.FLOAT));
-    expectedCreateAlignedTimeSeriesStatement.setEncodings(
-        Collections.singletonList(TSEncoding.RLE));
-    expectedCreateAlignedTimeSeriesStatement.setCompressors(
-        Collections.singletonList(CompressionType.SNAPPY));
-    expectedCreateAlignedTimeSeriesStatement.setTagsList(
-        Collections.singletonList(Collections.emptyMap()));
-    expectedCreateAlignedTimeSeriesStatement.setAttributesList(
-        Collections.singletonList(Collections.emptyMap()));
-    expectedCreateAlignedTimeSeriesStatement.setAliasList(Collections.singletonList("a1"));
-
-    final CreateAlignedTimeSeriesStatement originalCreateAlignedTimeSeriesStatement =
-        new CreateAlignedTimeSeriesStatement();
-    originalCreateAlignedTimeSeriesStatement.setDevicePath(new PartialPath("root.db.device"));
-    originalCreateAlignedTimeSeriesStatement.setMeasurements(Arrays.asList("s1", "s2"));
-    originalCreateAlignedTimeSeriesStatement.setDataTypes(
-        Arrays.asList(TSDataType.FLOAT, TSDataType.BOOLEAN));
-    originalCreateAlignedTimeSeriesStatement.setEncodings(
-        Arrays.asList(TSEncoding.RLE, TSEncoding.PLAIN));
-    originalCreateAlignedTimeSeriesStatement.setCompressors(
-        Arrays.asList(CompressionType.SNAPPY, CompressionType.SNAPPY));
-    originalCreateAlignedTimeSeriesStatement.setTagsList(
-        Arrays.asList(Collections.emptyMap(), Collections.emptyMap()));
-    originalCreateAlignedTimeSeriesStatement.setAttributesList(
-        Arrays.asList(Collections.emptyMap(), Collections.emptyMap()));
-    originalCreateAlignedTimeSeriesStatement.setAliasList(Arrays.asList("a1", "a2"));
+    final CreateAlignedTimeSeriesStatement expectedS1Only = new CreateAlignedTimeSeriesStatement();
+    expectedS1Only.setDevicePath(new PartialPath("root.db.device"));
+    expectedS1Only.setMeasurements(Collections.singletonList("s1"));
+    expectedS1Only.setDataTypes(Collections.singletonList(TSDataType.FLOAT));
+    expectedS1Only.setEncodings(Collections.singletonList(TSEncoding.RLE));
+    expectedS1Only.setCompressors(Collections.singletonList(CompressionType.SNAPPY));
+    expectedS1Only.setTagsList(Collections.singletonList(Collections.emptyMap()));
+    expectedS1Only.setAttributesList(Collections.singletonList(Collections.emptyMap()));
+    expectedS1Only.setAliasList(Collections.singletonList("a1"));
+
+    final CreateAlignedTimeSeriesStatement originalS1S2 = new CreateAlignedTimeSeriesStatement();
+    originalS1S2.setDevicePath(new PartialPath("root.db.device"));
+    originalS1S2.setMeasurements(Arrays.asList("s1", "s2"));
+    originalS1S2.setDataTypes(Arrays.asList(TSDataType.FLOAT, TSDataType.BOOLEAN));
+    originalS1S2.setEncodings(Arrays.asList(TSEncoding.RLE, TSEncoding.PLAIN));
+    originalS1S2.setCompressors(Arrays.asList(CompressionType.SNAPPY, CompressionType.SNAPPY));
+    originalS1S2.setTagsList(Arrays.asList(Collections.emptyMap(), Collections.emptyMap()));
+    originalS1S2.setAttributesList(Arrays.asList(Collections.emptyMap(), Collections.emptyMap()));
+    originalS1S2.setAliasList(Arrays.asList("a1", "a2"));
+
+    final CreateAlignedTimeSeriesStatement originalS1S2S3 = new CreateAlignedTimeSeriesStatement();
+    originalS1S2S3.setDevicePath(new PartialPath("root.db.device"));
+    originalS1S2S3.setMeasurements(Arrays.asList("s1", "s2", "s3"));
+    originalS1S2S3.setDataTypes(
+        Arrays.asList(TSDataType.FLOAT, TSDataType.BOOLEAN, TSDataType.INT32));
+    originalS1S2S3.setEncodings(Arrays.asList(TSEncoding.RLE, TSEncoding.PLAIN, TSEncoding.RLE));
+    originalS1S2S3.setCompressors(
+        Arrays.asList(CompressionType.SNAPPY, CompressionType.SNAPPY, CompressionType.SNAPPY));
+    originalS1S2S3.setTagsList(
+        Arrays.asList(Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap()));
+    originalS1S2S3.setAttributesList(
+        Arrays.asList(Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap()));
+    originalS1S2S3.setAliasList(Arrays.asList("a1", "a2", "a3"));
+
+    Assert.assertEquals(
+        expectedS1Only,
+        new PipeStatementPatternParseVisitor()
+            .visitCreateAlignedTimeseries(originalS1S2, fullPathPattern)
+            .orElseThrow(AssertionError::new));
 
     Assert.assertEquals(
-        expectedCreateAlignedTimeSeriesStatement,
+        originalS1S2,
         new PipeStatementPatternParseVisitor()
-            .visitCreateAlignedTimeseries(originalCreateAlignedTimeSeriesStatement, fullPathPattern)
+            .visitCreateAlignedTimeseries(originalS1S2S3, multiplePathPattern)
             .orElseThrow(AssertionError::new));
 
+    final CreateAlignedTimeSeriesStatement expectedS1S3 = new CreateAlignedTimeSeriesStatement();
+    expectedS1S3.setDevicePath(new PartialPath("root.db.device"));
+    expectedS1S3.setMeasurements(Arrays.asList("s1", "s3"));
+    expectedS1S3.setDataTypes(Arrays.asList(TSDataType.FLOAT, TSDataType.INT32));
+    expectedS1S3.setEncodings(Arrays.asList(TSEncoding.RLE, TSEncoding.RLE));
+    expectedS1S3.setCompressors(Arrays.asList(CompressionType.SNAPPY, CompressionType.SNAPPY));
+    expectedS1S3.setTagsList(Arrays.asList(Collections.emptyMap(), Collections.emptyMap()));
+    expectedS1S3.setAttributesList(Arrays.asList(Collections.emptyMap(), Collections.emptyMap()));
+    expectedS1S3.setAliasList(Arrays.asList("a1", "a3"));
+
     Assert.assertEquals(
-        originalCreateAlignedTimeSeriesStatement,
+        expectedS1S3,
         new PipeStatementPatternParseVisitor()
-            .visitCreateAlignedTimeseries(
-                originalCreateAlignedTimeSeriesStatement, multiplePathPattern)
+            .visitCreateAlignedTimeseries(originalS1S2S3, exclusionPattern)
             .orElseThrow(AssertionError::new));
   }
 
   @Test
   public void testAlterTimeSeries() throws IllegalPathException {
-    final AlterTimeSeriesStatement alterTimeSeriesStatement = new AlterTimeSeriesStatement(true);
-
     final Map<String, String> attributeMap = Collections.singletonMap("k1", "v1");
-    alterTimeSeriesStatement.setPath(new PartialPath("root.db.device.s1"));
-    alterTimeSeriesStatement.setAlterMap(attributeMap);
-    alterTimeSeriesStatement.setTagsMap(Collections.emptyMap());
-    alterTimeSeriesStatement.setAttributesMap(attributeMap);
-    alterTimeSeriesStatement.setAlias("");
+
+    final AlterTimeSeriesStatement alterTimeSeriesStatementS1 = new AlterTimeSeriesStatement(true);
+    alterTimeSeriesStatementS1.setPath(new MeasurementPath("root.db.device.s1"));
+    alterTimeSeriesStatementS1.setAlterMap(attributeMap);
+    alterTimeSeriesStatementS1.setTagsMap(Collections.emptyMap());
+    alterTimeSeriesStatementS1.setAttributesMap(attributeMap);
+    alterTimeSeriesStatementS1.setAlias("");
+
+    final AlterTimeSeriesStatement alterTimeSeriesStatementS2 = new AlterTimeSeriesStatement(true);
+    alterTimeSeriesStatementS2.setPath(new MeasurementPath("root.db.device.s2")); // Different path
+    alterTimeSeriesStatementS2.setAlterMap(attributeMap);
+    alterTimeSeriesStatementS2.setTagsMap(Collections.emptyMap());
+    alterTimeSeriesStatementS2.setAttributesMap(attributeMap);
+    alterTimeSeriesStatementS2.setAlias("");
 
     final AlterTimeSeriesStatement alterTimeSeriesStatementToFilter =
         new AlterTimeSeriesStatement(true);
-
-    alterTimeSeriesStatementToFilter.setPath(new PartialPath("root.db1.device.s1"));
+    alterTimeSeriesStatementToFilter.setPath(new MeasurementPath("root.db1.device.s1"));
     alterTimeSeriesStatementToFilter.setAlterMap(attributeMap);
     alterTimeSeriesStatementToFilter.setTagsMap(Collections.emptyMap());
     alterTimeSeriesStatementToFilter.setAttributesMap(attributeMap);
     alterTimeSeriesStatementToFilter.setAlias("");
 
     Assert.assertEquals(
-        alterTimeSeriesStatement,
+        alterTimeSeriesStatementS1,
         new PipeStatementPatternParseVisitor()
-            .visitAlterTimeSeries(alterTimeSeriesStatement, fullPathPattern)
+            .visitAlterTimeSeries(alterTimeSeriesStatementS1, fullPathPattern)
             .orElseThrow(AssertionError::new));
     Assert.assertFalse(
         new PipeStatementPatternParseVisitor()
             .visitAlterTimeSeries(alterTimeSeriesStatementToFilter, prefixPathPattern)
             .isPresent());
+
     Assert.assertEquals(
-        alterTimeSeriesStatement,
+        alterTimeSeriesStatementS1,
         new PipeStatementPatternParseVisitor()
-            .visitAlterTimeSeries(alterTimeSeriesStatement, multiplePathPattern)
+            .visitAlterTimeSeries(alterTimeSeriesStatementS1, multiplePathPattern)
             .orElseThrow(AssertionError::new));
     Assert.assertFalse(
         new PipeStatementPatternParseVisitor()
             .visitAlterTimeSeries(alterTimeSeriesStatementToFilter, multiplePathPattern)
             .isPresent());
+
+    Assert.assertEquals(
+        alterTimeSeriesStatementS1,
+        new PipeStatementPatternParseVisitor()
+            .visitAlterTimeSeries(alterTimeSeriesStatementS1, exclusionPattern)
+            .orElseThrow(AssertionError::new));
+    Assert.assertFalse(
+        new PipeStatementPatternParseVisitor()
+            .visitAlterTimeSeries(alterTimeSeriesStatementS2, exclusionPattern)
+            .isPresent());
+    Assert.assertFalse(
+        new PipeStatementPatternParseVisitor()
+            .visitAlterTimeSeries(alterTimeSeriesStatementToFilter, exclusionPattern)
+            .isPresent());
   }
 
   @Test
diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/source/PipePlanPatternParseVisitorTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/source/PipePlanPatternParseVisitorTest.java
index 86c3d134376..05417bf7351 100644
--- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/source/PipePlanPatternParseVisitorTest.java
+++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/source/PipePlanPatternParseVisitorTest.java
@@ -23,6 +23,7 @@ import org.apache.iotdb.commons.exception.IllegalPathException;
 import org.apache.iotdb.commons.path.MeasurementPath;
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.commons.pipe.datastructure.pattern.IoTDBPipePattern;
+import org.apache.iotdb.commons.pipe.datastructure.pattern.IoTDBPipePatternOperations;
 import org.apache.iotdb.commons.pipe.datastructure.pattern.UnionIoTDBPipePattern;
 import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
 import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimeSeriesViewOperand;
@@ -57,11 +58,11 @@ import java.util.Map;
 
 public class PipePlanPatternParseVisitorTest {
 
-  private final UnionIoTDBPipePattern prefixPathPattern =
+  private final IoTDBPipePatternOperations prefixPathPattern =
       new UnionIoTDBPipePattern(new IoTDBPipePattern("root.db.device.**"));
-  private final UnionIoTDBPipePattern fullPathPattern =
+  private final IoTDBPipePatternOperations fullPathPattern =
       new UnionIoTDBPipePattern(new IoTDBPipePattern("root.db.device.s1"));
-  private final UnionIoTDBPipePattern multiplePathPattern =
+  private final IoTDBPipePatternOperations multiplePathPattern =
       new UnionIoTDBPipePattern(
           Arrays.asList(
               new IoTDBPipePattern("root.db.device.s1"),
diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/config/constant/PipeSourceConstant.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/config/constant/PipeSourceConstant.java
index 0417c66096e..e9adf64bc03 100644
--- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/config/constant/PipeSourceConstant.java
+++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/config/constant/PipeSourceConstant.java
@@ -50,6 +50,10 @@ public class PipeSourceConstant {
   public static final String EXTRACTOR_PATTERN_FORMAT_IOTDB_VALUE = "iotdb";
   public static final String EXTRACTOR_PATTERN_PREFIX_DEFAULT_VALUE = "root";
   public static final String EXTRACTOR_PATTERN_IOTDB_DEFAULT_VALUE = "root.**";
+  public static final String EXTRACTOR_PATTERN_EXCLUSION_KEY = "extractor.pattern.exclusion";
+  public static final String SOURCE_PATTERN_EXCLUSION_KEY = "source.pattern.exclusion";
+  public static final String EXTRACTOR_PATH_EXCLUSION_KEY = "extractor.path.exclusion";
+  public static final String SOURCE_PATH_EXCLUSION_KEY = "source.path.exclusion";
 
   public static final String EXTRACTOR_FORWARDING_PIPE_REQUESTS_KEY =
       "extractor.forwarding-pipe-requests";
diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/IoTDBPipePattern.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/IoTDBPipePattern.java
index b8bfc21e099..052141c53e3 100644
--- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/IoTDBPipePattern.java
+++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/IoTDBPipePattern.java
@@ -33,14 +33,15 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Objects;
 
-public class IoTDBPipePattern extends SinglePipePattern {
+public class IoTDBPipePattern extends IoTDBPipePatternOperations {
 
+  private final String pattern;
   private final PartialPath patternPartialPath;
   private static volatile DevicePathGetter devicePathGetter = PartialPath::new;
   private static volatile MeasurementPathGetter measurementPathGetter = PartialPath::new;
 
   public IoTDBPipePattern(final String pattern) {
-    super(pattern);
+    this.pattern = pattern != null ? pattern : getDefaultPattern();
 
     try {
       patternPartialPath = new PartialPath(getPattern());
@@ -49,11 +50,22 @@ public class IoTDBPipePattern extends SinglePipePattern {
     }
   }
 
-  @Override
-  public String getDefaultPattern() {
+  private String getDefaultPattern() {
     return PipeSourceConstant.EXTRACTOR_PATTERN_IOTDB_DEFAULT_VALUE;
   }
 
+  //////////////////////////// Pipe Pattern Operations ////////////////////////////
+
+  @Override
+  public String getPattern() {
+    return pattern;
+  }
+
+  @Override
+  public boolean isRoot() {
+    return Objects.isNull(pattern) || this.pattern.equals(this.getDefaultPattern());
+  }
+
   @Override
   public boolean isLegal() {
     if (!pattern.startsWith("root")) {
@@ -122,6 +134,13 @@ public class IoTDBPipePattern extends SinglePipePattern {
     }
   }
 
+  @Override
+  public List<PartialPath> getBaseInclusionPaths() {
+    return Collections.singletonList(patternPartialPath);
+  }
+
+  //////////////////////////// IoTDB Pipe Pattern Operations ////////////////////////////
+
   /**
    * Check if the {@link PipePattern} matches the given prefix path.
    *
@@ -129,6 +148,7 @@ public class IoTDBPipePattern extends SinglePipePattern {
    * whether the given path can act as a parent path of the {@link PipePattern}, and to transmit
    * possibly used schemas like database creation and template setting.
    */
+  @Override
   public boolean matchPrefixPath(final String path) {
     return mayOverlapWithDevice(path);
   }
@@ -136,6 +156,7 @@ public class IoTDBPipePattern extends SinglePipePattern {
   /**
    * This is the precise form of the device overlap and is used only be device template transfer.
    */
+  @Override
   public boolean matchDevice(final String devicePath) {
     try {
       return patternPartialPath.overlapWith(new PartialPath(devicePath, "*"));
@@ -148,6 +169,7 @@ public class IoTDBPipePattern extends SinglePipePattern {
    * Return if the given tail node matches the pattern's tail node. Caller shall ensure that it is a
    * prefix or full path pattern.
    */
+  @Override
   public boolean matchTailNode(final String tailNode) {
     return !isFullPath() || patternPartialPath.getTailNode().equals(tailNode);
   }
@@ -156,6 +178,7 @@ public class IoTDBPipePattern extends SinglePipePattern {
    * Get the intersection of the given {@link PartialPath} and the {@link PipePattern}, Only used by
    * schema transmission. Caller shall ensure that it is a prefix or full path pattern.
    */
+  @Override
   public List<PartialPath> getIntersection(final PartialPath partialPath) {
     if (isFullPath()) {
       return partialPath.matchFullPath(patternPartialPath)
@@ -169,6 +192,7 @@ public class IoTDBPipePattern extends SinglePipePattern {
    * Get the intersection of the given {@link PathPatternTree} and the {@link PipePattern}. Only
    * used by schema transmission. Caller shall ensure that it is a prefix or full path pattern.
    */
+  @Override
   public PathPatternTree getIntersection(final PathPatternTree patternTree) {
     final PathPatternTree thisPatternTree = new PathPatternTree();
     thisPatternTree.appendPathPattern(patternPartialPath);
@@ -176,7 +200,17 @@ public class IoTDBPipePattern extends SinglePipePattern {
     return patternTree.intersectWithFullPathPrefixTree(thisPatternTree);
   }
 
-  public boolean isPrefix() {
+  @Override
+  public boolean isPrefixOrFullPath() {
+    return isPrefix() || isFullPath();
+  }
+
+  @Override
+  public boolean mayMatchMultipleTimeSeriesInOneDevice() {
+    return PathPatternUtil.hasWildcard(patternPartialPath.getTailNode());
+  }
+
+  private boolean isPrefix() {
     return PathPatternUtil.isMultiLevelMatchWildcard(patternPartialPath.getTailNode())
         && !new PartialPath(
                 Arrays.copyOfRange(
@@ -184,13 +218,11 @@ public class IoTDBPipePattern extends SinglePipePattern {
             .hasWildcard();
   }
 
-  public boolean isFullPath() {
+  private boolean isFullPath() {
     return !patternPartialPath.hasWildcard();
   }
 
-  public boolean mayMatchMultipleTimeSeriesInOneDevice() {
-    return PathPatternUtil.hasWildcard(patternPartialPath.getTailNode());
-  }
+  //////////////////////////// Getter ////////////////////////////
 
   public static void setDevicePathGetter(final DevicePathGetter devicePathGetter) {
     IoTDBPipePattern.devicePathGetter = devicePathGetter;
@@ -200,11 +232,6 @@ public class IoTDBPipePattern extends SinglePipePattern {
     IoTDBPipePattern.measurementPathGetter = measurementPathGetter;
   }
 
-  @Override
-  public String toString() {
-    return "IoTDBPipePattern" + super.toString();
-  }
-
   public interface DevicePathGetter {
     PartialPath apply(final String deviceId) throws IllegalPathException;
   }
@@ -212,4 +239,11 @@ public class IoTDBPipePattern extends SinglePipePattern {
   public interface MeasurementPathGetter {
     PartialPath apply(final String deviceId, final String measurement) throws IllegalPathException;
   }
+
+  //////////////////////////// Object ////////////////////////////
+
+  @Override
+  public String toString() {
+    return "IoTDBPipePattern{pattern='" + pattern + "'}";
+  }
 }
diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/IoTDBPipePatternOperations.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/IoTDBPipePatternOperations.java
new file mode 100644
index 00000000000..409e55175f6
--- /dev/null
+++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/IoTDBPipePatternOperations.java
@@ -0,0 +1,48 @@
+/*
+ * 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.iotdb.commons.pipe.datastructure.pattern;
+
+import org.apache.iotdb.commons.path.PartialPath;
+import org.apache.iotdb.commons.path.PathPatternTree;
+
+import java.util.List;
+
+/**
+ * An interface for TreePattern classes that support IoTDB-specific path matching operations, such
+ * as those used by schema-aware visitors.
+ */
+public abstract class IoTDBPipePatternOperations extends PipePattern {
+
+  //////////////////////////// IoTDB Pattern Operations ////////////////////////////
+
+  public abstract boolean matchPrefixPath(final String path);
+
+  public abstract boolean matchDevice(final String devicePath);
+
+  public abstract boolean matchTailNode(final String tailNode);
+
+  public abstract List<PartialPath> getIntersection(final PartialPath partialPath);
+
+  public abstract PathPatternTree getIntersection(final PathPatternTree patternTree);
+
+  public abstract boolean isPrefixOrFullPath();
+
+  public abstract boolean mayMatchMultipleTimeSeriesInOneDevice();
+}
diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/PipePattern.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/PipePattern.java
index ba78f87bbef..f060123e794 100644
--- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/PipePattern.java
+++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/PipePattern.java
@@ -19,7 +19,9 @@
 
 package org.apache.iotdb.commons.pipe.datastructure.pattern;
 
+import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.pipe.api.customizer.parameter.PipeParameters;
+import org.apache.iotdb.pipe.api.exception.PipeException;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -32,12 +34,16 @@ import java.util.Objects;
 import java.util.function.Function;
 import java.util.stream.Collectors;
 
+import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_PATH_EXCLUSION_KEY;
 import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_PATH_KEY;
+import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_PATTERN_EXCLUSION_KEY;
 import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_PATTERN_FORMAT_IOTDB_VALUE;
 import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_PATTERN_FORMAT_KEY;
 import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_PATTERN_FORMAT_PREFIX_VALUE;
 import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.EXTRACTOR_PATTERN_KEY;
+import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_PATH_EXCLUSION_KEY;
 import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_PATH_KEY;
+import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_PATTERN_EXCLUSION_KEY;
 import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_PATTERN_FORMAT_KEY;
 import static org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant.SOURCE_PATTERN_KEY;
 
@@ -45,6 +51,64 @@ public abstract class PipePattern {
 
   private static final Logger LOGGER = LoggerFactory.getLogger(PipePattern.class);
 
+  //////////////////////////// Interface ////////////////////////////
+
+  public abstract String getPattern();
+
+  public abstract boolean isRoot();
+
+  /** Check if this pattern is legal. Different pattern type may have different rules. */
+  public abstract boolean isLegal();
+
+  /** Check if this pattern matches all time-series under a database. */
+  public abstract boolean coversDb(final String db);
+
+  /** Check if a device's all measurements are covered by this pattern. */
+  public abstract boolean coversDevice(final String device);
+
+  /**
+   * Check if a database may have some measurements matched by the pattern.
+   *
+   * @return {@code true} if the pattern may overlap with the database, {@code false} otherwise.
+   */
+  public abstract boolean mayOverlapWithDb(final String db);
+
+  /**
+   * Check if a device may have some measurements matched by the pattern.
+   *
+   * <p>NOTE1: this is only called when {@link PipePattern#coversDevice} is false.
+   *
+   * <p>NOTE2: this is just a loose check and may have false positives. To further check if a
+   * measurement matches the pattern, please use {@link PipePattern#matchesMeasurement} after this.
+   */
+  public abstract boolean mayOverlapWithDevice(final String device);
+
+  /**
+   * Check if a full path with device and measurement can be matched by pattern.
+   *
+   * <p>NOTE: this is only called when {@link PipePattern#mayOverlapWithDevice(String)} is true.
+   */
+  public abstract boolean matchesMeasurement(final String device, final String measurement);
+
+  /**
+   * Get all 'base' PartialPath patterns that this pattern represents, for the purpose of checking
+   * pattern coverage.
+   *
+   * <p>For IoTDB patterns, it's their direct PartialPath.
+   *
+   * <p>For Prefix patterns (e.g., "root.d1"), it's approximated as a union of PartialPaths to model
+   * its string-based matching: "root.d1", "root.d1*", "root.d1.**", and "root.d1*.**".
+   *
+   * <p>For Union patterns, it's a list from all sub-patterns.
+   *
+   * <p>For Exclusion patterns, it's the *effective* set of paths.
+   *
+   * @return A list of PartialPaths representing the inclusion paths.
+   */
+  public abstract List<PartialPath> getBaseInclusionPaths();
+
+  //////////////////////////// Utilities ////////////////////////////
+
   public static <T> List<T> applyIndexesOnList(
       final int[] filteredIndexes, final List<T> originalList) {
     return Objects.nonNull(originalList)
@@ -53,15 +117,149 @@ public abstract class PipePattern {
   }
 
   /**
-   * Interpret from source parameters and get a {@link PipePattern}.
+   * Interpret from source parameters and get a {@link PipePattern}. This method parses both
+   * inclusion and exclusion patterns.
    *
    * @return The interpreted {@link PipePattern} which is not {@code null}.
    */
   public static PipePattern parsePipePatternFromSourceParameters(
       final PipeParameters sourceParameters) {
-    final String path = sourceParameters.getStringByKeys(EXTRACTOR_PATH_KEY, SOURCE_PATH_KEY);
-    final String pattern =
-        sourceParameters.getStringByKeys(EXTRACTOR_PATTERN_KEY, SOURCE_PATTERN_KEY);
+    // 1. Define the default inclusion pattern (matches all, "root.**")
+    // This is used if no inclusion patterns are specified.
+    final PipePattern defaultInclusionPattern =
+        buildUnionPattern(Collections.singletonList(new IoTDBPipePattern(null)));
+
+    // 2. Parse INCLUSION patterns using the helper
+    final PipePattern inclusionPattern =
+        parsePatternUnion(
+            sourceParameters,
+            // 'path' keys (IoTDB wildcard)
+            EXTRACTOR_PATH_KEY,
+            SOURCE_PATH_KEY,
+            // 'pattern' keys (Prefix or IoTDB via format)
+            EXTRACTOR_PATTERN_KEY,
+            SOURCE_PATTERN_KEY,
+            // Default pattern if no keys are found
+            defaultInclusionPattern);
+
+    // 3. Parse EXCLUSION patterns using the helper
+    final PipePattern exclusionPattern =
+        parsePatternUnion(
+            sourceParameters,
+            // 'path.exclusion' keys (IoTDB wildcard)
+            EXTRACTOR_PATH_EXCLUSION_KEY,
+            SOURCE_PATH_EXCLUSION_KEY,
+            // 'pattern.exclusion' keys (Prefix)
+            EXTRACTOR_PATTERN_EXCLUSION_KEY,
+            SOURCE_PATTERN_EXCLUSION_KEY,
+            // Default for exclusion is "match nothing" (null)
+            null);
+
+    // 4. Combine inclusion and exclusion
+    if (exclusionPattern == null) {
+      // No exclusion defined, return the inclusion pattern directly
+      return inclusionPattern;
+    } else {
+      // If both inclusion and exclusion patterns support IoTDB operations,
+      // use the specialized ExclusionIoTDBPipePattern
+      if (inclusionPattern instanceof IoTDBPipePatternOperations
+          && exclusionPattern instanceof IoTDBPipePatternOperations) {
+        return new WithExclusionIoTDBPipePattern(
+            (IoTDBPipePatternOperations) inclusionPattern,
+            (IoTDBPipePatternOperations) exclusionPattern);
+      }
+      // Both are defined, wrap them in an ExclusionPipePattern
+      return new WithExclusionPipePattern(inclusionPattern, exclusionPattern);
+    }
+  }
+
+  /**
+   * The main entry point for parsing a pattern string. This method can handle simple patterns
+   * ("root.a"), union patterns ("root.a,root.b"), and exclusion patterns ("INCLUSION(root.a),
+   * EXCLUSION(root.b)").
+   */
+  public static PipePattern parsePatternFromString(
+      final String patternString, final Function<String, PipePattern> basePatternSupplier) {
+    final String trimmedPattern = (patternString == null) ? "" : patternString.trim();
+    if (trimmedPattern.isEmpty()) {
+      return basePatternSupplier.apply("");
+    }
+
+    // 1. Check if it's an Exclusion pattern
+    if (trimmedPattern.startsWith("INCLUSION(") && trimmedPattern.endsWith(")")) {
+      // Find the closing parenthesis for "INCLUSION(...)"
+      final int inclusionEndIndex =
+          findMatchingParenthesis(trimmedPattern, "INCLUSION(".length() - 1);
+      if (inclusionEndIndex == -1) {
+        // Malformed, treat as a normal pattern
+        return buildUnionPattern(parseMultiplePatterns(trimmedPattern, basePatternSupplier));
+      }
+
+      // Look for the ", EXCLUSION(" part
+      final String remaining = trimmedPattern.substring(inclusionEndIndex + 1).trim();
+      if (!remaining.startsWith(", EXCLUSION(")) {
+        // Malformed, treat as a normal pattern
+        return buildUnionPattern(parseMultiplePatterns(trimmedPattern, basePatternSupplier));
+      }
+
+      try {
+        // Extract the string inside INCLUSION(...)
+        final String inclusionSubstring =
+            trimmedPattern.substring("INCLUSION(".length(), inclusionEndIndex);
+
+        // Extract the string inside EXCLUSION(...)
+        final String exclusionSubstring =
+            trimmedPattern.substring(
+                inclusionEndIndex + ", EXCLUSION(".length() + 1, trimmedPattern.length() - 1);
+
+        // 2. Parse recursively
+        final PipePattern inclusionPattern =
+            parsePatternFromString(inclusionSubstring, basePatternSupplier);
+        final PipePattern exclusionPattern =
+            parsePatternFromString(exclusionSubstring, basePatternSupplier);
+
+        // 3. Build ExclusionPipePattern
+        if (inclusionPattern instanceof IoTDBPipePatternOperations
+            && exclusionPattern instanceof IoTDBPipePatternOperations) {
+          return new WithExclusionIoTDBPipePattern(
+              (IoTDBPipePatternOperations) inclusionPattern,
+              (IoTDBPipePatternOperations) exclusionPattern);
+        }
+        return new WithExclusionPipePattern(inclusionPattern, exclusionPattern);
+      } catch (final Exception e) {
+        // Error during parsing (e.g., index out of bounds), treat as a normal pattern
+        return buildUnionPattern(parseMultiplePatterns(trimmedPattern, basePatternSupplier));
+      }
+    }
+
+    // 4. Not an Exclusion pattern, treat as a normal pattern
+    return buildUnionPattern(parseMultiplePatterns(trimmedPattern, basePatternSupplier));
+  }
+
+  /**
+   * A private helper method to parse a set of 'path' and 'pattern' keys into a single union
+   * PipePattern. This contains the original logic of parsePipePatternFromSourceParameters.
+   *
+   * @param sourceParameters The source parameters.
+   * @param extractorPathKey Key for extractor path (e.g., "extractor.path").
+   * @param sourcePathKey Key for source path (e.g., "source.path").
+   * @param extractorPatternKey Key for extractor pattern (e.g., "extractor.pattern").
+   * @param sourcePatternKey Key for source pattern (e.g., "source.pattern").
+   * @param defaultPattern The pattern to return if both path and pattern are null. If this
+   *     parameter is null, this method returns null.
+   * @return The parsed PipePattern, or defaultPattern, or null if defaultPattern is null and no
+   *     patterns are specified.
+   */
+  private static PipePattern parsePatternUnion(
+      final PipeParameters sourceParameters,
+      final String extractorPathKey,
+      final String sourcePathKey,
+      final String extractorPatternKey,
+      final String sourcePatternKey,
+      final PipePattern defaultPattern) {
+
+    final String path = sourceParameters.getStringByKeys(extractorPathKey, sourcePathKey);
+    final String pattern = sourceParameters.getStringByKeys(extractorPatternKey, sourcePatternKey);
 
     // 1. If both "source.path" and "source.pattern" are specified, their union will be used.
     if (path != null && pattern != null) {
@@ -84,8 +282,8 @@ public abstract class PipePattern {
     }
 
     // 4. If neither "source.path" nor "source.pattern" is specified,
-    // this pipe source will match all data.
-    return buildUnionPattern(Collections.singletonList(new IoTDBPipePattern(null)));
+    // return the provided default pattern (which may be null).
+    return defaultPattern;
   }
 
   /**
@@ -118,7 +316,7 @@ public abstract class PipePattern {
     }
   }
 
-  public static List<PipePattern> parseMultiplePatterns(
+  private static List<PipePattern> parseMultiplePatterns(
       final String pattern, final Function<String, PipePattern> patternSupplier) {
     if (pattern.isEmpty()) {
       return Collections.singletonList(patternSupplier.apply(pattern));
@@ -156,7 +354,7 @@ public abstract class PipePattern {
    * are IoTDBPipePattern, it returns an IoTDBUnionPipePattern. Otherwise, it returns a general
    * UnionPipePattern.
    */
-  public static PipePattern buildUnionPattern(final List<PipePattern> patterns) {
+  private static PipePattern buildUnionPattern(final List<PipePattern> patterns) {
     // Check if all instances in the list are of type IoTDBPipePattern
     boolean allIoTDB = true;
     for (final PipePattern p : patterns) {
@@ -178,42 +376,108 @@ public abstract class PipePattern {
     }
   }
 
-  public abstract boolean isSingle();
-
-  public abstract String getPattern();
-
-  public abstract boolean isRoot();
-
-  /** Check if this pattern is legal. Different pattern type may have different rules. */
-  public abstract boolean isLegal();
+  /** Helper method to find the matching closing parenthesis, respecting backticks. */
+  private static int findMatchingParenthesis(final String text, final int openParenIndex) {
+    int depth = 1;
+    boolean inBackticks = false;
 
-  /** Check if this pattern matches all time-series under a database. */
-  public abstract boolean coversDb(final String db);
+    for (int i = openParenIndex + 1; i < text.length(); i++) {
+      final char c = text.charAt(i);
 
-  /** Check if a device's all measurements are covered by this pattern. */
-  public abstract boolean coversDevice(final String device);
+      if (c == '`') {
+        inBackticks = !inBackticks;
+      } else if (c == '(' && !inBackticks) {
+        depth++;
+      } else if (c == ')' && !inBackticks) {
+        depth--;
+        if (depth == 0) {
+          return i; // Found the matching closing parenthesis
+        }
+      }
+    }
+    return -1; // Not found
+  }
 
   /**
-   * Check if a database may have some measurements matched by the pattern.
+   * Checks if the exclusion pattern fully or partially covers the inclusion pattern and logs a
+   * warning or throws an exception.
    *
-   * @return {@code true} if the pattern may overlap with the database, {@code false} otherwise.
-   */
-  public abstract boolean mayOverlapWithDb(final String db);
-
-  /**
-   * Check if a device may have some measurements matched by the pattern.
+   * <p>This check uses the 'base' inclusion paths from both patterns. It is intended to catch
+   * configuration errors where an exclusion rule negates all or part of an inclusion rule.
    *
-   * <p>NOTE1: this is only called when {@link PipePattern#coversDevice} is false.
+   * <p>If the exclusion pattern *fully* covers the inclusion pattern (and the inclusion pattern is
+   * not empty), this method will throw a {@link PipeException} to prevent the creation of a pipe
+   * that matches nothing.
    *
-   * <p>NOTE2: this is just a loose check and may have false positives. To further check if a
-   * measurement matches the pattern, please use {@link PipePattern#matchesMeasurement} after this.
-   */
-  public abstract boolean mayOverlapWithDevice(final String device);
-
-  /**
-   * Check if a full path with device and measurement can be matched by pattern.
+   * <p>If the exclusion pattern *partially* covers the inclusion pattern, a WARN log will be
+   * generated.
    *
-   * <p>NOTE: this is only called when {@link PipePattern#mayOverlapWithDevice(String)} is true.
+   * @param inclusion The inclusion pattern.
+   * @param exclusion The exclusion pattern.
+   * @return An int array `[coveredCount, totalInclusionPaths]` for testing non-failing scenarios.
+   * @throws PipeException If the inclusion pattern is fully covered by the exclusion pattern.
    */
-  public abstract boolean matchesMeasurement(final String device, final String measurement);
+  public static int[] checkAndLogPatternCoverage(
+      final PipePattern inclusion, final PipePattern exclusion) throws PipeException {
+    if (inclusion == null || exclusion == null) {
+      return new int[] {0, 0};
+    }
+
+    final List<PartialPath> inclusionPaths;
+    final List<PartialPath> exclusionPaths;
+    int coveredCount = 0;
+
+    try {
+      // Get the list of individual paths from both patterns
+      inclusionPaths = inclusion.getBaseInclusionPaths();
+      exclusionPaths = exclusion.getBaseInclusionPaths();
+
+      if (inclusionPaths.isEmpty() || exclusionPaths.isEmpty()) {
+        // Nothing to check
+        return new int[] {0, inclusionPaths.size()};
+      }
+
+      for (final PartialPath incPath : inclusionPaths) {
+        // Check if *any* exclusion path includes this inclusion path
+        final boolean isCovered =
+            exclusionPaths.stream().anyMatch(excPath -> excPath.include(incPath));
+        if (isCovered) {
+          coveredCount++;
+        }
+      }
+    } catch (final Exception e) {
+      // This check is best-effort. Do not fail construction.
+      LOGGER.warn(
+          "Pipe: Failed to perform pattern coverage check for inclusion [{}] and exclusion [{}].",
+          inclusion.getPattern(),
+          exclusion.getPattern(),
+          e);
+      // Return -1 to indicate failure in tests
+      return new int[] {-1, -1};
+    }
+
+    if (coveredCount == inclusionPaths.size() && !inclusionPaths.isEmpty()) {
+      // All inclusion paths are covered by the exclusion
+      final String msg =
+          String.format(
+              "Pipe: The provided exclusion pattern fully covers the inclusion pattern. "
+                  + "This pipe pattern will match nothing. "
+                  + "Inclusion: [%s], Exclusion: [%s]",
+              inclusion.getPattern(), exclusion.getPattern());
+      LOGGER.warn(msg);
+      throw new PipeException(msg);
+    } else if (coveredCount > 0) {
+      // Some inclusion paths are covered
+      LOGGER.warn(
+          "Pipe: The provided exclusion pattern covers {} out of {} inclusion paths. "
+              + "These paths will be excluded. "
+              + "Inclusion: [{}], Exclusion: [{}]",
+          coveredCount,
+          inclusionPaths.size(),
+          inclusion.getPattern(),
+          exclusion.getPattern());
+    }
+
+    return new int[] {coveredCount, inclusionPaths.size()};
+  }
 }
diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/PrefixPipePattern.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/PrefixPipePattern.java
index 758accf4ba5..8caa52cc424 100644
--- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/PrefixPipePattern.java
+++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/PrefixPipePattern.java
@@ -19,26 +19,43 @@
 
 package org.apache.iotdb.commons.pipe.datastructure.pattern;
 
+import org.apache.iotdb.commons.conf.IoTDBConstant;
 import org.apache.iotdb.commons.exception.IllegalPathException;
+import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.commons.pipe.config.constant.PipeSourceConstant;
 import org.apache.iotdb.commons.utils.PathUtils;
 
 import org.apache.commons.lang3.StringUtils;
 import org.apache.tsfile.common.constant.TsFileConstant;
 
+import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
 
-public class PrefixPipePattern extends SinglePipePattern {
+public class PrefixPipePattern extends PipePattern {
+
+  private final String pattern;
 
   public PrefixPipePattern(final String pattern) {
-    super(pattern);
+    this.pattern = pattern != null ? pattern : getDefaultPattern();
   }
 
-  @Override
-  public String getDefaultPattern() {
+  private String getDefaultPattern() {
     return PipeSourceConstant.EXTRACTOR_PATTERN_PREFIX_DEFAULT_VALUE;
   }
 
+  @Override
+  public String getPattern() {
+    return pattern;
+  }
+
+  @Override
+  public boolean isRoot() {
+    return Objects.isNull(pattern) || this.pattern.equals(this.getDefaultPattern());
+  }
+
   @Override
   public boolean isLegal() {
     if (!pattern.startsWith("root")) {
@@ -123,8 +140,46 @@ public class PrefixPipePattern extends SinglePipePattern {
         && dotAndMeasurement.startsWith(pattern.substring(device.length()));
   }
 
+  @Override
+  public List<PartialPath> getBaseInclusionPaths() {
+    if (isRoot()) {
+      return Collections.singletonList(new PartialPath(new String[] {"root", "**"}));
+    }
+
+    final List<PartialPath> paths = new ArrayList<>();
+    try {
+      // 1. "root.d1"
+      paths.add(new PartialPath(pattern));
+    } catch (final IllegalPathException ignored) {
+    }
+    try {
+      // 2. "root.d1*"
+      paths.add(new PartialPath(pattern + "*"));
+    } catch (final IllegalPathException ignored) {
+    }
+    try {
+      // 3. "root.d1.**"
+      paths.add(
+          new PartialPath(
+              pattern + TsFileConstant.PATH_SEPARATOR + IoTDBConstant.MULTI_LEVEL_PATH_WILDCARD));
+    } catch (final IllegalPathException ignored) {
+    }
+    try {
+      // 4. "root.d1*.**"
+      paths.add(
+          new PartialPath(
+              pattern
+                  + "*"
+                  + TsFileConstant.PATH_SEPARATOR
+                  + IoTDBConstant.MULTI_LEVEL_PATH_WILDCARD));
+    } catch (final IllegalPathException ignored) {
+    }
+
+    return paths;
+  }
+
   @Override
   public String toString() {
-    return "PrefixPipePattern" + super.toString();
+    return "PrefixPipePattern{pattern='" + pattern + "'}";
   }
 }
diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/SinglePipePattern.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/SinglePipePattern.java
deleted file mode 100644
index 352759f3699..00000000000
--- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/SinglePipePattern.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.iotdb.commons.pipe.datastructure.pattern;
-
-import java.util.Objects;
-
-public abstract class SinglePipePattern extends PipePattern {
-
-  protected final String pattern;
-
-  protected SinglePipePattern(final String pattern) {
-    this.pattern = pattern != null ? pattern : getDefaultPattern();
-  }
-
-  @Override
-  public boolean isSingle() {
-    return true;
-  }
-
-  @Override
-  public String getPattern() {
-    return pattern;
-  }
-
-  @Override
-  public boolean isRoot() {
-    return Objects.isNull(pattern) || this.pattern.equals(this.getDefaultPattern());
-  }
-
-  public abstract String getDefaultPattern();
-
-  @Override
-  public String toString() {
-    return "{pattern='" + pattern + '}';
-  }
-}
diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/UnionIoTDBPipePattern.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/UnionIoTDBPipePattern.java
index d2da4c99667..3445861d782 100644
--- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/UnionIoTDBPipePattern.java
+++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/UnionIoTDBPipePattern.java
@@ -33,7 +33,7 @@ import java.util.stream.Collectors;
  * Represents a union of multiple {@link IoTDBPipePattern}s. This specialized class ensures type
  * safety and provides access to methods specific to IoTDBPipePattern, such as getIntersection.
  */
-public class UnionIoTDBPipePattern extends PipePattern {
+public class UnionIoTDBPipePattern extends IoTDBPipePatternOperations {
 
   private final List<IoTDBPipePattern> patterns;
 
@@ -45,100 +45,109 @@ public class UnionIoTDBPipePattern extends PipePattern {
     this.patterns = Collections.singletonList(pattern);
   }
 
-  // **********************************************************************
-  // IoTDBPipePattern-specific aggregated methods
-  // **********************************************************************
+  //////////////////////////// Pipe Pattern Operations ////////////////////////////
 
-  public boolean matchPrefixPath(final String path) {
-    return patterns.stream().anyMatch(p -> p.matchPrefixPath(path));
+  @Override
+  public String getPattern() {
+    return patterns.stream().map(PipePattern::getPattern).collect(Collectors.joining(","));
   }
 
-  public boolean matchDevice(final String devicePath) {
-    return patterns.stream().anyMatch(p -> p.matchDevice(devicePath));
+  @Override
+  public boolean isRoot() {
+    return patterns.stream().anyMatch(PipePattern::isRoot);
   }
 
-  public boolean matchTailNode(final String tailNode) {
-    return patterns.stream().anyMatch(p -> p.matchTailNode(tailNode));
+  @Override
+  public boolean isLegal() {
+    return patterns.stream().allMatch(PipePattern::isLegal);
   }
 
-  public List<PartialPath> getIntersection(final PartialPath partialPath) {
-    final Set<PartialPath> uniqueIntersections = new LinkedHashSet<>();
-    for (final IoTDBPipePattern pattern : patterns) {
-      uniqueIntersections.addAll(pattern.getIntersection(partialPath));
-    }
-    return new ArrayList<>(uniqueIntersections);
+  @Override
+  public boolean coversDb(final String db) {
+    return patterns.stream().anyMatch(p -> p.coversDb(db));
   }
 
-  public PathPatternTree getIntersection(final PathPatternTree patternTree) {
-    final PathPatternTree resultTree = new PathPatternTree();
-    for (final IoTDBPipePattern pattern : patterns) {
-      final PathPatternTree intersection = pattern.getIntersection(patternTree);
-      if (intersection.isEmpty()) {
-        continue;
-      }
-      intersection.getAllPathPatterns().forEach(resultTree::appendPathPattern);
-    }
-    resultTree.constructTree();
-    return resultTree;
+  @Override
+  public boolean coversDevice(final String device) {
+    return patterns.stream().anyMatch(p -> p.coversDevice(device));
   }
 
-  public boolean isPrefixOrFullPath() {
-    return patterns.stream().allMatch(p -> p.isPrefix() || p.isFullPath());
+  @Override
+  public boolean mayOverlapWithDb(final String db) {
+    return patterns.stream().anyMatch(p -> p.mayOverlapWithDb(db));
   }
 
-  public boolean mayMatchMultipleTimeSeriesInOneDevice() {
-    return patterns.stream().anyMatch(IoTDBPipePattern::mayMatchMultipleTimeSeriesInOneDevice);
+  @Override
+  public boolean mayOverlapWithDevice(final String device) {
+    return patterns.stream().anyMatch(p -> p.mayOverlapWithDevice(device));
   }
 
-  // **********************************************************************
-  // Implementation of abstract methods from PipePattern
-  // **********************************************************************
-
   @Override
-  public boolean isSingle() {
-    return patterns.size() == 1;
+  public boolean matchesMeasurement(final String device, final String measurement) {
+    return patterns.stream().anyMatch(p -> p.matchesMeasurement(device, measurement));
   }
 
   @Override
-  public String getPattern() {
-    return patterns.stream().map(PipePattern::getPattern).collect(Collectors.joining(","));
+  public List<PartialPath> getBaseInclusionPaths() {
+    final List<PartialPath> paths = new ArrayList<>();
+    for (final PipePattern p : patterns) {
+      paths.addAll(p.getBaseInclusionPaths());
+    }
+    return paths;
   }
 
+  //////////////////////////// IoTDB Pipe Pattern Operations ////////////////////////////
+
   @Override
-  public boolean isRoot() {
-    return patterns.stream().anyMatch(PipePattern::isRoot);
+  public boolean matchPrefixPath(final String path) {
+    return patterns.stream().anyMatch(p -> p.matchPrefixPath(path));
   }
 
   @Override
-  public boolean isLegal() {
-    return patterns.stream().allMatch(PipePattern::isLegal);
+  public boolean matchDevice(final String devicePath) {
+    return patterns.stream().anyMatch(p -> p.matchDevice(devicePath));
   }
 
   @Override
-  public boolean coversDb(final String db) {
-    return patterns.stream().anyMatch(p -> p.coversDb(db));
+  public boolean matchTailNode(final String tailNode) {
+    return patterns.stream().anyMatch(p -> p.matchTailNode(tailNode));
   }
 
   @Override
-  public boolean coversDevice(final String device) {
-    return patterns.stream().anyMatch(p -> p.coversDevice(device));
+  public List<PartialPath> getIntersection(final PartialPath partialPath) {
+    final Set<PartialPath> uniqueIntersections = new LinkedHashSet<>();
+    for (final IoTDBPipePattern pattern : patterns) {
+      uniqueIntersections.addAll(pattern.getIntersection(partialPath));
+    }
+    return new ArrayList<>(uniqueIntersections);
   }
 
   @Override
-  public boolean mayOverlapWithDb(final String db) {
-    return patterns.stream().anyMatch(p -> p.mayOverlapWithDb(db));
+  public PathPatternTree getIntersection(final PathPatternTree patternTree) {
+    final PathPatternTree resultTree = new PathPatternTree();
+    for (final IoTDBPipePattern pattern : patterns) {
+      final PathPatternTree intersection = pattern.getIntersection(patternTree);
+      if (intersection.isEmpty()) {
+        continue;
+      }
+      intersection.getAllPathPatterns().forEach(resultTree::appendPathPattern);
+    }
+    resultTree.constructTree();
+    return resultTree;
   }
 
   @Override
-  public boolean mayOverlapWithDevice(final String device) {
-    return patterns.stream().anyMatch(p -> p.mayOverlapWithDevice(device));
+  public boolean isPrefixOrFullPath() {
+    return patterns.stream().allMatch(IoTDBPipePattern::isPrefixOrFullPath);
   }
 
   @Override
-  public boolean matchesMeasurement(final String device, final String measurement) {
-    return patterns.stream().anyMatch(p -> p.matchesMeasurement(device, measurement));
+  public boolean mayMatchMultipleTimeSeriesInOneDevice() {
+    return patterns.stream().anyMatch(IoTDBPipePattern::mayMatchMultipleTimeSeriesInOneDevice);
   }
 
+  //////////////////////////// Object ////////////////////////////
+
   @Override
   public String toString() {
     return "UnionIoTDBPipePattern{" + "patterns=" + patterns + '}';
diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/UnionPipePattern.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/UnionPipePattern.java
index 678ac4ff861..52a3d9fbe54 100644
--- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/UnionPipePattern.java
+++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/UnionPipePattern.java
@@ -19,6 +19,9 @@
 
 package org.apache.iotdb.commons.pipe.datastructure.pattern;
 
+import org.apache.iotdb.commons.path.PartialPath;
+
+import java.util.ArrayList;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -34,11 +37,6 @@ public class UnionPipePattern extends PipePattern {
     this.patterns = patterns;
   }
 
-  @Override
-  public boolean isSingle() {
-    return patterns.size() == 1;
-  }
-
   @Override
   public String getPattern() {
     return patterns.stream().map(PipePattern::getPattern).collect(Collectors.joining(","));
@@ -79,6 +77,15 @@ public class UnionPipePattern extends PipePattern {
     return patterns.stream().anyMatch(p -> p.matchesMeasurement(device, measurement));
   }
 
+  @Override
+  public List<PartialPath> getBaseInclusionPaths() {
+    final List<PartialPath> paths = new ArrayList<>();
+    for (final PipePattern p : patterns) {
+      paths.addAll(p.getBaseInclusionPaths());
+    }
+    return paths;
+  }
+
   @Override
   public String toString() {
     return "UnionPipePattern{" + "patterns=" + patterns + '}';
diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/WithExclusionIoTDBPipePattern.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/WithExclusionIoTDBPipePattern.java
new file mode 100644
index 00000000000..d45eb078015
--- /dev/null
+++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/WithExclusionIoTDBPipePattern.java
@@ -0,0 +1,201 @@
+/*
+ * 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.iotdb.commons.pipe.datastructure.pattern;
+
+import org.apache.iotdb.commons.path.PartialPath;
+import org.apache.iotdb.commons.path.PathPatternTree;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * Represents an exclusion pattern specifically for IoTDB-operation-aware patterns. It holds an
+ * inclusion and exclusion pattern, both implementing {@link IoTDBPipePatternOperations}.
+ *
+ * <p>The logic is: "Matches inclusion AND NOT exclusion" for all methods.
+ */
+public class WithExclusionIoTDBPipePattern extends IoTDBPipePatternOperations {
+
+  private final IoTDBPipePatternOperations inclusionPattern;
+  private final IoTDBPipePatternOperations exclusionPattern;
+
+  public WithExclusionIoTDBPipePattern(
+      final IoTDBPipePatternOperations inclusionPattern,
+      final IoTDBPipePatternOperations exclusionPattern) {
+    this.inclusionPattern = inclusionPattern;
+    this.exclusionPattern = exclusionPattern;
+
+    PipePattern.checkAndLogPatternCoverage(inclusionPattern, exclusionPattern);
+  }
+
+  //////////////////////////// Pipe Pattern Operations ////////////////////////////
+
+  @Override
+  public String getPattern() {
+    return "INCLUSION("
+        + inclusionPattern.getPattern()
+        + "), EXCLUSION("
+        + exclusionPattern.getPattern()
+        + ")";
+  }
+
+  @Override
+  public boolean isRoot() {
+    // Since the exclusion is not empty, the whole pattern is always not root because it may more or
+    // less filter some data.
+    return false;
+  }
+
+  @Override
+  public boolean isLegal() {
+    return inclusionPattern.isLegal() && exclusionPattern.isLegal();
+  }
+
+  @Override
+  public boolean coversDb(final String db) {
+    return inclusionPattern.coversDb(db) && !exclusionPattern.mayOverlapWithDb(db);
+  }
+
+  @Override
+  public boolean coversDevice(final String device) {
+    return inclusionPattern.coversDevice(device) && !exclusionPattern.mayOverlapWithDevice(device);
+  }
+
+  @Override
+  public boolean mayOverlapWithDb(final String db) {
+    return inclusionPattern.mayOverlapWithDb(db) && !exclusionPattern.coversDb(db);
+  }
+
+  @Override
+  public boolean mayOverlapWithDevice(final String device) {
+    return inclusionPattern.mayOverlapWithDevice(device) && !exclusionPattern.coversDevice(device);
+  }
+
+  @Override
+  public boolean matchesMeasurement(final String device, final String measurement) {
+    return inclusionPattern.matchesMeasurement(device, measurement)
+        && !exclusionPattern.matchesMeasurement(device, measurement);
+  }
+
+  @Override
+  public List<PartialPath> getBaseInclusionPaths() {
+    throw new UnsupportedOperationException();
+  }
+
+  //////////////////////////// IoTDB Pipe Pattern Operations ////////////////////////////
+
+  @Override
+  public boolean matchPrefixPath(final String path) {
+    return inclusionPattern.matchPrefixPath(path) && !exclusionPattern.matchPrefixPath(path);
+  }
+
+  @Override
+  public boolean matchDevice(final String devicePath) {
+    return inclusionPattern.matchDevice(devicePath) && !exclusionPattern.matchDevice(devicePath);
+  }
+
+  @Override
+  public boolean matchTailNode(final String tailNode) {
+    return inclusionPattern.matchTailNode(tailNode) && !exclusionPattern.matchTailNode(tailNode);
+  }
+
+  @Override
+  public List<PartialPath> getIntersection(final PartialPath partialPath) {
+    // 1. Calculate Intersection(Input, Inclusion)
+    final List<PartialPath> inclusionIntersections = inclusionPattern.getIntersection(partialPath);
+    if (inclusionIntersections.isEmpty()) {
+      return Collections.emptyList();
+    }
+
+    // 2. Calculate Intersection(Input, Exclusion)
+    final List<PartialPath> exclusionIntersections = exclusionPattern.getIntersection(partialPath);
+    if (exclusionIntersections.isEmpty()) {
+      // Optimization: No exclusion intersection, return inclusion intersection directly
+      return inclusionIntersections;
+    }
+
+    // 3. Perform the "Subtraction"
+    // Filter out paths from inclusionIntersections that are fully covered by any path
+    // in exclusionIntersections.
+    return inclusionIntersections.stream()
+        .filter(
+            incPath ->
+                exclusionIntersections.stream().noneMatch(excPath -> excPath.include(incPath)))
+        .collect(Collectors.toList());
+  }
+
+  @Override
+  public PathPatternTree getIntersection(final PathPatternTree patternTree) {
+    // 1. Calculate Intersection(Input, Inclusion)
+    final PathPatternTree inclusionIntersectionTree = inclusionPattern.getIntersection(patternTree);
+    if (inclusionIntersectionTree.isEmpty()) {
+      return inclusionIntersectionTree; // Return empty tree
+    }
+
+    // 2. Calculate Intersection(Input, Exclusion)
+    final PathPatternTree exclusionIntersectionTree = exclusionPattern.getIntersection(patternTree);
+    if (exclusionIntersectionTree.isEmpty()) {
+      // Optimization: No exclusion intersection, return inclusion intersection directly
+      return inclusionIntersectionTree;
+    }
+
+    // 3. Perform the "Subtraction"
+    final List<PartialPath> inclusionPaths = inclusionIntersectionTree.getAllPathPatterns();
+    final List<PartialPath> exclusionPaths = exclusionIntersectionTree.getAllPathPatterns();
+
+    final PathPatternTree finalResultTree = new PathPatternTree();
+    for (final PartialPath incPath : inclusionPaths) {
+      // Check if the current inclusion path is covered by *any* exclusion path pattern
+      boolean excluded = exclusionPaths.stream().anyMatch(excPath -> excPath.include(incPath));
+
+      if (!excluded) {
+        finalResultTree.appendPathPattern(incPath); // Add non-excluded path to the result tree
+      }
+    }
+
+    finalResultTree.constructTree();
+    return finalResultTree;
+  }
+
+  @Override
+  public boolean isPrefixOrFullPath() {
+    // Both must be prefix/full-path for the exclusion logic to be sound
+    return inclusionPattern.isPrefixOrFullPath() && exclusionPattern.isPrefixOrFullPath();
+  }
+
+  @Override
+  public boolean mayMatchMultipleTimeSeriesInOneDevice() {
+    // If inclusion might, the result might (even if exclusion trims it)
+    return inclusionPattern.mayMatchMultipleTimeSeriesInOneDevice();
+  }
+
+  //////////////////////////// Object ////////////////////////////
+
+  @Override
+  public String toString() {
+    return "ExclusionIoTDBPipePattern{"
+        + "inclusionPattern="
+        + inclusionPattern
+        + ", exclusionPattern="
+        + exclusionPattern
+        + '}';
+  }
+}
diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/WithExclusionPipePattern.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/WithExclusionPipePattern.java
new file mode 100644
index 00000000000..4a05c6f7de0
--- /dev/null
+++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/WithExclusionPipePattern.java
@@ -0,0 +1,112 @@
+/*
+ * 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.iotdb.commons.pipe.datastructure.pattern;
+
+import org.apache.iotdb.commons.path.PartialPath;
+
+import java.util.List;
+
+/**
+ * Represents a pattern that includes data matched by an inclusion pattern, except for data matched
+ * by an exclusion pattern.
+ *
+ * <p>The logic implemented in the methods is: "Matches the inclusion pattern AND NOT the exclusion
+ * pattern."
+ */
+public class WithExclusionPipePattern extends PipePattern {
+
+  private final PipePattern inclusionPattern;
+  private final PipePattern exclusionPattern;
+
+  public WithExclusionPipePattern(
+      final PipePattern inclusionPattern, final PipePattern exclusionPattern) {
+    this.inclusionPattern = inclusionPattern;
+    this.exclusionPattern = exclusionPattern;
+
+    PipePattern.checkAndLogPatternCoverage(inclusionPattern, exclusionPattern);
+  }
+
+  @Override
+  public String getPattern() {
+    return "INCLUSION("
+        + inclusionPattern.getPattern()
+        + "), EXCLUSION("
+        + exclusionPattern.getPattern()
+        + ")";
+  }
+
+  @Override
+  public boolean isRoot() {
+    // Since the exclusion is not empty, the whole pattern is always not root because it may more or
+    // less filter some data.
+    return false;
+  }
+
+  @Override
+  public boolean isLegal() {
+    return inclusionPattern.isLegal() && exclusionPattern.isLegal();
+  }
+
+  @Override
+  public boolean coversDb(final String db) {
+    // Covers DB if inclusion covers it AND exclusion doesn't overlap at all.
+    return inclusionPattern.coversDb(db) && !exclusionPattern.mayOverlapWithDb(db);
+  }
+
+  @Override
+  public boolean coversDevice(final String device) {
+    // Covers device if inclusion covers it AND exclusion doesn't overlap at all.
+    return inclusionPattern.coversDevice(device) && !exclusionPattern.mayOverlapWithDevice(device);
+  }
+
+  @Override
+  public boolean mayOverlapWithDb(final String db) {
+    // May overlap if inclusion overlaps AND exclusion doesn't fully cover it.
+    return inclusionPattern.mayOverlapWithDb(db) && !exclusionPattern.coversDb(db);
+  }
+
+  @Override
+  public boolean mayOverlapWithDevice(final String device) {
+    // May overlap if inclusion overlaps AND exclusion doesn't fully cover it.
+    return inclusionPattern.mayOverlapWithDevice(device) && !exclusionPattern.coversDevice(device);
+  }
+
+  @Override
+  public boolean matchesMeasurement(final String device, final String measurement) {
+    // The core logic: Must match inclusion AND NOT match exclusion.
+    return inclusionPattern.matchesMeasurement(device, measurement)
+        && !exclusionPattern.matchesMeasurement(device, measurement);
+  }
+
+  @Override
+  public List<PartialPath> getBaseInclusionPaths() {
+    throw new UnsupportedOperationException();
+  }
+
+  @Override
+  public String toString() {
+    return "ExclusionPipePattern{"
+        + "inclusionPattern="
+        + inclusionPattern
+        + ", exclusionPattern="
+        + exclusionPattern
+        + '}';
+  }
+}
diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/source/IoTDBNonDataRegionSource.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/source/IoTDBNonDataRegionSource.java
index 6a93321b8ca..e8fd5e54e36 100644
--- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/source/IoTDBNonDataRegionSource.java
+++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/source/IoTDBNonDataRegionSource.java
@@ -22,8 +22,8 @@ package org.apache.iotdb.commons.pipe.source;
 import org.apache.iotdb.commons.consensus.index.ProgressIndex;
 import org.apache.iotdb.commons.consensus.index.impl.MetaProgressIndex;
 import org.apache.iotdb.commons.consensus.index.impl.MinimumProgressIndex;
+import org.apache.iotdb.commons.pipe.datastructure.pattern.IoTDBPipePatternOperations;
 import org.apache.iotdb.commons.pipe.datastructure.pattern.PipePattern;
-import org.apache.iotdb.commons.pipe.datastructure.pattern.UnionIoTDBPipePattern;
 import org.apache.iotdb.commons.pipe.datastructure.queue.ConcurrentIterableLinkedQueue;
 import org.apache.iotdb.commons.pipe.datastructure.queue.listening.AbstractPipeListeningQueue;
 import org.apache.iotdb.commons.pipe.event.EnrichedEvent;
@@ -45,7 +45,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
 
 public abstract class IoTDBNonDataRegionSource extends IoTDBSource {
 
-  protected UnionIoTDBPipePattern pipePattern;
+  protected IoTDBPipePatternOperations pipePattern;
 
   private List<PipeSnapshotEvent> historicalEvents = new LinkedList<>();
   // A fixed size initialized only when the historicalEvents are first
@@ -68,14 +68,14 @@ public abstract class IoTDBNonDataRegionSource extends IoTDBSource {
     super.customize(parameters, configuration);
 
     final PipePattern pattern = PipePattern.parsePipePatternFromSourceParameters(parameters);
-    if (!(pattern instanceof UnionIoTDBPipePattern
-        && (((UnionIoTDBPipePattern) pattern).isPrefixOrFullPath()))) {
+    if (!(pattern instanceof IoTDBPipePatternOperations
+        && (((IoTDBPipePatternOperations) pattern).isPrefixOrFullPath()))) {
       throw new IllegalArgumentException(
           String.format(
               "The path pattern %s is not valid for the source. Only prefix or full path is allowed.",
               pattern.getPattern()));
     }
-    pipePattern = (UnionIoTDBPipePattern) pattern;
+    pipePattern = (IoTDBPipePatternOperations) pattern;
   }
 
   @Override