Caideyipi commented on code in PR #16632:
URL: https://github.com/apache/iotdb/pull/16632#discussion_r2502290526


##########
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/pattern/WithExclusionIoTDBTreePattern.java:
##########
@@ -0,0 +1,208 @@
+/*
+ * 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 org.apache.tsfile.file.metadata.IDeviceID;
+
+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 
IoTDBPatternOperations}.
+ *
+ * <p>The logic is: "Matches inclusion AND NOT exclusion" for all methods.
+ */
+public class ExclusionIoTDBTreePattern extends TreePattern implements 
IoTDBPatternOperations {
+
+  private final IoTDBPatternOperations inclusionPattern;
+  private final IoTDBPatternOperations exclusionPattern;
+
+  public ExclusionIoTDBTreePattern(
+      final boolean isTreeModelDataAllowedToBeCaptured,
+      final IoTDBPatternOperations inclusionPattern,
+      final IoTDBPatternOperations exclusionPattern) {
+    super(isTreeModelDataAllowedToBeCaptured);
+    this.inclusionPattern = inclusionPattern;
+    this.exclusionPattern = exclusionPattern;
+  }
+
+  public ExclusionIoTDBTreePattern(
+      final IoTDBPatternOperations inclusionPattern,
+      final IoTDBPatternOperations exclusionPattern) {
+    super(true);
+    this.inclusionPattern = inclusionPattern;
+    this.exclusionPattern = exclusionPattern;

Review Comment:
   Leave a warn log if some of the inclusions are covered by the exclusions but 
some are not, and it's better to clear the covered ones. The users may not know 
whether an inclusion is covered when the number is large, so it's may not be 
wise to refuse the creation, however we can handle it in our codes.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to