This is an automated email from the ASF dual-hosted git repository.
qiaojialin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 837f058 support bracket "[" "]" in path (#1273)
837f058 is described below
commit 837f05852eec269a98b070a109ba9b99e32ef10e
Author: Boris <[email protected]>
AuthorDate: Wed May 27 17:02:52 2020 +0800
support bracket "[" "]" in path (#1273)
* support [ ] in path
---
.../UserGuide/System Tools/Load External Tsfile.md | 49 +++++++++++++---------
.../UserGuide/System Tools/Load External Tsfile.md | 43 +++++++++++--------
.../org/apache/iotdb/db/qp/strategy/SqlBase.g4 | 29 ++++++-------
.../iotdb/db/qp/strategy/LogicalGenerator.java | 12 +++---
.../db/integration/IoTDBLoadExternalTsfileIT.java | 32 +++++++-------
.../apache/iotdb/db/qp/plan/PhysicalPlanTest.java | 14 +++----
6 files changed, 100 insertions(+), 79 deletions(-)
diff --git a/docs/UserGuide/System Tools/Load External Tsfile.md
b/docs/UserGuide/System Tools/Load External Tsfile.md
index c25c1f9..d0f3ac9 100644
--- a/docs/UserGuide/System Tools/Load External Tsfile.md
+++ b/docs/UserGuide/System Tools/Load External Tsfile.md
@@ -19,53 +19,64 @@
-->
-# Load External Tsfile Tool
+# Load External TsFile Tool
# Introduction
+
The load external tsfile tool allows users to load tsfiles, delete a tsfile,
or move a tsfile to target directory from the running Apache IoTDB instance.
# Usage
+
The user sends specified commands to the Apache IoTDB system through the Cli
tool or JDBC to use the tool.
## load tsfiles
-The command to load tsfiles is `load <path/dir> [true/false] [storage group
level]`.
+
+The command to load tsfiles is `load "<path/dir>" [true/false] [storage group
level]`.
This command has two usages:
+
1. Load a single tsfile by specifying a file path (absolute path).
+
The second parameter indicates the path of the tsfile to be loaded and the
name of the tsfile needs to conform to the tsfile naming convention, that is,
`{systemTime}-{versionNum}-{mergeNum} .tsfile`. The third and fourth parameters
are optional. When the metadata corresponding to the timeseries in the tsfile
to be loaded does not exist, you can choose whether to create the schema
automatically. If the third parameter is true, the schema will be created
automatically. If the thrid parame [...]
If the `.resource` file corresponding to the file exists, it will be loaded
into the data directory and engine of the Apache IoTDB. Otherwise, the
corresponding `.resource` file will be regenerated from the tsfile file.
+
Examples:
- * `load /Users/Desktop/data/1575028885956-101-0.tsfile`
- * `load /Users/Desktop/data/1575028885956-101-0.tsfile false`
- * `load /Users/Desktop/data/1575028885956-101-0.tsfile true`
- * `load /Users/Desktop/data/1575028885956-101-0.tsfile true 1`
+
+* `load "/Users/Desktop/data/1575028885956-101-0.tsfile"`
+* `load "/Users/Desktop/data/1575028885956-101-0.tsfile" false`
+* `load "/Users/Desktop/data/1575028885956-101-0.tsfile" true`
+* `load "/Users/Desktop/data/1575028885956-101-0.tsfile" true 1`
2. Load a batch of files by specifying a folder path (absolute path).
+
The second parameter indicates the path of the tsfile to be loaded and the
name of the tsfiles need to conform to the tsfile naming convention, that is,
`{systemTime}-{versionNum}-{mergeNum} .tsfile`. The third and fourth parameters
are optional. When the metadata corresponding to the time series in the tsfile
to be loaded does not exist, you can choose whether to create the schema
automatically. If the third parameter is true, the schema will be created
automatically. If the third param [...]
If the `.resource` file corresponding to the file exists, they will be loaded
into the data directory and engine of the Apache IoTDB. Otherwise, the
corresponding` .resource` files will be regenerated from the tsfile sfile.
+
Examples:
- * `load /Users/Desktop/data`
- * `load /Users/Desktop/data false`
- * `load /Users/Desktop/data true`
- * `load /Users/Desktop/data true 1`
+
+* `load "/Users/Desktop/data"`
+* `load "/Users/Desktop/data" false`
+* `load "/Users/Desktop/data" true`
+* `load "/Users/Desktop/data" true 1`
## remove a tsfile
-The command to delete a tsfile is: `remove <path>`.
+
+The command to delete a tsfile is: `remove "<path>"`.
This command deletes a tsfile by specifying the file path. The specific
implementation is to delete the tsfile and its corresponding `.resource` and`
.modification` files.
-Note that the path must include at least two levels of path, you cannot
directly specify the file name, examples:
+Examples:
-* `remove root.vehicle / 1575028885956-101-0.tsfile` is correct.
-* `remove 1575028885956-101-0.tsfile` is wrong.
+* `remove "root.vehicle/1575028885956-101-0.tsfile"`
+* `remove "1575028885956-101-0.tsfile"`
## move a tsfile to a target directory
-The command to move a tsfile to ta arget directory is: `move <path> <dir>`.
-This command moves a tsfile to a target directory by specifying tsfile path
and the target directory(absolute path). The specific implementation is to
remove the tsfile from the engine and move the tsfile file and its
corresponding `.resource` file to the target directory.
+The command to move a tsfile to ta arget directory is: `move "<path>" "<dir>"`.
-Note that the path must include at least two levels of path, you cannot
directly specify the file name, examples:
+This command moves a tsfile to a target directory by specifying tsfile path
and the target directory(absolute path). The specific implementation is to
remove the tsfile from the engine and move the tsfile file and its
corresponding `.resource` file to the target directory.
-* `move root.vehicle/1575029224130-101-0.tsfile /data/data/tmp` is correct.
+Examples:
-* `move 1575029224130-101-0.tsfile /data/data/tmp` is wrong.
\ No newline at end of file
+* `move "root.vehicle/1575029224130-101-0.tsfile" "/data/data/tmp"`
+* `move "1575029224130-101-0.tsfile" "/data/data/tmp"`
\ No newline at end of file
diff --git a/docs/zh/UserGuide/System Tools/Load External Tsfile.md
b/docs/zh/UserGuide/System Tools/Load External Tsfile.md
index e1b59ce..ebcd89f 100644
--- a/docs/zh/UserGuide/System Tools/Load External Tsfile.md
+++ b/docs/zh/UserGuide/System Tools/Load External Tsfile.md
@@ -38,41 +38,50 @@
# 使用方式
用户通过Cli工具或JDBC向Apache IoTDB系统发送指定命令实现文件加载的功能。
## 加载tsfile文件
-加载tsfile文件的指令为:`load <path/dir> [true/false] [storage group level]`
+加载tsfile文件的指令为:`load "<path/dir>" [true/false] [storage group level]`
该指令有两种用法:
1. 通过指定文件路径(绝对路径)加载单tsfile文件。
+
第二个参数表示待加载的tsfile文件的路径,其中文件名称需要符合tsfile的命名规范,即`{systemTime}-{versionNum}-{mergeNum}.tsfile`。第三、四个参数为可选项。当待加载的tsfile文件中时间序列对应的元数据不存在时,用户可以选择是否自动创建schema,参数为true表示自动创建schema,相反false表示不创建,缺省时默认创建schema。当tsfile对应的存储组不存在时,用户可以通过第四个参数来制定存储组的级别,默认为`iotdb-engine.properties`中设置的级别。若待加载的tsfile文件对应的`.resource`文件存在,会被一并加载至Apache
IoTDB数据文件的目录和引擎中,否则将通过tsfile文件重新生成对应的`.resource`文件,即加载的tsfile文件所对应的`.resource`文件不是必要的。
+
示例:
- * `load /Users/Desktop/data/1575028885956-101-0.tsfile`
- * `load /Users/Desktop/data/1575028885956-101-0.tsfile false`
- * `load /Users/Desktop/data/1575028885956-101-0.tsfile true`
- * `load /Users/Desktop/data/1575028885956-101-0.tsfile true 1`
+
+* load `"/Users/Desktop/data/1575028885956-101-0.tsfile"`
+* load `"/Users/Desktop/data/1575028885956-101-0.tsfile" false`
+* load `"/Users/Desktop/data/1575028885956-101-0.tsfile" true`
+* load `"/Users/Desktop/data/1575028885956-101-0.tsfile" true 1`
2. 通过指定文件夹路径(绝对路径)批量加载文件。
+
第二个参数表示待加载的tsfile文件的路径,其中文件名称需要符合tsfile的命名规范,即`{systemTime}-{versionNum}-{mergeNum}.tsfile`。第三、四个参数为可选项。当待加载的tsfile文件中时间序列对应的元数据不存在时,用户可以选择是否自动创建schema,参数为true表示自动创建schema,相反false表示不创建,缺省时默认创建schema。当tsfile对应的存储组不存在时,用户可以通过第四个参数来制定存储组的级别,默认为`iotdb-engine.properties`中设置的级别。若待加载文件对应的`.resource`文件存在,则会一并加载至Apache
IoTDB数据文件目录和引擎中,否则将通过tsfile文件重新生成对应的`.resource`文件,即加载的tsfile文件所对应的`.resource`文件不是必要的。
+
示例:
- * `load /Users/Desktop/data`
- * `load /Users/Desktop/data false`
- * `load /Users/Desktop/data true`
- * `load /Users/Desktop/data true 1`
+
+* load `"/Users/Desktop/data"`
+* load `"/Users/Desktop/data" false`
+* load `"/Users/Desktop/data" true`
+* load `"/Users/Desktop/data" true 1`
## 删除tsfile文件
-删除tsfile文件的指令为:`remove <path>`
+
+删除tsfile文件的指令为:`remove "<path>"`
该指令通过指定文件路径删除tsfile文件,具体做法是将该tsfile和其对应的`.resource`和`.modification`文件全部删除。
-注意path至少要包含倒数两层路径,不可以直接指定文件名称(即最后一层路径),示例:
+示例:
-* `remove root.vehicle/1575028885956-101-0.tsfile` 是正确的
-* `remove 1575028885956-101-0.tsfile` 是错误的
+* `remove "root.vehicle/1575028885956-101-0.tsfile"`
+* `remove "1575028885956-101-0.tsfile"`
## 移出tsfile文件至指定目录
-移出tsfile文件的指令为:`remove <path> <dir>`
+
+移出tsfile文件的指令为:`remove "<path>" "<dir>"`
该指令将指定路径的tsfile文件移动至目标文件夹(绝对路径)中,具体做法是在引擎中移除该tsfile,并将该tsfile文件和其对应的`.resource`文件移动到目标文件夹下
-注意path至少要包含倒数两层路径,不可以直接指定文件名称(即最后一层路径),示例:
-* `move root.vehicle/1575029224130-101-0.tsfile /data/data/tmp` 是正确的
-* `move 1575029224130-101-0.tsfile /data/data/tmp` 是错误的
+示例:
+
+* `move "root.vehicle/1575029224130-101-0.tsfile" "/data/data/tmp"`
+* `move "1575029224130-101-0.tsfile" "/data/data/tmp"`
diff --git a/server/src/main/antlr4/org/apache/iotdb/db/qp/strategy/SqlBase.g4
b/server/src/main/antlr4/org/apache/iotdb/db/qp/strategy/SqlBase.g4
index 025f19b..ecf7b80 100644
--- a/server/src/main/antlr4/org/apache/iotdb/db/qp/strategy/SqlBase.g4
+++ b/server/src/main/antlr4/org/apache/iotdb/db/qp/strategy/SqlBase.g4
@@ -76,9 +76,9 @@ statement
| COUNT TIMESERIES prefixPath? (GROUP BY LEVEL OPERATOR_EQ INT)?
#countTimeseries
| COUNT NODES prefixPath LEVEL OPERATOR_EQ INT #countNodes
| LOAD CONFIGURATION #loadConfigurationStatement
- | LOAD FILE autoCreateSchema? #loadFiles
- | REMOVE FILE #removeFile
- | MOVE FILE FILE #moveFile
+ | LOAD STRING_LITERAL autoCreateSchema? #loadFiles
+ | REMOVE STRING_LITERAL #removeFile
+ | MOVE STRING_LITERAL STRING_LITERAL #moveFile
| SELECT INDEX func=ID //not support yet
LR_BRACKET
p1=fullPath COMMA p2=fullPath COMMA n1=timeValue COMMA n2=timeValue COMMA
@@ -343,11 +343,16 @@ suffixPath
nodeName
: ID
| STAR
+ | STRING_LITERAL
| ID STAR
| DURATION
| encoding
| dataType
- | constant
+ | dateExpression
+ | MINUS? EXPONENT
+ | MINUS? INT
+ | booleanClause
+ | (ID | OPERATOR_IN)? LS_BRACKET ID? RS_BRACKET ID?
;
nodeNameWithoutStar
@@ -356,7 +361,11 @@ nodeNameWithoutStar
| DURATION
| encoding
| dataType
- | constant
+ | dateExpression
+ | MINUS? EXPONENT
+ | MINUS? INT
+ | booleanClause
+ | (ID | OPERATOR_IN)? LS_BRACKET ID? RS_BRACKET ID?
;
dataType
@@ -373,8 +382,7 @@ constant
| MINUS? realLiteral
| MINUS? INT
| STRING_LITERAL
- | TRUE
- | FALSE
+ | booleanClause
;
booleanClause
@@ -926,9 +934,6 @@ DATETIME
(('+' | '-') INT ':' INT)?)?
;
-FILE
- : (('a'..'z'| 'A'..'Z')(':')?)* (('\\' | '/')+ PATH_FRAGMENT) +
- ;
/** Allow unicode rule/token names */
ID : FIRST_NAME_CHAR NAME_CHAR*;
@@ -1082,10 +1087,6 @@ fragment Z
: 'z' | 'Z'
;
-fragment PATH_FRAGMENT
- : ('a'..'z'|'A'..'Z'|'0'..'9'|'_'|'-'|'.')*
- ;
-
WS
: [ \r\n\t]+ -> channel(HIDDEN)
;
\ No newline at end of file
diff --git
a/server/src/main/java/org/apache/iotdb/db/qp/strategy/LogicalGenerator.java
b/server/src/main/java/org/apache/iotdb/db/qp/strategy/LogicalGenerator.java
index fe8dbd1..83592c6 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/strategy/LogicalGenerator.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/strategy/LogicalGenerator.java
@@ -283,18 +283,18 @@ public class LogicalGenerator extends SqlBaseBaseListener
{
super.enterLoadFiles(ctx);
if(ctx.autoCreateSchema() != null) {
if(ctx.autoCreateSchema().INT() != null) {
- initializedOperator = new LoadFilesOperator(new
File(ctx.FILE().getText()),
+ initializedOperator = new LoadFilesOperator(new
File(removeStringQuote(ctx.STRING_LITERAL().getText())),
Boolean.parseBoolean(ctx.autoCreateSchema().booleanClause().getText()),
Integer.parseInt(ctx.autoCreateSchema().INT().getText())
);
} else {
- initializedOperator = new LoadFilesOperator(new
File(ctx.FILE().getText()),
+ initializedOperator = new LoadFilesOperator(new
File(removeStringQuote(ctx.STRING_LITERAL().getText())),
Boolean.parseBoolean(ctx.autoCreateSchema().booleanClause().getText()),
IoTDBDescriptor.getInstance().getConfig().getDefaultStorageGroupLevel()
);
}
} else {
- initializedOperator = new LoadFilesOperator(new
File(ctx.FILE().getText()),
+ initializedOperator = new LoadFilesOperator(new
File(removeStringQuote(ctx.STRING_LITERAL().getText())),
true,
IoTDBDescriptor.getInstance().getConfig().getDefaultStorageGroupLevel()
);
@@ -304,14 +304,14 @@ public class LogicalGenerator extends SqlBaseBaseListener
{
@Override
public void enterMoveFile(MoveFileContext ctx) {
super.enterMoveFile(ctx);
- initializedOperator = new MoveFileOperator(new File(ctx.FILE(0).getText()),
- new File(ctx.FILE(1).getText()));
+ initializedOperator = new MoveFileOperator(new
File(removeStringQuote(ctx.STRING_LITERAL(0).getText())),
+ new File(removeStringQuote(ctx.STRING_LITERAL(1).getText())));
}
@Override
public void enterRemoveFile(RemoveFileContext ctx) {
super.enterRemoveFile(ctx);
- initializedOperator = new RemoveFileOperator(new
File(ctx.FILE().getText()));
+ initializedOperator = new RemoveFileOperator(new
File(removeStringQuote(ctx.STRING_LITERAL().getText())));
}
@Override
diff --git
a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBLoadExternalTsfileIT.java
b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBLoadExternalTsfileIT.java
index 4b013fc..c440ac5 100644
---
a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBLoadExternalTsfileIT.java
+++
b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBLoadExternalTsfileIT.java
@@ -140,7 +140,7 @@ public class IoTDBLoadExternalTsfileIT {
tmpDir.mkdirs();
}
for (TsFileResource resource : resources) {
- statement.execute(String.format("move %s %s", resource.getPath(),
tmpDir));
+ statement.execute(String.format("move \"%s\" \"%s\"",
resource.getPath(), tmpDir));
}
assertEquals(0, StorageEngine.getInstance().getProcessor("root.vehicle")
.getSequenceFileTreeSet().size());
@@ -158,7 +158,7 @@ public class IoTDBLoadExternalTsfileIT {
tmpDir.mkdirs();
}
for (TsFileResource resource : resources) {
- statement.execute(String.format("move %s %s", resource.getPath(),
tmpDir));
+ statement.execute(String.format("move \"%s\" \"%s\"",
resource.getPath(), tmpDir));
}
assertEquals(0, StorageEngine.getInstance().getProcessor("root.test")
.getSequenceFileTreeSet().size());
@@ -186,7 +186,7 @@ public class IoTDBLoadExternalTsfileIT {
tmpDir.mkdirs();
}
for (TsFileResource resource : resources) {
- statement.execute(String.format("move %s %s", resource.getPath(),
tmpDir));
+ statement.execute(String.format("move \"%s\" \"%s\"",
resource.getPath(), tmpDir));
}
// move root.test
@@ -199,13 +199,13 @@ public class IoTDBLoadExternalTsfileIT {
tmpDir.mkdirs();
}
for (TsFileResource resource : resources) {
- statement.execute(String.format("move %s %s", resource.getPath(),
tmpDir));
+ statement.execute(String.format("move \"%s\" \"%s\"",
resource.getPath(), tmpDir));
}
// load all tsfile in tmp dir
tmpDir = new
File(resources.get(0).getFile().getParentFile().getParentFile().getParentFile(),
"tmp");
- statement.execute(String.format("load %s", tmpDir.getAbsolutePath()));
+ statement.execute(String.format("load \"%s\"",
tmpDir.getAbsolutePath()));
resources = new ArrayList<>(
StorageEngine.getInstance().getProcessor("root.vehicle")
.getSequenceFileTreeSet());
@@ -289,13 +289,13 @@ public class IoTDBLoadExternalTsfileIT {
tmpDir.mkdirs();
}
for (TsFileResource resource : resources) {
- statement.execute(String.format("move %s %s", resource.getPath(),
tmpDir));
+ statement.execute(String.format("move \"%s\" \"%s\"",
resource.getPath(), tmpDir));
}
resources = new ArrayList<>(
StorageEngine.getInstance().getProcessor("root.vehicle").getUnSequenceFileList());
assertEquals(1, resources.size());
for (TsFileResource resource : resources) {
- statement.execute(String.format("move %s %s", resource.getPath(),
tmpDir));
+ statement.execute(String.format("move \"%s\" \"%s\"",
resource.getPath(), tmpDir));
}
// move root.test
@@ -307,18 +307,18 @@ public class IoTDBLoadExternalTsfileIT {
tmpDir.mkdirs();
}
for (TsFileResource resource : resources) {
- statement.execute(String.format("move %s %s", resource.getPath(),
tmpDir));
+ statement.execute(String.format("move \"%s\" \"%s\"",
resource.getPath(), tmpDir));
}
resources = new ArrayList<>(
StorageEngine.getInstance().getProcessor("root.test").getUnSequenceFileList());
assertEquals(2, resources.size());
for (TsFileResource resource : resources) {
- statement.execute(String.format("move %s %s", resource.getPath(),
tmpDir));
+ statement.execute(String.format("move \"%s\" \"%s\"",
resource.getPath(), tmpDir));
}
// load all tsfile in tmp dir
tmpDir = tmpDir.getParentFile().getParentFile();
- statement.execute(String.format("load %s", tmpDir.getAbsolutePath()));
+ statement.execute(String.format("load \"%s\"",
tmpDir.getAbsolutePath()));
assertEquals(2, StorageEngine.getInstance().getProcessor("root.vehicle")
.getSequenceFileTreeSet().size());
assertEquals(1, StorageEngine.getInstance().getProcessor("root.vehicle")
@@ -370,7 +370,7 @@ public class IoTDBLoadExternalTsfileIT {
tmpDir.mkdirs();
}
for (TsFileResource resource : resources) {
- statement.execute(String.format("move %s %s", resource.getPath(),
tmpDir));
+ statement.execute(String.format("move \"%s\" \"%s\"",
resource.getPath(), tmpDir));
}
// move root.test
@@ -383,7 +383,7 @@ public class IoTDBLoadExternalTsfileIT {
tmpDir.mkdirs();
}
for (TsFileResource resource : resources) {
- statement.execute(String.format("move %s %s", resource.getPath(),
tmpDir));
+ statement.execute(String.format("move \"%s\" \"%s\"",
resource.getPath(), tmpDir));
}
boolean hasResultSet = statement.execute("SHOW timeseries");
@@ -409,7 +409,7 @@ public class IoTDBLoadExternalTsfileIT {
// test not load metadata automatically, it will occur errors.
boolean hasError = false;
try {
- statement.execute(String.format("load %s false 1",
tmpDir.getAbsolutePath()));
+ statement.execute(String.format("load \"%s\" false 1",
tmpDir.getAbsolutePath()));
} catch (Exception e) {
hasError = true;
}
@@ -417,7 +417,7 @@ public class IoTDBLoadExternalTsfileIT {
// test load metadata automatically, it will succeed.
tmpDir = tmpDir.getParentFile().getParentFile();
- statement.execute(String.format("load %s true 1",
tmpDir.getAbsolutePath()));
+ statement.execute(String.format("load \"%s\" true 1",
tmpDir.getAbsolutePath()));
resources = new ArrayList<>(
StorageEngine.getInstance().getProcessor("root.vehicle")
.getSequenceFileTreeSet());
@@ -446,7 +446,7 @@ public class IoTDBLoadExternalTsfileIT {
.getSequenceFileTreeSet());
assertEquals(1, resources.size());
for (TsFileResource resource : resources) {
- statement.execute(String.format("remove %s", resource.getPath()));
+ statement.execute(String.format("remove \"%s\"", resource.getPath()));
}
assertEquals(0, StorageEngine.getInstance().getProcessor("root.vehicle")
.getSequenceFileTreeSet().size());
@@ -456,7 +456,7 @@ public class IoTDBLoadExternalTsfileIT {
.getSequenceFileTreeSet());
assertEquals(2, resources.size());
for (TsFileResource resource : resources) {
- statement.execute(String.format("remove %s", resource.getPath()));
+ statement.execute(String.format("remove \"%s\"", resource.getPath()));
}
assertEquals(0, StorageEngine.getInstance().getProcessor("root.test")
.getSequenceFileTreeSet().size());
diff --git
a/server/src/test/java/org/apache/iotdb/db/qp/plan/PhysicalPlanTest.java
b/server/src/test/java/org/apache/iotdb/db/qp/plan/PhysicalPlanTest.java
index e150032..d5faacc 100644
--- a/server/src/test/java/org/apache/iotdb/db/qp/plan/PhysicalPlanTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/qp/plan/PhysicalPlanTest.java
@@ -714,28 +714,28 @@ public class PhysicalPlanTest {
@Test
public void testLoadFiles() throws QueryProcessException {
String filePath = "data" + File.separator + "213213441243-1-2.tsfile";
- String metadata = String.format("load %s", filePath);
+ String metadata = String.format("load \"%s\"", filePath);
Planner processor = new Planner();
OperateFilePlan plan = (OperateFilePlan)
processor.parseSQLToPhysicalPlan(metadata);
assertEquals(String.format(
"OperateFilePlan{file=%s, targetDir=null, autoCreateSchema=true,
sgLevel=1, operatorType=LOAD_FILES}",
filePath), plan.toString());
- metadata = String.format("load %s true", filePath);
+ metadata = String.format("load \"%s\" true", filePath);
processor = new Planner();
plan = (OperateFilePlan) processor.parseSQLToPhysicalPlan(metadata);
assertEquals(String.format(
"OperateFilePlan{file=%s, targetDir=null, autoCreateSchema=true,
sgLevel=1, operatorType=LOAD_FILES}",
filePath), plan.toString());
- metadata = String.format("load %s false", filePath);
+ metadata = String.format("load \"%s\" false", filePath);
processor = new Planner();
plan = (OperateFilePlan) processor.parseSQLToPhysicalPlan(metadata);
assertEquals(String.format(
"OperateFilePlan{file=%s, targetDir=null, autoCreateSchema=false,
sgLevel=1, operatorType=LOAD_FILES}",
filePath), plan.toString());
- metadata = String.format("load %s true 3", filePath);
+ metadata = String.format("load \"%s\" true 3", filePath);
processor = new Planner();
plan = (OperateFilePlan) processor.parseSQLToPhysicalPlan(metadata);
assertEquals(String.format(
@@ -746,7 +746,7 @@ public class PhysicalPlanTest {
@Test
public void testRemoveFile() throws QueryProcessException {
String filePath = "data" + File.separator + "213213441243-1-2.tsfile";
- String metadata = String.format("remove %s", filePath);
+ String metadata = String.format("remove \"%s\"", filePath);
Planner processor = new Planner();
OperateFilePlan plan = (OperateFilePlan)
processor.parseSQLToPhysicalPlan(metadata);
assertEquals(String.format(
@@ -758,7 +758,7 @@ public class PhysicalPlanTest {
public void testMoveFile() throws QueryProcessException {
String filePath = "data" + File.separator + "213213441243-1-2.tsfile";
String targetDir = "user" + File.separator + "backup";
- String metadata = String.format("move %s %s", filePath, targetDir);
+ String metadata = String.format("move \"%s\" \"%s\"", filePath, targetDir);
Planner processor = new Planner();
OperateFilePlan plan = (OperateFilePlan)
processor.parseSQLToPhysicalPlan(metadata);
assertEquals(
@@ -818,7 +818,7 @@ public class PhysicalPlanTest {
@Test
public void testSpecialCharacters() throws QueryProcessException {
- String sqlStr1 = "create timeseries root.3e-3.-1.1/2.SNAPPY.RLE.81+12.+2
with datatype=FLOAT, encoding=RLE, compression=SNAPPY tags(tag1=v1, tag2=v2)
attributes(attr1=v1, attr2=v2)";
+ String sqlStr1 = "create timeseries
root.3e-3.-1.1/2.SNAPPY.RLE.81+12.+2.s/io.in[jack] with datatype=FLOAT,
encoding=RLE, compression=SNAPPY tags(tag1=v1, tag2=v2) attributes(attr1=v1,
attr2=v2)";
PhysicalPlan plan1 = processor.parseSQLToPhysicalPlan(sqlStr1);
Assert.assertEquals(OperatorType.CREATE_TIMESERIES,
plan1.getOperatorType());
}