This is an automated email from the ASF dual-hosted git repository.
rong pushed a commit to branch xianyi
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/xianyi by this push:
new b93493a modify export tools
b93493a is described below
commit b93493a431c305d7d1f01cfcc6805aa09689a549
Author: Steve Yurong Su <[email protected]>
AuthorDate: Sat Nov 27 18:36:27 2021 +0800
modify export tools
---
.../main/java/org/apache/iotdb/tool/ExportCsv.java | 20 +++++---------------
1 file changed, 5 insertions(+), 15 deletions(-)
diff --git a/cli/src/main/java/org/apache/iotdb/tool/ExportCsv.java
b/cli/src/main/java/org/apache/iotdb/tool/ExportCsv.java
index 6d77a36..a4dedee 100644
--- a/cli/src/main/java/org/apache/iotdb/tool/ExportCsv.java
+++ b/cli/src/main/java/org/apache/iotdb/tool/ExportCsv.java
@@ -46,8 +46,6 @@ import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
-import java.time.Instant;
-import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
@@ -301,19 +299,10 @@ public class ExportCsv extends AbstractCsvTool {
}
public static String timeTrans(Long time) {
- String timestampPrecision = "ms";
- switch (timeFormat) {
- case "default":
- return RpcUtils.parseLongToDateWithPrecision(
- DateTimeFormatter.ISO_OFFSET_DATE_TIME, time, zoneId,
timestampPrecision);
- case "timestamp":
- case "long":
- case "number":
- return String.valueOf(time);
- default:
- return ZonedDateTime.ofInstant(Instant.ofEpochMilli(time), zoneId)
- .format(DateTimeFormatter.ofPattern(timeFormat));
- }
+ return RpcUtils.parseLongToDateWithPrecision(
+ DateTimeFormatter.ISO_OFFSET_DATE_TIME, time, zoneId, "ns")
+ .substring(0, 26)
+ + "Z";
}
public static Boolean writeCsvFile(SessionDataSet sessionDataSet, String
filePath)
@@ -323,6 +312,7 @@ public class ExportCsv extends AbstractCsvTool {
.withFirstRecordAsHeader()
.withEscape('\\')
.withQuoteMode(QuoteMode.NONE)
+ .withDelimiter(' ')
.print(new PrintWriter(filePath));
List<Object> headers = new ArrayList<>();