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


##########
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/agent/task/meta/PipeMeta.java:
##########
@@ -61,6 +65,49 @@ public PipeTemporaryMeta getTemporaryMeta() {
     return temporaryMeta;
   }
 
+  public boolean matchSqlDialect(final boolean isTableModel) {
+    return matchSqlDialect(SystemConstant.fetchSqlDialectValue(isTableModel));
+  }
+
+  public boolean matchSqlDialect(final String sqlDialect) {
+    if (Objects.isNull(sqlDialect)) {
+      return true;
+    }
+    return matchBoth()
+        || sqlDialect.equalsIgnoreCase(
+            getStaticMeta()
+                .getExtractorParameters()
+                .getStringOrDefault(
+                    SystemConstant.SQL_DIALECT_KEY, 
SystemConstant.SQL_DIALECT_TREE_VALUE));
+  }
+
+  private boolean matchBoth() {
+    return // 1. 'mode.double-living' is set to true
+    getStaticMeta()
+            .getExtractorParameters()
+            .getBooleanOrDefault(
+                Arrays.asList(
+                    PipeExtractorConstant.EXTRACTOR_MODE_DOUBLE_LIVING_KEY,
+                    PipeExtractorConstant.SOURCE_MODE_DOUBLE_LIVING_KEY),
+                
PipeExtractorConstant.EXTRACTOR_MODE_DOUBLE_LIVING_DEFAULT_VALUE)
+        ||
+        // 2. 'capture.tree' and 'capture.table' is set to true
+        (getStaticMeta()
+                .getExtractorParameters()
+                .getBooleanOrDefault(
+                    Arrays.asList(
+                        PipeExtractorConstant.EXTRACTOR_CAPTURE_TREE_KEY,

Review Comment:
   What if capture.tree == true and sql-dialect == table? Now a pipe will be 
shown in the tree model if "capture.tree" and "capture.table" is true, but 
sql-dialect is "table"; will not in this case if "capture.table" is false...



##########
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/config/constant/SystemConstant.java:
##########
@@ -52,6 +52,12 @@ public static PipeParameters addSystemKeysIfNecessary(final 
PipeParameters given
     return new PipeParameters(attributes);
   }
 
+  public static String fetchSqlDialectValue(final boolean isTableModel) {

Review Comment:
   May use "get"? "Fetch" are now widely used as "Retrieve data from remote"...



##########
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/agent/task/meta/PipeMeta.java:
##########
@@ -61,6 +65,49 @@ public PipeTemporaryMeta getTemporaryMeta() {
     return temporaryMeta;
   }
 
+  public boolean matchSqlDialect(final boolean isTableModel) {
+    return matchSqlDialect(SystemConstant.fetchSqlDialectValue(isTableModel));
+  }
+
+  public boolean matchSqlDialect(final String sqlDialect) {
+    if (Objects.isNull(sqlDialect)) {
+      return true;
+    }
+    return matchBoth()
+        || sqlDialect.equalsIgnoreCase(
+            getStaticMeta()
+                .getExtractorParameters()
+                .getStringOrDefault(
+                    SystemConstant.SQL_DIALECT_KEY, 
SystemConstant.SQL_DIALECT_TREE_VALUE));
+  }
+
+  private boolean matchBoth() {
+    return // 1. 'mode.double-living' is set to true
+    getStaticMeta()
+            .getExtractorParameters()
+            .getBooleanOrDefault(
+                Arrays.asList(
+                    PipeExtractorConstant.EXTRACTOR_MODE_DOUBLE_LIVING_KEY,
+                    PipeExtractorConstant.SOURCE_MODE_DOUBLE_LIVING_KEY),
+                
PipeExtractorConstant.EXTRACTOR_MODE_DOUBLE_LIVING_DEFAULT_VALUE)
+        ||
+        // 2. 'capture.tree' and 'capture.table' is set to true

Review Comment:
   are set to true



##########
iotdb-api/pipe-api/src/main/java/org/apache/iotdb/pipe/api/customizer/parameter/PipeParameters.java:
##########
@@ -75,6 +75,10 @@ public void addAttribute(final String key, String values) {
     attributes.put(KeyReducer.reduce(key), values);
   }
 
+  public void addRawAttribute(final String key, String values) {

Review Comment:
   Is this method used?



-- 
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