This is an automated email from the ASF dual-hosted git repository.
critas 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 133a9cb9885 Update export script prompt information (#14276)
133a9cb9885 is described below
commit 133a9cb98858b0977ec77e9d749bd7944ca1b095
Author: Summer <[email protected]>
AuthorDate: Thu Dec 5 17:28:19 2024 +0800
Update export script prompt information (#14276)
* update export script prompt information
* update export script prompt information
* format
---------
Co-authored-by: 2b3c511 <[email protected]>
---
.../org/apache/iotdb/tool/data/ExportData.java | 11 +++++++++++
.../org/apache/iotdb/tool/data/ImportData.java | 22 ++++++++++++++--------
.../org/apache/iotdb/tool/tsfile/ExportTsFile.java | 6 ++++++
3 files changed, 31 insertions(+), 8 deletions(-)
diff --git
a/iotdb-client/cli/src/main/java/org/apache/iotdb/tool/data/ExportData.java
b/iotdb-client/cli/src/main/java/org/apache/iotdb/tool/data/ExportData.java
index d75445615ed..e8d58a59200 100644
--- a/iotdb-client/cli/src/main/java/org/apache/iotdb/tool/data/ExportData.java
+++ b/iotdb-client/cli/src/main/java/org/apache/iotdb/tool/data/ExportData.java
@@ -242,6 +242,11 @@ public class ExportData extends AbstractDataTool {
true);
System.exit(CODE_ERROR);
}
+ } else {
+ ioTPrinter.println(
+ String.format(
+ "Invalid args: Required values for option '%s' not provided",
FILE_TYPE_NAME));
+ System.exit(CODE_ERROR);
}
int exitCode = CODE_OK;
try {
@@ -531,6 +536,12 @@ public class ExportData extends AbstractDataTool {
if (!targetDirectory.endsWith("/") && !targetDirectory.endsWith("\\")) {
targetDirectory += File.separator;
}
+ final File file = new File(targetDirectory);
+ if (!file.isDirectory()) {
+ ioTPrinter.println(
+ String.format("Source file or directory %s does not exist",
targetDirectory));
+ System.exit(CODE_ERROR);
+ }
if (commandLine.getOptionValue(LINES_PER_FILE_ARGS) != null) {
linesPerFile =
Integer.parseInt(commandLine.getOptionValue(LINES_PER_FILE_ARGS));
}
diff --git
a/iotdb-client/cli/src/main/java/org/apache/iotdb/tool/data/ImportData.java
b/iotdb-client/cli/src/main/java/org/apache/iotdb/tool/data/ImportData.java
index 948f0756f34..76d9417777d 100644
--- a/iotdb-client/cli/src/main/java/org/apache/iotdb/tool/data/ImportData.java
+++ b/iotdb-client/cli/src/main/java/org/apache/iotdb/tool/data/ImportData.java
@@ -366,6 +366,12 @@ public class ImportData extends AbstractDataTool {
}
if (commandLine.getOptionValue(THREAD_NUM_ARGS) != null) {
threadNum =
Integer.parseInt(commandLine.getOptionValue(THREAD_NUM_ARGS));
+ if (threadNum <= 0) {
+ ioTPrinter.println(
+ String.format(
+ "error: Invalid thread number '%s'. Please set a positive
integer.", threadNum));
+ System.exit(CODE_ERROR);
+ }
}
if (commandLine.getOptionValue(TIMESTAMP_PRECISION_ARGS) != null) {
timestampPrecision =
commandLine.getOptionValue(TIMESTAMP_PRECISION_ARGS);
@@ -512,16 +518,16 @@ public class ImportData extends AbstractDataTool {
System.exit(CODE_ERROR);
}
} else {
- printHelpOptions(
- TSFILEDB_CLI_HEAD,
- TSFILEDB_CLI_PREFIX,
- hf,
- tsFileOptions,
- csvOptions,
- sqlOptions,
- true);
+ ioTPrinter.println(
+ String.format(
+ "Invalid args: Required values for option '%s' not provided",
FILE_TYPE_NAME));
System.exit(CODE_ERROR);
}
+ } else {
+ ioTPrinter.println(
+ String.format(
+ "Invalid args: Required values for option '%s' not provided",
FILE_TYPE_NAME));
+ System.exit(CODE_ERROR);
}
try {
diff --git
a/iotdb-client/cli/src/main/java/org/apache/iotdb/tool/tsfile/ExportTsFile.java
b/iotdb-client/cli/src/main/java/org/apache/iotdb/tool/tsfile/ExportTsFile.java
index 322e7ad530c..41bc6df6f6f 100644
---
a/iotdb-client/cli/src/main/java/org/apache/iotdb/tool/tsfile/ExportTsFile.java
+++
b/iotdb-client/cli/src/main/java/org/apache/iotdb/tool/tsfile/ExportTsFile.java
@@ -252,6 +252,12 @@ public class ExportTsFile extends AbstractTsFileTool {
if (!targetDirectory.endsWith("/") && !targetDirectory.endsWith("\\")) {
targetDirectory += File.separator;
}
+ final File file = new File(targetDirectory);
+ if (!file.isDirectory()) {
+ ioTPrinter.println(
+ String.format("Source file or directory %s does not exist",
targetDirectory));
+ System.exit(CODE_ERROR);
+ }
}
/**