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

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


The following commit(s) were added to refs/heads/rel/0.12 by this push:
     new fc44347  [To rel/0.12][IoTDB-2185] get an exception when parsing the 
header of CSV (#4618)
fc44347 is described below

commit fc44347d1e9e00536f724e2d0cb880cbd1f7f25b
Author: Xuan Ronaldo <[email protected]>
AuthorDate: Tue Dec 28 09:49:10 2021 +0800

    [To rel/0.12][IoTDB-2185] get an exception when parsing the header of CSV 
(#4618)
---
 cli/src/main/java/org/apache/iotdb/tool/ImportCsv.java | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/cli/src/main/java/org/apache/iotdb/tool/ImportCsv.java 
b/cli/src/main/java/org/apache/iotdb/tool/ImportCsv.java
index c826c03..105a109 100644
--- a/cli/src/main/java/org/apache/iotdb/tool/ImportCsv.java
+++ b/cli/src/main/java/org/apache/iotdb/tool/ImportCsv.java
@@ -44,11 +44,7 @@ import java.io.IOException;
 import java.io.InputStreamReader;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -555,7 +551,7 @@ public class ImportCsv extends AbstractCsvTool {
       }
       String[] split = headerName.split("\\.");
       String measurementName = split[split.length - 1];
-      String deviceName = headerName.replace("." + measurementName, "");
+      String deviceName = StringUtils.join(Arrays.copyOfRange(split, 0, 
split.length - 1), '.');
       if (deviceAndMeasurementNames != null) {
         if (!deviceAndMeasurementNames.containsKey(deviceName)) {
           deviceAndMeasurementNames.put(deviceName, new ArrayList<>());
@@ -610,7 +606,6 @@ public class ImportCsv extends AbstractCsvTool {
       SimpleDateFormat format = new SimpleDateFormat(timeFormat);
       try {
         format.parse(time).getTime();
-        System.out.println(timeFormat);
         return format;
       } catch (java.text.ParseException ignored) {
         // do nothing

Reply via email to