diff --git a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/basic/IoTDBTreePatternFormatIT.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/basic/IoTDBTreePatternFormatIT.java index 7a671a5ffdf8..b61a13693dc1 100644 --- a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/basic/IoTDBTreePatternFormatIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/basic/IoTDBTreePatternFormatIT.java @@ -31,6 +31,7 @@ import org.junit.Assert; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; @@ -270,6 +271,7 @@ private void testPipeWithMultiplePatterns( } @Test + @Ignore("Disabled: multi/exclusion tree patterns are blocked in this branch") public void testMultiplePrefixPatternHistoricalData() throws Exception { // Define source attributes final Map sourceAttributes = new HashMap<>(); @@ -300,6 +302,7 @@ public void testMultiplePrefixPatternHistoricalData() throws Exception { } @Test + @Ignore("Disabled: multi/exclusion tree patterns are blocked in this branch") public void testMultiplePrefixPatternRealtimeData() throws Exception { final Map sourceAttributes = new HashMap<>(); sourceAttributes.put("source.pattern", "root.db.d1.s, root.db2.d1.s"); @@ -326,6 +329,7 @@ public void testMultiplePrefixPatternRealtimeData() throws Exception { } @Test + @Ignore("Disabled: multi/exclusion tree patterns are blocked in this branch") public void testMultipleIoTDBPatternHistoricalData() throws Exception { final Map sourceAttributes = new HashMap<>(); sourceAttributes.put("source.path", "root.db.**, root.db2.d1.*"); @@ -354,6 +358,7 @@ public void testMultipleIoTDBPatternHistoricalData() throws Exception { } @Test + @Ignore("Disabled: multi/exclusion tree patterns are blocked in this branch") public void testMultipleIoTDBPatternRealtimeData() throws Exception { final Map sourceAttributes = new HashMap<>(); sourceAttributes.put("source.path", "root.db.**, root.db2.d1.*"); @@ -382,6 +387,7 @@ public void testMultipleIoTDBPatternRealtimeData() throws Exception { } @Test + @Ignore("Disabled: multi/exclusion tree patterns are blocked in this branch") public void testMultipleHybridPatternHistoricalData() throws Exception { final Map sourceAttributes = new HashMap<>(); sourceAttributes.put("source.path", "root.db.d1.*"); @@ -409,6 +415,7 @@ public void testMultipleHybridPatternHistoricalData() throws Exception { } @Test + @Ignore("Disabled: multi/exclusion tree patterns are blocked in this branch") public void testMultipleHybridPatternRealtimeData() throws Exception { final Map sourceAttributes = new HashMap<>(); sourceAttributes.put("source.path", "root.db.d1.*"); @@ -436,6 +443,7 @@ public void testMultipleHybridPatternRealtimeData() throws Exception { } @Test + @Ignore("Disabled: multi/exclusion tree patterns are blocked in this branch") public void testPrefixPatternWithExclusionHistoricalData() throws Exception { final Map sourceAttributes = new HashMap<>(); // Inclusion: Match everything under root.db.d1 and root.db.d2 @@ -467,6 +475,7 @@ public void testPrefixPatternWithExclusionHistoricalData() throws Exception { } @Test + @Ignore("Disabled: multi/exclusion tree patterns are blocked in this branch") public void testPrefixPatternWithExclusionRealtimeData() throws Exception { final Map sourceAttributes = new HashMap<>(); sourceAttributes.put("source.pattern", "root.db.d1, root.db.d2"); @@ -494,6 +503,7 @@ public void testPrefixPatternWithExclusionRealtimeData() throws Exception { } @Test + @Ignore("Disabled: multi/exclusion tree patterns are blocked in this branch") public void testIoTDBPatternWithExclusionHistoricalData() throws Exception { final Map sourceAttributes = new HashMap<>(); // Inclusion: Match everything under root.db @@ -527,6 +537,7 @@ public void testIoTDBPatternWithExclusionHistoricalData() throws Exception { } @Test + @Ignore("Disabled: multi/exclusion tree patterns are blocked in this branch") public void testIoTDBPatternWithExclusionRealtimeData() throws Exception { final Map sourceAttributes = new HashMap<>(); sourceAttributes.put("source.path", "root.db.**"); @@ -555,6 +566,7 @@ public void testIoTDBPatternWithExclusionRealtimeData() throws Exception { } @Test + @Ignore("Disabled: multi/exclusion tree patterns are blocked in this branch") public void testHybridPatternWithHybridExclusionHistoricalData() throws Exception { final Map sourceAttributes = new HashMap<>(); // Inclusion: Match root.db.** (IoTDB) AND root.db2.d1 (Prefix) @@ -590,6 +602,7 @@ public void testHybridPatternWithHybridExclusionHistoricalData() throws Exceptio } @Test + @Ignore("Disabled: multi/exclusion tree patterns are blocked in this branch") public void testHybridPatternWithHybridExclusionRealtimeData() throws Exception { final Map sourceAttributes = new HashMap<>(); sourceAttributes.put("source.path", "root.db.**"); diff --git a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/manual/IoTDBPipeInclusionIT.java b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/manual/IoTDBPipeInclusionIT.java index 95755a372f34..5bc4f4680621 100644 --- a/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/manual/IoTDBPipeInclusionIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/manual/IoTDBPipeInclusionIT.java @@ -29,6 +29,7 @@ import org.apache.iotdb.rpc.TSStatusCode; import org.junit.Assert; +import org.junit.Ignore; import org.junit.Test; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; @@ -113,6 +114,7 @@ public void testPureSchemaInclusion() throws Exception { } @Test + @Ignore("Disabled: multi/exclusion tree patterns are blocked in this branch") public void testPureSchemaInclusionWithMultiplePattern() throws Exception { final DataNodeWrapper receiverDataNode = receiverEnv.getDataNodeWrapper(0); @@ -185,6 +187,7 @@ public void testPureSchemaInclusionWithMultiplePattern() throws Exception { } @Test + @Ignore("Disabled: multi/exclusion tree patterns are blocked in this branch") public void testPureSchemaInclusionWithExclusionPattern() throws Exception { final DataNodeWrapper receiverDataNode = receiverEnv.getDataNodeWrapper(0); diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/pattern/TreePatternPruningTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/pattern/TreePatternPruningTest.java index 23b6c334b5cc..62868f0492e0 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/pattern/TreePatternPruningTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/pattern/TreePatternPruningTest.java @@ -28,10 +28,12 @@ import org.apache.iotdb.pipe.api.exception.PipeException; import org.junit.Assert; +import org.junit.Ignore; import org.junit.Test; import java.util.HashMap; +@Ignore("Disabled: multi/exclusion tree patterns are blocked in this branch") public class TreePatternPruningTest { @Test diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/source/IoTDBDataRegionSourceTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/source/IoTDBDataRegionSourceTest.java index fd1853fca1b7..feca8d54fed1 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/source/IoTDBDataRegionSourceTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/source/IoTDBDataRegionSourceTest.java @@ -25,6 +25,7 @@ import org.apache.iotdb.pipe.api.customizer.parameter.PipeParameters; import org.junit.Assert; +import org.junit.Ignore; import org.junit.Test; import java.util.HashMap; @@ -53,6 +54,7 @@ public void testIoTDBDataRegionExtractor() { } @Test + @Ignore("Disabled: multi/exclusion tree patterns are blocked in this branch") public void testIoTDBDataRegionExtractorWithPattern() { Assert.assertEquals( IllegalArgumentException.class, diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/IoTDBTreePattern.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/IoTDBTreePattern.java index 2becc993968c..8447f5b32583 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/IoTDBTreePattern.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/IoTDBTreePattern.java @@ -106,6 +106,11 @@ public boolean isRoot() { return Objects.isNull(pattern) || this.pattern.equals(this.getDefaultPattern()); } + @Override + public boolean isSingle() { + return true; + } + @Override public boolean isLegal() { if (!pattern.startsWith("root")) { diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/PrefixTreePattern.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/PrefixTreePattern.java index 73d50393fb69..19f7f815de25 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/PrefixTreePattern.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/PrefixTreePattern.java @@ -62,6 +62,11 @@ public boolean isRoot() { return Objects.isNull(pattern) || this.pattern.equals(this.getDefaultPattern()); } + @Override + public boolean isSingle() { + return true; + } + @Override public boolean isLegal() { if (!pattern.startsWith("root")) { diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/TreePattern.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/TreePattern.java index c35ba5c81fc5..9a9360a0abf1 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/TreePattern.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/TreePattern.java @@ -74,6 +74,8 @@ public boolean isTreeModelDataAllowedToBeCaptured() { public abstract boolean isRoot(); + public abstract boolean isSingle(); + /** Check if this pattern is legal. Different pattern type may have different rules. */ public abstract boolean isLegal(); @@ -141,6 +143,22 @@ public static List applyIndexesOnList( */ public static TreePattern parsePipePatternFromSourceParameters( final PipeParameters sourceParameters) { + final TreePattern treePattern = parsePipePatternFromSourceParametersInternal(sourceParameters); + if (!treePattern.isSingle()) { + final String msg = + String.format( + "Pipe: The provided pattern should be single now. " + "Inclusion: %s, Exclusion: %s", + sourceParameters.getStringByKeys(EXTRACTOR_PATTERN_KEY, SOURCE_PATTERN_KEY), + sourceParameters.getStringByKeys( + EXTRACTOR_PATTERN_EXCLUSION_KEY, SOURCE_PATTERN_EXCLUSION_KEY)); + LOGGER.warn(msg); + throw new PipeException(msg); + } + return treePattern; + } + + public static TreePattern parsePipePatternFromSourceParametersInternal( + final PipeParameters sourceParameters) { final boolean isTreeModelDataAllowedToBeCaptured = isTreeModelDataAllowToBeCaptured(sourceParameters); diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/UnionIoTDBTreePattern.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/UnionIoTDBTreePattern.java index 379232ad2534..f0c1a50c20a5 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/UnionIoTDBTreePattern.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/UnionIoTDBTreePattern.java @@ -73,6 +73,11 @@ public boolean isRoot() { return patterns.stream().anyMatch(TreePattern::isRoot); } + @Override + public boolean isSingle() { + return false; + } + @Override public boolean isLegal() { return patterns.stream().allMatch(TreePattern::isLegal); diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/UnionTreePattern.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/UnionTreePattern.java index 161dfc46f332..bf360c7c072f 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/UnionTreePattern.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/UnionTreePattern.java @@ -51,6 +51,11 @@ public boolean isRoot() { return patterns.stream().anyMatch(TreePattern::isRoot); } + @Override + public boolean isSingle() { + return false; + } + @Override public boolean isLegal() { return patterns.stream().allMatch(TreePattern::isLegal); diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/WithExclusionIoTDBTreePattern.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/WithExclusionIoTDBTreePattern.java index 677507603392..9fdbec4b2dad 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/WithExclusionIoTDBTreePattern.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/WithExclusionIoTDBTreePattern.java @@ -72,6 +72,11 @@ public boolean isRoot() { return false; } + @Override + public boolean isSingle() { + return false; + } + @Override public boolean isLegal() { return inclusionPattern.isLegal() && exclusionPattern.isLegal(); diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/WithExclusionTreePattern.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/WithExclusionTreePattern.java index eb255ed8392b..ea3114cebdb3 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/WithExclusionTreePattern.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/WithExclusionTreePattern.java @@ -62,6 +62,11 @@ public boolean isRoot() { return false; } + @Override + public boolean isSingle() { + return false; + } + @Override public boolean isLegal() { return inclusionPattern.isLegal() && exclusionPattern.isLegal();