This is an automated email from the ASF dual-hosted git repository.

haonan pushed a commit to branch import_iot_csv_file_new
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/import_iot_csv_file_new by 
this push:
     new 98818f6769a arg
98818f6769a is described below

commit 98818f6769acd142221682ad4d36814f978aa8ae
Author: HTHou <[email protected]>
AuthorDate: Thu May 9 11:41:58 2024 +0800

    arg
---
 example/session/pom.xml                            | 45 ++++++++++++++++++++++
 .../main/java/org/apache/iotdb/ImportCSVTool.java  | 32 +++++++--------
 2 files changed, 61 insertions(+), 16 deletions(-)

diff --git a/example/session/pom.xml b/example/session/pom.xml
index 83144603ad2..b10ff32b895 100644
--- a/example/session/pom.xml
+++ b/example/session/pom.xml
@@ -44,4 +44,49 @@
             <artifactId>commons-csv</artifactId>
         </dependency>
     </dependencies>
+    <profiles>
+        <profile>
+            <id>get-jar-with-dependencies</id>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-assembly-plugin</artifactId>
+                        <configuration>
+                            <descriptorRefs>
+                                
<descriptorRef>jar-with-dependencies</descriptorRef>
+                            </descriptorRefs>
+                            <archive>
+                                <manifest>
+                                    
<mainClass>org.apache.iotdb.ImportCSVTool</mainClass>
+                                </manifest>
+                            </archive>
+                        </configuration>
+                        <executions>
+                            <execution>
+                                <id>make-assembly</id>
+                                <!-- bind to the packaging phase -->
+                                <goals>
+                                    <goal>single</goal>
+                                </goals>
+                                <!-- this is used for inheritance merges -->
+                                <phase>package</phase>
+                            </execution>
+                        </executions>
+                    </plugin>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-jar-plugin</artifactId>
+                        <configuration>
+                            <archive>
+                                <manifest>
+                                    
<mainClass>org.apache.iotdb.ImportCSVTool</mainClass>
+                                </manifest>
+                            </archive>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
 </project>
diff --git a/example/session/src/main/java/org/apache/iotdb/ImportCSVTool.java 
b/example/session/src/main/java/org/apache/iotdb/ImportCSVTool.java
index e630d6d7032..fb92868ce9e 100644
--- a/example/session/src/main/java/org/apache/iotdb/ImportCSVTool.java
+++ b/example/session/src/main/java/org/apache/iotdb/ImportCSVTool.java
@@ -50,10 +50,10 @@ public class ImportCSVTool {
 
   public static void main(String[] args)
       throws IOException, IoTDBConnectionException, 
StatementExecutionException {
-    constructRedirectSessionPool();
+    constructRedirectSessionPool(args[0]);
 
-    sessionService = Executors.newFixedThreadPool(20);
-    loaderService = Executors.newFixedThreadPool(20);
+    sessionService = Executors.newFixedThreadPool(22);
+    loaderService = Executors.newFixedThreadPool(22);
 
     try {
       sessionPool.createDatabase("root.readings");
@@ -64,16 +64,18 @@ public class ImportCSVTool {
           "create schema template diagnostics aligned (fuel_state DOUBLE, 
current_load INT32, status INT32);");
       sessionPool.executeNonQueryStatement("set schema template readings to 
root.readings;");
       sessionPool.executeNonQueryStatement("set schema template diagnostics to 
root.diagnostics;");
+      System.out.println("Create schema finished.");
     } catch (Exception ignore) {
       // do nothing
     }
 
-    String folder = "/Volumes/ExtHD/ExtDocuments/csv";
-    if (args.length >= 1) {
-      folder = args[0];
+    String folder = "/data/tsbs/csvFile";
+    if (args.length >= 2) {
+      folder = args[1];
     }
     List<Future<?>> futures = new LinkedList<>();
     File folderFile = SystemFileFactory.INSTANCE.getFile(folder);
+    System.out.println("Start importing!");
     long startTime = System.currentTimeMillis();
     if (folderFile.isDirectory()) {
       File[] files =
@@ -99,7 +101,7 @@ public class ImportCSVTool {
       System.out.println(
           "Import "
               + folder
-              + " finished. Total cost: "
+              + " finished. Total cost in ms: "
               + (System.currentTimeMillis() - startTime));
     } else {
       if (folderFile.getName().contains("reading")) {
@@ -121,23 +123,21 @@ public class ImportCSVTool {
       System.out.println(
           "Import "
               + folder
-              + " finished. Total cost: "
+              + " finished. Total cost in ms: "
               + (System.currentTimeMillis() - startTime));
     }
     loaderService.shutdown();
     sessionService.shutdown();
   }
 
-  private static void constructRedirectSessionPool() {
-    List<String> nodeUrls = new ArrayList<>();
-    nodeUrls.add("127.0.0.1:6667");
-    //    nodeUrls.add("127.0.0.1:6668");
+  private static void constructRedirectSessionPool(String host) {
     sessionPool =
         new SessionPool.Builder()
-            .nodeUrls(nodeUrls)
+            .host(host)
+            .port(6667)
             .user("root")
             .password("root")
-            .maxSize(20)
+            .maxSize(22)
             .build();
   }
 
@@ -246,7 +246,7 @@ public class ImportCSVTool {
                     file.getName()
                         + " Progress: "
                         + currentProgress.get()
-                        + "% cost "
+                        + "% cost in ms"
                         + (System.currentTimeMillis() - startTime));
               }
             }
@@ -363,7 +363,7 @@ public class ImportCSVTool {
                     file.getName()
                         + " Progress: "
                         + currentProgress.get()
-                        + "% cost "
+                        + "% cost in ms"
                         + (System.currentTimeMillis() - startTime));
               }
             }

Reply via email to