You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2022/10/18 08:20:56 UTC

[GitHub] [iotdb] neuyilan commented on a diff in pull request #7636: [IOTDB-4647] Fix CSV import error when import header name with type

neuyilan commented on code in PR #7636:
URL: https://github.com/apache/iotdb/pull/7636#discussion_r997879184


##########
cli/src/main/java/org/apache/iotdb/tool/ImportCsv.java:
##########
@@ -587,11 +587,11 @@ private static void writeDataAlignedByDevice(
           AtomicReference<Boolean> isFail = new AtomicReference<>(false);
 
           // read data from record
-          for (String measurement : headerNameMap.values()) {
-            String value = record.get(measurement);
+          for (Map.Entry<String, String> headerName : headerNameMap.entrySet()) {
+            String value = record.get(headerName.getValue());

Review Comment:
   It's better to use two variables to indict the headerName.getValue() and headerName.getKey(), this would be more readble.
   
   eg:
   
   `Map.Entry<String, String> headerNameEntry : headerNameMap.entrySet()
   
   // headerNameWithoutType is equal to headerName if the CSV coloum do not have data type.
   String  headerNameWithoutType =  headerNameEntry.getKey();
   String  headerName =  headerNameEntry.getValue(); `
   



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