You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by "l2280212 (via GitHub)" <gi...@apache.org> on 2023/10/17 08:25:03 UTC

[PR] add path check example [iotdb]

l2280212 opened a new pull request, #11336:
URL: https://github.com/apache/iotdb/pull/11336

   Add an example of path checking to help users verify the validity of schema data. This is particularly useful for users upgrading IoTDB from v0.1.3+ to v1.x.


-- 
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: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] add path check example [iotdb]

Posted by "CritasWang (via GitHub)" <gi...@apache.org>.
CritasWang commented on code in PR #11336:
URL: https://github.com/apache/iotdb/pull/11336#discussion_r1365029547


##########
example/schema/src/main/java/org/apache/iotdb/schema/PathCheckExample.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.schema;
+
+import org.apache.iotdb.tsfile.exception.PathParseException;
+import org.apache.iotdb.tsfile.read.common.parser.PathNodesGenerator;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+
+/**
+ * Before creating paths in IoTDB, it's essential to check whether the paths are correct to avoid
+ * errors.
+ *
+ * <p>This example checks the paths . You can add paths to the inputList or read paths from files
+ * generated by export-csv.sh/export-csv.bat.
+ *
+ * <p>The usage of export-csv.sh can be found in the <a
+ * href="https://iotdb.apache.org/zh/UserGuide/V1.2.x/Tools-System/Import-Export-Tool.html#csv%E5%AF%BC%E5%85%A5%E5%AF%BC%E5%87%BA%E5%B7%A5%E5%85%B7">documentation</a>.
+ * For example: ./export-csv.sh -h 127.0.0.1 -p 6667 -u root -pw root -td . -q "show timeseries"
+ */
+public class PathCheckExample {
+  private static final List<String> inputList = new ArrayList<>();
+  private static final String DIR = "/Users/root/iotdb/tools";
+
+  private static final Logger logger = LoggerFactory.getLogger(PathCheckExample.class);
+
+  // concurrent thread of path check
+  private static final int CONCURRENCY = 5;
+
+  public static void main(String[] args) {
+    inputTest();
+    inputDir();
+  }
+
+  private static void inputTest() {
+    inputList.add("root.test.d1.s1");
+    inputList.add("root.b+.d1.s2");
+    inputList.add("root.test.1.s3");
+    inputList.add("root.test.d-j.s4");
+    inputList.add("root.test.'8`7'.s5");
+    inputList.add("root.test.`1`.s6");
+    inputList.add("root.test.\"d+b\".s7");
+    for (String path : inputList) {
+      checkPath(path);
+    }
+  }
+
+  public static void inputDir() {

Review Comment:
   checkDir



##########
example/schema/src/main/java/org/apache/iotdb/schema/PathCheckExample.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.schema;
+
+import org.apache.iotdb.tsfile.exception.PathParseException;
+import org.apache.iotdb.tsfile.read.common.parser.PathNodesGenerator;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+
+/**
+ * Before creating paths in IoTDB, it's essential to check whether the paths are correct to avoid
+ * errors.
+ *
+ * <p>This example checks the paths . You can add paths to the inputList or read paths from files
+ * generated by export-csv.sh/export-csv.bat.
+ *
+ * <p>The usage of export-csv.sh can be found in the <a
+ * href="https://iotdb.apache.org/zh/UserGuide/V1.2.x/Tools-System/Import-Export-Tool.html#csv%E5%AF%BC%E5%85%A5%E5%AF%BC%E5%87%BA%E5%B7%A5%E5%85%B7">documentation</a>.
+ * For example: ./export-csv.sh -h 127.0.0.1 -p 6667 -u root -pw root -td . -q "show timeseries"
+ */
+public class PathCheckExample {
+  private static final List<String> inputList = new ArrayList<>();
+  private static final String DIR = "/Users/root/iotdb/tools";
+
+  private static final Logger logger = LoggerFactory.getLogger(PathCheckExample.class);
+
+  // concurrent thread of path check
+  private static final int CONCURRENCY = 5;
+
+  public static void main(String[] args) {
+    inputTest();
+    inputDir();
+  }
+
+  private static void inputTest() {

Review Comment:
   batchCheck



##########
example/schema/src/main/java/org/apache/iotdb/schema/PathCheckExample.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.schema;
+
+import org.apache.iotdb.tsfile.exception.PathParseException;
+import org.apache.iotdb.tsfile.read.common.parser.PathNodesGenerator;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+
+/**
+ * Before creating paths in IoTDB, it's essential to check whether the paths are correct to avoid
+ * errors.
+ *
+ * <p>This example checks the paths . You can add paths to the inputList or read paths from files
+ * generated by export-csv.sh/export-csv.bat.
+ *
+ * <p>The usage of export-csv.sh can be found in the <a
+ * href="https://iotdb.apache.org/zh/UserGuide/V1.2.x/Tools-System/Import-Export-Tool.html#csv%E5%AF%BC%E5%85%A5%E5%AF%BC%E5%87%BA%E5%B7%A5%E5%85%B7">documentation</a>.
+ * For example: ./export-csv.sh -h 127.0.0.1 -p 6667 -u root -pw root -td . -q "show timeseries"
+ */
+public class PathCheckExample {
+  private static final List<String> inputList = new ArrayList<>();
+  private static final String DIR = "/Users/root/iotdb/tools";
+
+  private static final Logger logger = LoggerFactory.getLogger(PathCheckExample.class);
+
+  // concurrent thread of path check
+  private static final int CONCURRENCY = 5;
+
+  public static void main(String[] args) {
+    inputTest();
+    inputDir();
+  }
+
+  private static void inputTest() {
+    inputList.add("root.test.d1.s1");
+    inputList.add("root.b+.d1.s2");
+    inputList.add("root.test.1.s3");
+    inputList.add("root.test.d-j.s4");
+    inputList.add("root.test.'8`7'.s5");
+    inputList.add("root.test.`1`.s6");
+    inputList.add("root.test.\"d+b\".s7");
+    for (String path : inputList) {
+      checkPath(path);
+    }
+  }
+

Review Comment:
   add some notes



-- 
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: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] add path check example [iotdb]

Posted by "CritasWang (via GitHub)" <gi...@apache.org>.
CritasWang commented on PR #11336:
URL: https://github.com/apache/iotdb/pull/11336#issuecomment-1765932606

   LGTM


-- 
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: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] add path check example [iotdb]

Posted by "HTHou (via GitHub)" <gi...@apache.org>.
HTHou merged PR #11336:
URL: https://github.com/apache/iotdb/pull/11336


-- 
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: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org