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 2020/09/05 03:15:18 UTC
[GitHub] [incubator-iotdb] mychaow opened a new pull request #1692: fix some importcsv tool bug
mychaow opened a new pull request #1692:
URL: https://github.com/apache/incubator-iotdb/pull/1692
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-iotdb] mychaow commented on a change in pull request #1692: fix some importcsv tool bug
Posted by GitBox <gi...@apache.org>.
mychaow commented on a change in pull request #1692:
URL: https://github.com/apache/incubator-iotdb/pull/1692#discussion_r486835735
##########
File path: cross-tests/src/test/java/org/apache/iotdb/cross/tests/tools/importCsv/AbstractScript.java
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.cross.tests.tools.importCsv;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbstractScript {
+
+ protected void testOutput(ProcessBuilder builder, String[] output) throws IOException {
+ builder.redirectErrorStream(true);
+ Process p = builder.start();
+ BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String line;
+ List<String> outputList = new ArrayList<>();
+ while (true) {
+ line = r.readLine();
+ if (line == null) {
+ break;
+ } else {
+ outputList.add(line);
+ }
+ }
+ r.close();
+ p.destroy();
+
+ for (int i = 0; i < output.length; i++) {
+ System.out.println("output:" + output[i]);
+ System.out.println("outputList:" + outputList.get(i));
Review comment:
ok
##########
File path: cli/src/main/java/org/apache/iotdb/tool/ImportCsv.java
##########
@@ -378,7 +388,12 @@ private static String createOneSql(Map.Entry<String, ArrayList<Integer>> entry,
continue;
}
if (timeseriesToType.get(headInfo.get(colIndex.get(j))).equals(STRING_DATA_TYPE)) {
- sbd.append(", \'").append(data[colIndex.get(j) + 1]).append("\'");
+ if ((data[colIndex.get(j) + 1].startsWith("'") && data[colIndex.get(j) + 1].endsWith("'")) ||
Review comment:
ok
##########
File path: cross-tests/src/test/java/org/apache/iotdb/cross/tests/tools/importCsv/AbstractScript.java
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.cross.tests.tools.importCsv;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbstractScript {
+
+ protected void testOutput(ProcessBuilder builder, String[] output) throws IOException {
+ builder.redirectErrorStream(true);
+ Process p = builder.start();
+ BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String line;
+ List<String> outputList = new ArrayList<>();
+ while (true) {
+ line = r.readLine();
+ if (line == null) {
+ break;
+ } else {
+ outputList.add(line);
+ }
+ }
+ r.close();
+ p.destroy();
+
+ for (int i = 0; i < output.length; i++) {
+ System.out.println("output:" + output[i]);
+ System.out.println("outputList:" + outputList.get(i));
Review comment:
ok
##########
File path: cli/src/main/java/org/apache/iotdb/tool/ImportCsv.java
##########
@@ -378,7 +388,12 @@ private static String createOneSql(Map.Entry<String, ArrayList<Integer>> entry,
continue;
}
if (timeseriesToType.get(headInfo.get(colIndex.get(j))).equals(STRING_DATA_TYPE)) {
- sbd.append(", \'").append(data[colIndex.get(j) + 1]).append("\'");
+ if ((data[colIndex.get(j) + 1].startsWith("'") && data[colIndex.get(j) + 1].endsWith("'")) ||
Review comment:
ok
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-iotdb] qiaojialin commented on a change in pull request #1692: fix some importcsv tool bug
Posted by GitBox <gi...@apache.org>.
qiaojialin commented on a change in pull request #1692:
URL: https://github.com/apache/incubator-iotdb/pull/1692#discussion_r486807081
##########
File path: cli/src/main/java/org/apache/iotdb/tool/ImportCsv.java
##########
@@ -378,7 +388,12 @@ private static String createOneSql(Map.Entry<String, ArrayList<Integer>> entry,
continue;
}
if (timeseriesToType.get(headInfo.get(colIndex.get(j))).equals(STRING_DATA_TYPE)) {
- sbd.append(", \'").append(data[colIndex.get(j) + 1]).append("\'");
+ if ((data[colIndex.get(j) + 1].startsWith("'") && data[colIndex.get(j) + 1].endsWith("'")) ||
Review comment:
could you add some comment... give some example
##########
File path: cross-tests/src/test/java/org/apache/iotdb/cross/tests/tools/importCsv/AbstractScript.java
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.cross.tests.tools.importCsv;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbstractScript {
+
+ protected void testOutput(ProcessBuilder builder, String[] output) throws IOException {
+ builder.redirectErrorStream(true);
+ Process p = builder.start();
+ BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String line;
+ List<String> outputList = new ArrayList<>();
Review comment:
```suggestion
List<String> actualOutput = new ArrayList<>();
```
##########
File path: cross-tests/src/test/java/org/apache/iotdb/cross/tests/tools/importCsv/AbstractScript.java
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.cross.tests.tools.importCsv;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbstractScript {
+
+ protected void testOutput(ProcessBuilder builder, String[] output) throws IOException {
+ builder.redirectErrorStream(true);
+ Process p = builder.start();
+ BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String line;
+ List<String> outputList = new ArrayList<>();
+ while (true) {
+ line = r.readLine();
+ if (line == null) {
+ break;
+ } else {
+ outputList.add(line);
+ }
+ }
+ r.close();
+ p.destroy();
+
+ for (int i = 0; i < output.length; i++) {
+ System.out.println("output:" + output[i]);
+ System.out.println("outputList:" + outputList.get(i));
Review comment:
```suggestion
System.out.println("expect:" + output[i]);
System.out.println("actual:" + outputList.get(i));
```
Or remove the print
##########
File path: cli/src/main/java/org/apache/iotdb/tool/ImportCsv.java
##########
@@ -378,7 +388,12 @@ private static String createOneSql(Map.Entry<String, ArrayList<Integer>> entry,
continue;
}
if (timeseriesToType.get(headInfo.get(colIndex.get(j))).equals(STRING_DATA_TYPE)) {
- sbd.append(", \'").append(data[colIndex.get(j) + 1]).append("\'");
+ if ((data[colIndex.get(j) + 1].startsWith("'") && data[colIndex.get(j) + 1].endsWith("'")) ||
Review comment:
could you add some comment... give some example
##########
File path: cross-tests/src/test/java/org/apache/iotdb/cross/tests/tools/importCsv/AbstractScript.java
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.cross.tests.tools.importCsv;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbstractScript {
+
+ protected void testOutput(ProcessBuilder builder, String[] output) throws IOException {
+ builder.redirectErrorStream(true);
+ Process p = builder.start();
+ BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String line;
+ List<String> outputList = new ArrayList<>();
Review comment:
```suggestion
List<String> actualOutput = new ArrayList<>();
```
##########
File path: cross-tests/src/test/java/org/apache/iotdb/cross/tests/tools/importCsv/AbstractScript.java
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.cross.tests.tools.importCsv;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbstractScript {
+
+ protected void testOutput(ProcessBuilder builder, String[] output) throws IOException {
+ builder.redirectErrorStream(true);
+ Process p = builder.start();
+ BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String line;
+ List<String> outputList = new ArrayList<>();
+ while (true) {
+ line = r.readLine();
+ if (line == null) {
+ break;
+ } else {
+ outputList.add(line);
+ }
+ }
+ r.close();
+ p.destroy();
+
+ for (int i = 0; i < output.length; i++) {
+ System.out.println("output:" + output[i]);
+ System.out.println("outputList:" + outputList.get(i));
Review comment:
```suggestion
System.out.println("expect:" + output[i]);
System.out.println("actual:" + outputList.get(i));
```
Or remove the print
##########
File path: cli/src/main/java/org/apache/iotdb/tool/ImportCsv.java
##########
@@ -378,7 +388,12 @@ private static String createOneSql(Map.Entry<String, ArrayList<Integer>> entry,
continue;
}
if (timeseriesToType.get(headInfo.get(colIndex.get(j))).equals(STRING_DATA_TYPE)) {
- sbd.append(", \'").append(data[colIndex.get(j) + 1]).append("\'");
+ if ((data[colIndex.get(j) + 1].startsWith("'") && data[colIndex.get(j) + 1].endsWith("'")) ||
Review comment:
could you add some comment... give some example
##########
File path: cross-tests/src/test/java/org/apache/iotdb/cross/tests/tools/importCsv/AbstractScript.java
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.cross.tests.tools.importCsv;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbstractScript {
+
+ protected void testOutput(ProcessBuilder builder, String[] output) throws IOException {
+ builder.redirectErrorStream(true);
+ Process p = builder.start();
+ BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String line;
+ List<String> outputList = new ArrayList<>();
Review comment:
```suggestion
List<String> actualOutput = new ArrayList<>();
```
##########
File path: cross-tests/src/test/java/org/apache/iotdb/cross/tests/tools/importCsv/AbstractScript.java
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.cross.tests.tools.importCsv;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbstractScript {
+
+ protected void testOutput(ProcessBuilder builder, String[] output) throws IOException {
+ builder.redirectErrorStream(true);
+ Process p = builder.start();
+ BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String line;
+ List<String> outputList = new ArrayList<>();
+ while (true) {
+ line = r.readLine();
+ if (line == null) {
+ break;
+ } else {
+ outputList.add(line);
+ }
+ }
+ r.close();
+ p.destroy();
+
+ for (int i = 0; i < output.length; i++) {
+ System.out.println("output:" + output[i]);
+ System.out.println("outputList:" + outputList.get(i));
Review comment:
```suggestion
System.out.println("expect:" + output[i]);
System.out.println("actual:" + outputList.get(i));
```
Or remove the print
##########
File path: cli/src/main/java/org/apache/iotdb/tool/ImportCsv.java
##########
@@ -378,7 +388,12 @@ private static String createOneSql(Map.Entry<String, ArrayList<Integer>> entry,
continue;
}
if (timeseriesToType.get(headInfo.get(colIndex.get(j))).equals(STRING_DATA_TYPE)) {
- sbd.append(", \'").append(data[colIndex.get(j) + 1]).append("\'");
+ if ((data[colIndex.get(j) + 1].startsWith("'") && data[colIndex.get(j) + 1].endsWith("'")) ||
Review comment:
could you add some comment... give some example
##########
File path: cross-tests/src/test/java/org/apache/iotdb/cross/tests/tools/importCsv/AbstractScript.java
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.cross.tests.tools.importCsv;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbstractScript {
+
+ protected void testOutput(ProcessBuilder builder, String[] output) throws IOException {
+ builder.redirectErrorStream(true);
+ Process p = builder.start();
+ BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String line;
+ List<String> outputList = new ArrayList<>();
Review comment:
```suggestion
List<String> actualOutput = new ArrayList<>();
```
##########
File path: cross-tests/src/test/java/org/apache/iotdb/cross/tests/tools/importCsv/AbstractScript.java
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.cross.tests.tools.importCsv;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbstractScript {
+
+ protected void testOutput(ProcessBuilder builder, String[] output) throws IOException {
+ builder.redirectErrorStream(true);
+ Process p = builder.start();
+ BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String line;
+ List<String> outputList = new ArrayList<>();
+ while (true) {
+ line = r.readLine();
+ if (line == null) {
+ break;
+ } else {
+ outputList.add(line);
+ }
+ }
+ r.close();
+ p.destroy();
+
+ for (int i = 0; i < output.length; i++) {
+ System.out.println("output:" + output[i]);
+ System.out.println("outputList:" + outputList.get(i));
Review comment:
```suggestion
System.out.println("expect:" + output[i]);
System.out.println("actual:" + outputList.get(i));
```
Or remove the print
##########
File path: cli/src/main/java/org/apache/iotdb/tool/ImportCsv.java
##########
@@ -378,7 +388,12 @@ private static String createOneSql(Map.Entry<String, ArrayList<Integer>> entry,
continue;
}
if (timeseriesToType.get(headInfo.get(colIndex.get(j))).equals(STRING_DATA_TYPE)) {
- sbd.append(", \'").append(data[colIndex.get(j) + 1]).append("\'");
+ if ((data[colIndex.get(j) + 1].startsWith("'") && data[colIndex.get(j) + 1].endsWith("'")) ||
Review comment:
could you add some comment... give some example
##########
File path: cross-tests/src/test/java/org/apache/iotdb/cross/tests/tools/importCsv/AbstractScript.java
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.cross.tests.tools.importCsv;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbstractScript {
+
+ protected void testOutput(ProcessBuilder builder, String[] output) throws IOException {
+ builder.redirectErrorStream(true);
+ Process p = builder.start();
+ BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String line;
+ List<String> outputList = new ArrayList<>();
Review comment:
```suggestion
List<String> actualOutput = new ArrayList<>();
```
##########
File path: cross-tests/src/test/java/org/apache/iotdb/cross/tests/tools/importCsv/AbstractScript.java
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.cross.tests.tools.importCsv;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbstractScript {
+
+ protected void testOutput(ProcessBuilder builder, String[] output) throws IOException {
+ builder.redirectErrorStream(true);
+ Process p = builder.start();
+ BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String line;
+ List<String> outputList = new ArrayList<>();
+ while (true) {
+ line = r.readLine();
+ if (line == null) {
+ break;
+ } else {
+ outputList.add(line);
+ }
+ }
+ r.close();
+ p.destroy();
+
+ for (int i = 0; i < output.length; i++) {
+ System.out.println("output:" + output[i]);
+ System.out.println("outputList:" + outputList.get(i));
Review comment:
```suggestion
System.out.println("expect:" + output[i]);
System.out.println("actual:" + outputList.get(i));
```
Or remove the print
##########
File path: cli/src/main/java/org/apache/iotdb/tool/ImportCsv.java
##########
@@ -378,7 +388,12 @@ private static String createOneSql(Map.Entry<String, ArrayList<Integer>> entry,
continue;
}
if (timeseriesToType.get(headInfo.get(colIndex.get(j))).equals(STRING_DATA_TYPE)) {
- sbd.append(", \'").append(data[colIndex.get(j) + 1]).append("\'");
+ if ((data[colIndex.get(j) + 1].startsWith("'") && data[colIndex.get(j) + 1].endsWith("'")) ||
Review comment:
could you add some comment... give some example
##########
File path: cross-tests/src/test/java/org/apache/iotdb/cross/tests/tools/importCsv/AbstractScript.java
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.cross.tests.tools.importCsv;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbstractScript {
+
+ protected void testOutput(ProcessBuilder builder, String[] output) throws IOException {
+ builder.redirectErrorStream(true);
+ Process p = builder.start();
+ BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String line;
+ List<String> outputList = new ArrayList<>();
Review comment:
```suggestion
List<String> actualOutput = new ArrayList<>();
```
##########
File path: cross-tests/src/test/java/org/apache/iotdb/cross/tests/tools/importCsv/AbstractScript.java
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.cross.tests.tools.importCsv;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbstractScript {
+
+ protected void testOutput(ProcessBuilder builder, String[] output) throws IOException {
+ builder.redirectErrorStream(true);
+ Process p = builder.start();
+ BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String line;
+ List<String> outputList = new ArrayList<>();
+ while (true) {
+ line = r.readLine();
+ if (line == null) {
+ break;
+ } else {
+ outputList.add(line);
+ }
+ }
+ r.close();
+ p.destroy();
+
+ for (int i = 0; i < output.length; i++) {
+ System.out.println("output:" + output[i]);
+ System.out.println("outputList:" + outputList.get(i));
Review comment:
```suggestion
System.out.println("expect:" + output[i]);
System.out.println("actual:" + outputList.get(i));
```
Or remove the print
##########
File path: cli/src/main/java/org/apache/iotdb/tool/ImportCsv.java
##########
@@ -378,7 +388,12 @@ private static String createOneSql(Map.Entry<String, ArrayList<Integer>> entry,
continue;
}
if (timeseriesToType.get(headInfo.get(colIndex.get(j))).equals(STRING_DATA_TYPE)) {
- sbd.append(", \'").append(data[colIndex.get(j) + 1]).append("\'");
+ if ((data[colIndex.get(j) + 1].startsWith("'") && data[colIndex.get(j) + 1].endsWith("'")) ||
Review comment:
could you add some comment... give some example
##########
File path: cross-tests/src/test/java/org/apache/iotdb/cross/tests/tools/importCsv/AbstractScript.java
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.cross.tests.tools.importCsv;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbstractScript {
+
+ protected void testOutput(ProcessBuilder builder, String[] output) throws IOException {
+ builder.redirectErrorStream(true);
+ Process p = builder.start();
+ BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String line;
+ List<String> outputList = new ArrayList<>();
Review comment:
```suggestion
List<String> actualOutput = new ArrayList<>();
```
##########
File path: cross-tests/src/test/java/org/apache/iotdb/cross/tests/tools/importCsv/AbstractScript.java
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.cross.tests.tools.importCsv;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbstractScript {
+
+ protected void testOutput(ProcessBuilder builder, String[] output) throws IOException {
+ builder.redirectErrorStream(true);
+ Process p = builder.start();
+ BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String line;
+ List<String> outputList = new ArrayList<>();
+ while (true) {
+ line = r.readLine();
+ if (line == null) {
+ break;
+ } else {
+ outputList.add(line);
+ }
+ }
+ r.close();
+ p.destroy();
+
+ for (int i = 0; i < output.length; i++) {
+ System.out.println("output:" + output[i]);
+ System.out.println("outputList:" + outputList.get(i));
Review comment:
```suggestion
System.out.println("expect:" + output[i]);
System.out.println("actual:" + outputList.get(i));
```
Or remove the print
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-iotdb] mychaow commented on a change in pull request #1692: fix some importcsv tool bug
Posted by GitBox <gi...@apache.org>.
mychaow commented on a change in pull request #1692:
URL: https://github.com/apache/incubator-iotdb/pull/1692#discussion_r486835735
##########
File path: cross-tests/src/test/java/org/apache/iotdb/cross/tests/tools/importCsv/AbstractScript.java
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.cross.tests.tools.importCsv;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbstractScript {
+
+ protected void testOutput(ProcessBuilder builder, String[] output) throws IOException {
+ builder.redirectErrorStream(true);
+ Process p = builder.start();
+ BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String line;
+ List<String> outputList = new ArrayList<>();
+ while (true) {
+ line = r.readLine();
+ if (line == null) {
+ break;
+ } else {
+ outputList.add(line);
+ }
+ }
+ r.close();
+ p.destroy();
+
+ for (int i = 0; i < output.length; i++) {
+ System.out.println("output:" + output[i]);
+ System.out.println("outputList:" + outputList.get(i));
Review comment:
ok
##########
File path: cli/src/main/java/org/apache/iotdb/tool/ImportCsv.java
##########
@@ -378,7 +388,12 @@ private static String createOneSql(Map.Entry<String, ArrayList<Integer>> entry,
continue;
}
if (timeseriesToType.get(headInfo.get(colIndex.get(j))).equals(STRING_DATA_TYPE)) {
- sbd.append(", \'").append(data[colIndex.get(j) + 1]).append("\'");
+ if ((data[colIndex.get(j) + 1].startsWith("'") && data[colIndex.get(j) + 1].endsWith("'")) ||
Review comment:
ok
##########
File path: cross-tests/src/test/java/org/apache/iotdb/cross/tests/tools/importCsv/AbstractScript.java
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.cross.tests.tools.importCsv;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbstractScript {
+
+ protected void testOutput(ProcessBuilder builder, String[] output) throws IOException {
+ builder.redirectErrorStream(true);
+ Process p = builder.start();
+ BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String line;
+ List<String> outputList = new ArrayList<>();
+ while (true) {
+ line = r.readLine();
+ if (line == null) {
+ break;
+ } else {
+ outputList.add(line);
+ }
+ }
+ r.close();
+ p.destroy();
+
+ for (int i = 0; i < output.length; i++) {
+ System.out.println("output:" + output[i]);
+ System.out.println("outputList:" + outputList.get(i));
Review comment:
ok
##########
File path: cli/src/main/java/org/apache/iotdb/tool/ImportCsv.java
##########
@@ -378,7 +388,12 @@ private static String createOneSql(Map.Entry<String, ArrayList<Integer>> entry,
continue;
}
if (timeseriesToType.get(headInfo.get(colIndex.get(j))).equals(STRING_DATA_TYPE)) {
- sbd.append(", \'").append(data[colIndex.get(j) + 1]).append("\'");
+ if ((data[colIndex.get(j) + 1].startsWith("'") && data[colIndex.get(j) + 1].endsWith("'")) ||
Review comment:
ok
##########
File path: cross-tests/src/test/java/org/apache/iotdb/cross/tests/tools/importCsv/AbstractScript.java
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.cross.tests.tools.importCsv;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbstractScript {
+
+ protected void testOutput(ProcessBuilder builder, String[] output) throws IOException {
+ builder.redirectErrorStream(true);
+ Process p = builder.start();
+ BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String line;
+ List<String> outputList = new ArrayList<>();
+ while (true) {
+ line = r.readLine();
+ if (line == null) {
+ break;
+ } else {
+ outputList.add(line);
+ }
+ }
+ r.close();
+ p.destroy();
+
+ for (int i = 0; i < output.length; i++) {
+ System.out.println("output:" + output[i]);
+ System.out.println("outputList:" + outputList.get(i));
Review comment:
ok
##########
File path: cli/src/main/java/org/apache/iotdb/tool/ImportCsv.java
##########
@@ -378,7 +388,12 @@ private static String createOneSql(Map.Entry<String, ArrayList<Integer>> entry,
continue;
}
if (timeseriesToType.get(headInfo.get(colIndex.get(j))).equals(STRING_DATA_TYPE)) {
- sbd.append(", \'").append(data[colIndex.get(j) + 1]).append("\'");
+ if ((data[colIndex.get(j) + 1].startsWith("'") && data[colIndex.get(j) + 1].endsWith("'")) ||
Review comment:
ok
##########
File path: cross-tests/src/test/java/org/apache/iotdb/cross/tests/tools/importCsv/AbstractScript.java
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.cross.tests.tools.importCsv;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbstractScript {
+
+ protected void testOutput(ProcessBuilder builder, String[] output) throws IOException {
+ builder.redirectErrorStream(true);
+ Process p = builder.start();
+ BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String line;
+ List<String> outputList = new ArrayList<>();
+ while (true) {
+ line = r.readLine();
+ if (line == null) {
+ break;
+ } else {
+ outputList.add(line);
+ }
+ }
+ r.close();
+ p.destroy();
+
+ for (int i = 0; i < output.length; i++) {
+ System.out.println("output:" + output[i]);
+ System.out.println("outputList:" + outputList.get(i));
Review comment:
ok
##########
File path: cli/src/main/java/org/apache/iotdb/tool/ImportCsv.java
##########
@@ -378,7 +388,12 @@ private static String createOneSql(Map.Entry<String, ArrayList<Integer>> entry,
continue;
}
if (timeseriesToType.get(headInfo.get(colIndex.get(j))).equals(STRING_DATA_TYPE)) {
- sbd.append(", \'").append(data[colIndex.get(j) + 1]).append("\'");
+ if ((data[colIndex.get(j) + 1].startsWith("'") && data[colIndex.get(j) + 1].endsWith("'")) ||
Review comment:
ok
##########
File path: cross-tests/src/test/java/org/apache/iotdb/cross/tests/tools/importCsv/AbstractScript.java
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.cross.tests.tools.importCsv;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbstractScript {
+
+ protected void testOutput(ProcessBuilder builder, String[] output) throws IOException {
+ builder.redirectErrorStream(true);
+ Process p = builder.start();
+ BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String line;
+ List<String> outputList = new ArrayList<>();
+ while (true) {
+ line = r.readLine();
+ if (line == null) {
+ break;
+ } else {
+ outputList.add(line);
+ }
+ }
+ r.close();
+ p.destroy();
+
+ for (int i = 0; i < output.length; i++) {
+ System.out.println("output:" + output[i]);
+ System.out.println("outputList:" + outputList.get(i));
Review comment:
ok
##########
File path: cli/src/main/java/org/apache/iotdb/tool/ImportCsv.java
##########
@@ -378,7 +388,12 @@ private static String createOneSql(Map.Entry<String, ArrayList<Integer>> entry,
continue;
}
if (timeseriesToType.get(headInfo.get(colIndex.get(j))).equals(STRING_DATA_TYPE)) {
- sbd.append(", \'").append(data[colIndex.get(j) + 1]).append("\'");
+ if ((data[colIndex.get(j) + 1].startsWith("'") && data[colIndex.get(j) + 1].endsWith("'")) ||
Review comment:
ok
##########
File path: cross-tests/src/test/java/org/apache/iotdb/cross/tests/tools/importCsv/AbstractScript.java
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.cross.tests.tools.importCsv;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbstractScript {
+
+ protected void testOutput(ProcessBuilder builder, String[] output) throws IOException {
+ builder.redirectErrorStream(true);
+ Process p = builder.start();
+ BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String line;
+ List<String> outputList = new ArrayList<>();
+ while (true) {
+ line = r.readLine();
+ if (line == null) {
+ break;
+ } else {
+ outputList.add(line);
+ }
+ }
+ r.close();
+ p.destroy();
+
+ for (int i = 0; i < output.length; i++) {
+ System.out.println("output:" + output[i]);
+ System.out.println("outputList:" + outputList.get(i));
Review comment:
ok
##########
File path: cli/src/main/java/org/apache/iotdb/tool/ImportCsv.java
##########
@@ -378,7 +388,12 @@ private static String createOneSql(Map.Entry<String, ArrayList<Integer>> entry,
continue;
}
if (timeseriesToType.get(headInfo.get(colIndex.get(j))).equals(STRING_DATA_TYPE)) {
- sbd.append(", \'").append(data[colIndex.get(j) + 1]).append("\'");
+ if ((data[colIndex.get(j) + 1].startsWith("'") && data[colIndex.get(j) + 1].endsWith("'")) ||
Review comment:
ok
##########
File path: cross-tests/src/test/java/org/apache/iotdb/cross/tests/tools/importCsv/AbstractScript.java
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.cross.tests.tools.importCsv;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbstractScript {
+
+ protected void testOutput(ProcessBuilder builder, String[] output) throws IOException {
+ builder.redirectErrorStream(true);
+ Process p = builder.start();
+ BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String line;
+ List<String> outputList = new ArrayList<>();
+ while (true) {
+ line = r.readLine();
+ if (line == null) {
+ break;
+ } else {
+ outputList.add(line);
+ }
+ }
+ r.close();
+ p.destroy();
+
+ for (int i = 0; i < output.length; i++) {
+ System.out.println("output:" + output[i]);
+ System.out.println("outputList:" + outputList.get(i));
Review comment:
ok
##########
File path: cli/src/main/java/org/apache/iotdb/tool/ImportCsv.java
##########
@@ -378,7 +388,12 @@ private static String createOneSql(Map.Entry<String, ArrayList<Integer>> entry,
continue;
}
if (timeseriesToType.get(headInfo.get(colIndex.get(j))).equals(STRING_DATA_TYPE)) {
- sbd.append(", \'").append(data[colIndex.get(j) + 1]).append("\'");
+ if ((data[colIndex.get(j) + 1].startsWith("'") && data[colIndex.get(j) + 1].endsWith("'")) ||
Review comment:
ok
##########
File path: cross-tests/src/test/java/org/apache/iotdb/cross/tests/tools/importCsv/AbstractScript.java
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.cross.tests.tools.importCsv;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbstractScript {
+
+ protected void testOutput(ProcessBuilder builder, String[] output) throws IOException {
+ builder.redirectErrorStream(true);
+ Process p = builder.start();
+ BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String line;
+ List<String> outputList = new ArrayList<>();
+ while (true) {
+ line = r.readLine();
+ if (line == null) {
+ break;
+ } else {
+ outputList.add(line);
+ }
+ }
+ r.close();
+ p.destroy();
+
+ for (int i = 0; i < output.length; i++) {
+ System.out.println("output:" + output[i]);
+ System.out.println("outputList:" + outputList.get(i));
Review comment:
ok
##########
File path: cli/src/main/java/org/apache/iotdb/tool/ImportCsv.java
##########
@@ -378,7 +388,12 @@ private static String createOneSql(Map.Entry<String, ArrayList<Integer>> entry,
continue;
}
if (timeseriesToType.get(headInfo.get(colIndex.get(j))).equals(STRING_DATA_TYPE)) {
- sbd.append(", \'").append(data[colIndex.get(j) + 1]).append("\'");
+ if ((data[colIndex.get(j) + 1].startsWith("'") && data[colIndex.get(j) + 1].endsWith("'")) ||
Review comment:
ok
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-iotdb] mychaow commented on a change in pull request #1692: fix some importcsv tool bug
Posted by GitBox <gi...@apache.org>.
mychaow commented on a change in pull request #1692:
URL: https://github.com/apache/incubator-iotdb/pull/1692#discussion_r486835735
##########
File path: cross-tests/src/test/java/org/apache/iotdb/cross/tests/tools/importCsv/AbstractScript.java
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.cross.tests.tools.importCsv;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbstractScript {
+
+ protected void testOutput(ProcessBuilder builder, String[] output) throws IOException {
+ builder.redirectErrorStream(true);
+ Process p = builder.start();
+ BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String line;
+ List<String> outputList = new ArrayList<>();
+ while (true) {
+ line = r.readLine();
+ if (line == null) {
+ break;
+ } else {
+ outputList.add(line);
+ }
+ }
+ r.close();
+ p.destroy();
+
+ for (int i = 0; i < output.length; i++) {
+ System.out.println("output:" + output[i]);
+ System.out.println("outputList:" + outputList.get(i));
Review comment:
ok
##########
File path: cli/src/main/java/org/apache/iotdb/tool/ImportCsv.java
##########
@@ -378,7 +388,12 @@ private static String createOneSql(Map.Entry<String, ArrayList<Integer>> entry,
continue;
}
if (timeseriesToType.get(headInfo.get(colIndex.get(j))).equals(STRING_DATA_TYPE)) {
- sbd.append(", \'").append(data[colIndex.get(j) + 1]).append("\'");
+ if ((data[colIndex.get(j) + 1].startsWith("'") && data[colIndex.get(j) + 1].endsWith("'")) ||
Review comment:
ok
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-iotdb] qiaojialin commented on a change in pull request #1692: fix some importcsv tool bug
Posted by GitBox <gi...@apache.org>.
qiaojialin commented on a change in pull request #1692:
URL: https://github.com/apache/incubator-iotdb/pull/1692#discussion_r486807081
##########
File path: cli/src/main/java/org/apache/iotdb/tool/ImportCsv.java
##########
@@ -378,7 +388,12 @@ private static String createOneSql(Map.Entry<String, ArrayList<Integer>> entry,
continue;
}
if (timeseriesToType.get(headInfo.get(colIndex.get(j))).equals(STRING_DATA_TYPE)) {
- sbd.append(", \'").append(data[colIndex.get(j) + 1]).append("\'");
+ if ((data[colIndex.get(j) + 1].startsWith("'") && data[colIndex.get(j) + 1].endsWith("'")) ||
Review comment:
could you add some comment... give some example
##########
File path: cross-tests/src/test/java/org/apache/iotdb/cross/tests/tools/importCsv/AbstractScript.java
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.cross.tests.tools.importCsv;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbstractScript {
+
+ protected void testOutput(ProcessBuilder builder, String[] output) throws IOException {
+ builder.redirectErrorStream(true);
+ Process p = builder.start();
+ BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String line;
+ List<String> outputList = new ArrayList<>();
Review comment:
```suggestion
List<String> actualOutput = new ArrayList<>();
```
##########
File path: cross-tests/src/test/java/org/apache/iotdb/cross/tests/tools/importCsv/AbstractScript.java
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.cross.tests.tools.importCsv;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbstractScript {
+
+ protected void testOutput(ProcessBuilder builder, String[] output) throws IOException {
+ builder.redirectErrorStream(true);
+ Process p = builder.start();
+ BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String line;
+ List<String> outputList = new ArrayList<>();
+ while (true) {
+ line = r.readLine();
+ if (line == null) {
+ break;
+ } else {
+ outputList.add(line);
+ }
+ }
+ r.close();
+ p.destroy();
+
+ for (int i = 0; i < output.length; i++) {
+ System.out.println("output:" + output[i]);
+ System.out.println("outputList:" + outputList.get(i));
Review comment:
```suggestion
System.out.println("expect:" + output[i]);
System.out.println("actual:" + outputList.get(i));
```
Or remove the print
##########
File path: cli/src/main/java/org/apache/iotdb/tool/ImportCsv.java
##########
@@ -378,7 +388,12 @@ private static String createOneSql(Map.Entry<String, ArrayList<Integer>> entry,
continue;
}
if (timeseriesToType.get(headInfo.get(colIndex.get(j))).equals(STRING_DATA_TYPE)) {
- sbd.append(", \'").append(data[colIndex.get(j) + 1]).append("\'");
+ if ((data[colIndex.get(j) + 1].startsWith("'") && data[colIndex.get(j) + 1].endsWith("'")) ||
Review comment:
could you add some comment... give some example
##########
File path: cross-tests/src/test/java/org/apache/iotdb/cross/tests/tools/importCsv/AbstractScript.java
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.cross.tests.tools.importCsv;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbstractScript {
+
+ protected void testOutput(ProcessBuilder builder, String[] output) throws IOException {
+ builder.redirectErrorStream(true);
+ Process p = builder.start();
+ BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String line;
+ List<String> outputList = new ArrayList<>();
Review comment:
```suggestion
List<String> actualOutput = new ArrayList<>();
```
##########
File path: cross-tests/src/test/java/org/apache/iotdb/cross/tests/tools/importCsv/AbstractScript.java
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.cross.tests.tools.importCsv;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbstractScript {
+
+ protected void testOutput(ProcessBuilder builder, String[] output) throws IOException {
+ builder.redirectErrorStream(true);
+ Process p = builder.start();
+ BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String line;
+ List<String> outputList = new ArrayList<>();
+ while (true) {
+ line = r.readLine();
+ if (line == null) {
+ break;
+ } else {
+ outputList.add(line);
+ }
+ }
+ r.close();
+ p.destroy();
+
+ for (int i = 0; i < output.length; i++) {
+ System.out.println("output:" + output[i]);
+ System.out.println("outputList:" + outputList.get(i));
Review comment:
```suggestion
System.out.println("expect:" + output[i]);
System.out.println("actual:" + outputList.get(i));
```
Or remove the print
##########
File path: cli/src/main/java/org/apache/iotdb/tool/ImportCsv.java
##########
@@ -378,7 +388,12 @@ private static String createOneSql(Map.Entry<String, ArrayList<Integer>> entry,
continue;
}
if (timeseriesToType.get(headInfo.get(colIndex.get(j))).equals(STRING_DATA_TYPE)) {
- sbd.append(", \'").append(data[colIndex.get(j) + 1]).append("\'");
+ if ((data[colIndex.get(j) + 1].startsWith("'") && data[colIndex.get(j) + 1].endsWith("'")) ||
Review comment:
could you add some comment... give some example
##########
File path: cross-tests/src/test/java/org/apache/iotdb/cross/tests/tools/importCsv/AbstractScript.java
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.cross.tests.tools.importCsv;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbstractScript {
+
+ protected void testOutput(ProcessBuilder builder, String[] output) throws IOException {
+ builder.redirectErrorStream(true);
+ Process p = builder.start();
+ BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String line;
+ List<String> outputList = new ArrayList<>();
Review comment:
```suggestion
List<String> actualOutput = new ArrayList<>();
```
##########
File path: cross-tests/src/test/java/org/apache/iotdb/cross/tests/tools/importCsv/AbstractScript.java
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.cross.tests.tools.importCsv;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbstractScript {
+
+ protected void testOutput(ProcessBuilder builder, String[] output) throws IOException {
+ builder.redirectErrorStream(true);
+ Process p = builder.start();
+ BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String line;
+ List<String> outputList = new ArrayList<>();
+ while (true) {
+ line = r.readLine();
+ if (line == null) {
+ break;
+ } else {
+ outputList.add(line);
+ }
+ }
+ r.close();
+ p.destroy();
+
+ for (int i = 0; i < output.length; i++) {
+ System.out.println("output:" + output[i]);
+ System.out.println("outputList:" + outputList.get(i));
Review comment:
```suggestion
System.out.println("expect:" + output[i]);
System.out.println("actual:" + outputList.get(i));
```
Or remove the print
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-iotdb] mychaow commented on a change in pull request #1692: fix some importcsv tool bug
Posted by GitBox <gi...@apache.org>.
mychaow commented on a change in pull request #1692:
URL: https://github.com/apache/incubator-iotdb/pull/1692#discussion_r483930470
##########
File path: cli/src/main/java/org/apache/iotdb/tool/ImportCsv.java
##########
@@ -307,7 +307,7 @@ private static boolean queryDatabaseMeta(String[] strHeadInfo, File file, Buffer
ResultSet resultSet = statement.getResultSet();
try {
if (resultSet.next()) {
Review comment:
ok, I will add some description. Thank you for pointing this out.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-iotdb] qiaojialin commented on a change in pull request #1692: fix some importcsv tool bug
Posted by GitBox <gi...@apache.org>.
qiaojialin commented on a change in pull request #1692:
URL: https://github.com/apache/incubator-iotdb/pull/1692#discussion_r486807081
##########
File path: cli/src/main/java/org/apache/iotdb/tool/ImportCsv.java
##########
@@ -378,7 +388,12 @@ private static String createOneSql(Map.Entry<String, ArrayList<Integer>> entry,
continue;
}
if (timeseriesToType.get(headInfo.get(colIndex.get(j))).equals(STRING_DATA_TYPE)) {
- sbd.append(", \'").append(data[colIndex.get(j) + 1]).append("\'");
+ if ((data[colIndex.get(j) + 1].startsWith("'") && data[colIndex.get(j) + 1].endsWith("'")) ||
Review comment:
could you add some comment... give some example
##########
File path: cross-tests/src/test/java/org/apache/iotdb/cross/tests/tools/importCsv/AbstractScript.java
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.cross.tests.tools.importCsv;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbstractScript {
+
+ protected void testOutput(ProcessBuilder builder, String[] output) throws IOException {
+ builder.redirectErrorStream(true);
+ Process p = builder.start();
+ BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String line;
+ List<String> outputList = new ArrayList<>();
Review comment:
```suggestion
List<String> actualOutput = new ArrayList<>();
```
##########
File path: cross-tests/src/test/java/org/apache/iotdb/cross/tests/tools/importCsv/AbstractScript.java
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.cross.tests.tools.importCsv;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbstractScript {
+
+ protected void testOutput(ProcessBuilder builder, String[] output) throws IOException {
+ builder.redirectErrorStream(true);
+ Process p = builder.start();
+ BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String line;
+ List<String> outputList = new ArrayList<>();
+ while (true) {
+ line = r.readLine();
+ if (line == null) {
+ break;
+ } else {
+ outputList.add(line);
+ }
+ }
+ r.close();
+ p.destroy();
+
+ for (int i = 0; i < output.length; i++) {
+ System.out.println("output:" + output[i]);
+ System.out.println("outputList:" + outputList.get(i));
Review comment:
```suggestion
System.out.println("expect:" + output[i]);
System.out.println("actual:" + outputList.get(i));
```
Or remove the print
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-iotdb] qiaojialin merged pull request #1692: fix some importcsv tool bug
Posted by GitBox <gi...@apache.org>.
qiaojialin merged pull request #1692:
URL: https://github.com/apache/incubator-iotdb/pull/1692
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-iotdb] jixuan1989 commented on a change in pull request #1692: fix some importcsv tool bug
Posted by GitBox <gi...@apache.org>.
jixuan1989 commented on a change in pull request #1692:
URL: https://github.com/apache/incubator-iotdb/pull/1692#discussion_r483918304
##########
File path: cli/src/main/java/org/apache/iotdb/tool/ImportCsv.java
##########
@@ -307,7 +307,7 @@ private static boolean queryDatabaseMeta(String[] strHeadInfo, File file, Buffer
ResultSet resultSet = statement.getResultSet();
try {
if (resultSet.next()) {
Review comment:
can you add a comment to describe the structure of ResultSet?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org