Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<String, String> sourceAttributes = new HashMap<>();
Expand Down Expand Up @@ -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<String, String> sourceAttributes = new HashMap<>();
sourceAttributes.put("source.pattern", "root.db.d1.s, root.db2.d1.s");
Expand All @@ -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<String, String> sourceAttributes = new HashMap<>();
sourceAttributes.put("source.path", "root.db.**, root.db2.d1.*");
Expand Down Expand Up @@ -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<String, String> sourceAttributes = new HashMap<>();
sourceAttributes.put("source.path", "root.db.**, root.db2.d1.*");
Expand Down Expand Up @@ -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<String, String> sourceAttributes = new HashMap<>();
sourceAttributes.put("source.path", "root.db.d1.*");
Expand Down Expand Up @@ -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<String, String> sourceAttributes = new HashMap<>();
sourceAttributes.put("source.path", "root.db.d1.*");
Expand Down Expand Up @@ -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<String, String> sourceAttributes = new HashMap<>();
// Inclusion: Match everything under root.db.d1 and root.db.d2
Expand Down Expand Up @@ -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<String, String> sourceAttributes = new HashMap<>();
sourceAttributes.put("source.pattern", "root.db.d1, root.db.d2");
Expand Down Expand Up @@ -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<String, String> sourceAttributes = new HashMap<>();
// Inclusion: Match everything under root.db
Expand Down Expand Up @@ -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<String, String> sourceAttributes = new HashMap<>();
sourceAttributes.put("source.path", "root.db.**");
Expand Down Expand Up @@ -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<String, String> sourceAttributes = new HashMap<>();
// Inclusion: Match root.db.** (IoTDB) AND root.db2.d1 (Prefix)
Expand Down Expand Up @@ -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<String, String> sourceAttributes = new HashMap<>();
sourceAttributes.put("source.path", "root.db.**");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -141,6 +143,22 @@ public static <T> List<T> 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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ public boolean isRoot() {
return false;
}

@Override
public boolean isSingle() {
return false;
}

@Override
public boolean isLegal() {
return inclusionPattern.isLegal() && exclusionPattern.isLegal();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ public boolean isRoot() {
return false;
}

@Override
public boolean isSingle() {
return false;
}

@Override
public boolean isLegal() {
return inclusionPattern.isLegal() && exclusionPattern.isLegal();
Expand Down
Loading