This is an automated email from the ASF dual-hosted git repository.
miao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 2e433b5ec95 Update import schema logic implementation and optimize
-help display information (#12643)
2e433b5ec95 is described below
commit 2e433b5ec95293b62a7b9b2cfb85973aeace3f97
Author: Summer <[email protected]>
AuthorDate: Thu Jun 6 09:39:12 2024 +0800
Update import schema logic implementation and optimize -help display
information (#12643)
* add import-schema.sh/bat and export-schema.sh/bat in cli/tools
* fix import schema
* fix import schema
---------
Co-authored-by: 2b3c511 <[email protected]>
---
.../java/org/apache/iotdb/tool/ImportSchema.java | 62 ++++++++++------------
1 file changed, 27 insertions(+), 35 deletions(-)
diff --git
a/iotdb-client/cli/src/main/java/org/apache/iotdb/tool/ImportSchema.java
b/iotdb-client/cli/src/main/java/org/apache/iotdb/tool/ImportSchema.java
index acd55b3eb42..610c9e1f756 100644
--- a/iotdb-client/cli/src/main/java/org/apache/iotdb/tool/ImportSchema.java
+++ b/iotdb-client/cli/src/main/java/org/apache/iotdb/tool/ImportSchema.java
@@ -115,7 +115,6 @@ public class ImportSchema extends AbstractSchemaTool {
Option opFailedFile =
Option.builder(FAILED_FILE_ARGS)
- .required(false)
.longOpt(FAILED_FILE_NAME)
.hasArg()
.argName(FAILED_FILE_ARGS_NAME)
@@ -124,13 +123,6 @@ public class ImportSchema extends AbstractSchemaTool {
.build();
options.addOption(opFailedFile);
- Option opAligned =
- Option.builder(ALIGNED_ARGS)
- .longOpt(ALIGNED_ARGS)
- .desc("Whether import schema as aligned timeseries(optional)")
- .build();
- options.addOption(opAligned);
-
Option opBatchPointSize =
Option.builder(BATCH_POINT_SIZE_ARGS)
.longOpt(BATCH_POINT_SIZE_NAME)
@@ -341,35 +333,35 @@ public class ImportSchema extends AbstractSchemaTool {
hasStarted.set(true);
} else if (pointSize.get() >= batchPointSize) {
try {
- writeAndEmptyDataSet(
- paths,
- dataTypes,
- encodings,
- compressors,
- null,
- null,
- null,
- measurementAlias,
- 3);
- writeAndEmptyDataSet(
- pathsWithAlias,
- dataTypesWithAlias,
- encodingsWithAlias,
- compressorsWithAlias,
- null,
- null,
- null,
- null,
- 3);
- paths.clear();
- dataTypes.clear();
- encodings.clear();
- compressors.clear();
- measurementAlias.clear();
- pointSize.set(0);
+ if (CollectionUtils.isNotEmpty(paths)) {
+ writeAndEmptyDataSet(
+ paths, dataTypes, encodings, compressors, null, null,
null, null, 3);
+ }
+ } catch (Exception e) {
+ paths.forEach(t ->
failedRecords.add(Collections.singletonList(t)));
+ }
+ try {
+ if (CollectionUtils.isNotEmpty(pathsWithAlias)) {
+ writeAndEmptyDataSet(
+ pathsWithAlias,
+ dataTypesWithAlias,
+ encodingsWithAlias,
+ compressorsWithAlias,
+ null,
+ null,
+ null,
+ measurementAlias,
+ 3);
+ }
} catch (Exception e) {
- failedRecords.add((List<Object>) (List<?>) paths);
+ paths.forEach(t ->
failedRecords.add(Collections.singletonList(t)));
}
+ paths.clear();
+ dataTypes.clear();
+ encodings.clear();
+ compressors.clear();
+ measurementAlias.clear();
+ pointSize.set(0);
}
} else {
paths.clear();