This is an automated email from the ASF dual-hosted git repository. jiangtian pushed a commit to branch add_metaquery_python in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git
commit 347d13e11b93d629a659e8a2e0583574523f6b85 Author: jt2594838 <[email protected]> AuthorDate: Thu Dec 19 12:22:21 2019 +0800 Merge branch 'master' of github.com:apache/incubator-iotdb --- .travis.yml | 4 ++-- .../main/java/org/apache/iotdb/tool/ExportCsv.java | 18 ++++++++++++++++-- .../org/apache/iotdb/db/tools/IoTDBDataDirViewer.java | 19 +++++++++++++++++++ .../db/writelog/recover/SeqTsFileRecoverTest.java | 2 +- .../db/writelog/recover/UnseqTsFileRecoverTest.java | 2 +- 5 files changed, 39 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 66df7c3..24e0686 100644 --- a/.travis.yml +++ b/.travis.yml @@ -79,8 +79,8 @@ matrix: # - choco install jdk11 -params 'installdir=c:\\java11' # - export PATH=$PATH:"/c/java11/bin" # - export JAVA_HOME="/c/java11" - # - wget -q https://www-eu.apache.org/dist/maven/maven-3/3.6.2/binaries/apache-maven-3.6.2-bin.zip - # - /C/Progra~1/7-Zip/7z.exe x apache-maven-3.6.2-bin.zip -o/c/mvn363 + # - wget -q https://www-eu.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.zip + # - /C/Progra~1/7-Zip/7z.exe x apache-maven-3.6.3-bin.zip -o/c/mvn363 # - export "MAVEN_HOME=/c/mvn363/apache-maven-3.6.3" # - export "M2_HOME=/c/mvn363/apache-maven-3.6.3" # - export "PATH=$MAVEN_HOME/bin:$PATH" diff --git a/client/src/main/java/org/apache/iotdb/tool/ExportCsv.java b/client/src/main/java/org/apache/iotdb/tool/ExportCsv.java index 1a96130..eda7f37 100644 --- a/client/src/main/java/org/apache/iotdb/tool/ExportCsv.java +++ b/client/src/main/java/org/apache/iotdb/tool/ExportCsv.java @@ -30,9 +30,12 @@ import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.Statement; +import java.sql.Types; import java.time.Instant; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.List; import jline.console.ConsoleReader; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLineParser; @@ -74,6 +77,8 @@ public class ExportCsv extends AbstractCsvTool { private static String TIMESTAMP_PRECISION = "ms"; + private static List<Integer> typeList = new ArrayList<>(); + /** * main function of export csv tool. */ @@ -290,6 +295,7 @@ public class ExportCsv extends AbstractCsvTool { } else { bw.write(metadata.getColumnLabel(i) + "\n"); } + typeList.add(metadata.getColumnType(i)); } } @@ -346,13 +352,21 @@ public class ExportCsv extends AbstractCsvTool { if ("null".equals(rs.getString(j))) { bw.write(","); } else { - bw.write(rs.getString(j) + ","); + if(typeList.get(j-1) == Types.VARCHAR) { + bw.write("\'" + rs.getString(j) + "\'"+ ","); + } else { + bw.write(rs.getString(j) + ","); + } } } else { if ("null".equals(rs.getString(j))) { bw.write("\n"); } else { - bw.write(rs.getString(j) + "\n"); + if(typeList.get(j-1) == Types.VARCHAR) { + bw.write("\'" + rs.getString(j) + "\'"+ "\n"); + } else { + bw.write(rs.getString(j) + "\n"); + } } } } diff --git a/server/src/main/java/org/apache/iotdb/db/tools/IoTDBDataDirViewer.java b/server/src/main/java/org/apache/iotdb/db/tools/IoTDBDataDirViewer.java index 243bddf..780603f 100644 --- a/server/src/main/java/org/apache/iotdb/db/tools/IoTDBDataDirViewer.java +++ b/server/src/main/java/org/apache/iotdb/db/tools/IoTDBDataDirViewer.java @@ -1,3 +1,22 @@ +/* + * 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.db.tools; import java.io.File; diff --git a/server/src/test/java/org/apache/iotdb/db/writelog/recover/SeqTsFileRecoverTest.java b/server/src/test/java/org/apache/iotdb/db/writelog/recover/SeqTsFileRecoverTest.java index d513c83..11a7d11 100644 --- a/server/src/test/java/org/apache/iotdb/db/writelog/recover/SeqTsFileRecoverTest.java +++ b/server/src/test/java/org/apache/iotdb/db/writelog/recover/SeqTsFileRecoverTest.java @@ -78,7 +78,7 @@ public class SeqTsFileRecoverTest { @Before public void setup() throws IOException, WriteProcessException { - tsF = SystemFileFactory.INSTANCE.getFile("temp", "test.ts"); + tsF = SystemFileFactory.INSTANCE.getFile(logNodePrefix, "test.ts"); tsF.getParentFile().mkdirs(); schema = new Schema(); diff --git a/server/src/test/java/org/apache/iotdb/db/writelog/recover/UnseqTsFileRecoverTest.java b/server/src/test/java/org/apache/iotdb/db/writelog/recover/UnseqTsFileRecoverTest.java index 15bd301..70da8a2 100644 --- a/server/src/test/java/org/apache/iotdb/db/writelog/recover/UnseqTsFileRecoverTest.java +++ b/server/src/test/java/org/apache/iotdb/db/writelog/recover/UnseqTsFileRecoverTest.java @@ -82,7 +82,7 @@ public class UnseqTsFileRecoverTest { @Before public void setup() throws IOException, WriteProcessException { - tsF = SystemFileFactory.INSTANCE.getFile("temp", "test.ts"); + tsF = SystemFileFactory.INSTANCE.getFile(logNodePrefix, "test.ts"); tsF.getParentFile().mkdirs(); schema = new Schema();
