You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by lt...@apache.org on 2019/11/22 12:30:44 UTC

[incubator-iotdb] branch add_load_tsfile_feature created (now 50494e3)

This is an automated email from the ASF dual-hosted git repository.

lta pushed a change to branch add_load_tsfile_feature
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git.


      at 50494e3  modify antlr grammar to support load/remove/move path

This branch includes the following new commits:

     new 50494e3  modify antlr grammar to support load/remove/move path

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[incubator-iotdb] 01/01: modify antlr grammar to support load/remove/move path

Posted by lt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lta pushed a commit to branch add_load_tsfile_feature
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git

commit 50494e32aabeba0608f6376abc5bbf0c3d3b6e6d
Author: lta <li...@163.com>
AuthorDate: Fri Nov 22 20:30:09 2019 +0800

    modify antlr grammar to support load/remove/move path
---
 .../org/apache/iotdb/db/sql/parse/TqlLexer.g       | 21 +++++--
 .../org/apache/iotdb/db/sql/parse/TqlParser.g      | 42 +++++++++++++-
 .../org/apache/iotdb/db/qp/QueryProcessor.java     |  3 +
 .../apache/iotdb/db/qp/constant/SQLConstant.java   |  8 +++
 .../iotdb/db/qp/executor/QueryProcessExecutor.java | 22 ++++++++
 .../org/apache/iotdb/db/qp/logical/Operator.java   |  2 +-
 .../iotdb/db/qp/logical/sys/LoadFilesOperator.java | 38 +++++++++++++
 .../iotdb/db/qp/logical/sys/MoveFileOperator.java  | 44 +++++++++++++++
 .../db/qp/logical/sys/RemoveFileOperator.java      | 43 +++++++++++++++
 .../iotdb/db/qp/physical/sys/OperateFilePlan.java  | 64 ++++++++++++++++++++++
 .../iotdb/db/qp/strategy/LogicalGenerator.java     | 17 ++++++
 .../iotdb/db/qp/strategy/PhysicalGenerator.java    | 12 ++++
 .../apache/iotdb/db/qp/plan/PhysicalPlanTest.java  | 47 ++++++++++++++++
 13 files changed, 357 insertions(+), 6 deletions(-)

diff --git a/server/src/main/antlr3/org/apache/iotdb/db/sql/parse/TqlLexer.g b/server/src/main/antlr3/org/apache/iotdb/db/sql/parse/TqlLexer.g
index 7237522..a0212a0 100644
--- a/server/src/main/antlr3/org/apache/iotdb/db/sql/parse/TqlLexer.g
+++ b/server/src/main/antlr3/org/apache/iotdb/db/sql/parse/TqlLexer.g
@@ -261,6 +261,14 @@ K_LOAD
     : L O A D
     ;
 
+K_REMOVE
+    : R E M O V E
+    ;
+
+K_MOVE
+    : M O V E
+    ;
+
 K_WATERMARK_EMBEDDING
     : W A T E R M A R K '_' E M B E D D I N G
     ;
@@ -451,14 +459,11 @@ INT
     : NUM+
     ;
 
-fragment
-NUM
+fragment NUM
     :   '0'..'9'
     ;
 
 
-
-
 // ***************************
 fragment A
     : 'a' | 'A'
@@ -575,3 +580,11 @@ DURATION
     :
     (NUM+ (Y|M O|W|D|H|M|S|M S|U S|N S))+
     ;
+
+FILE
+    :  (('a'..'z'| 'A'..'Z')(':')?)* (('\\' | '/')+ PATH_FRAGMENT) +
+    ;
+
+fragment PATH_FRAGMENT
+    : ('a'..'z'|'A'..'Z'|'0'..'9'|'_'|'-'|'.')*
+    ;
\ No newline at end of file
diff --git a/server/src/main/antlr3/org/apache/iotdb/db/sql/parse/TqlParser.g b/server/src/main/antlr3/org/apache/iotdb/db/sql/parse/TqlParser.g
index e9cf046..f8fa04a 100644
--- a/server/src/main/antlr3/org/apache/iotdb/db/sql/parse/TqlParser.g
+++ b/server/src/main/antlr3/org/apache/iotdb/db/sql/parse/TqlParser.g
@@ -110,6 +110,9 @@ tokens{
     TOK_LOAD_CONFIGURATION;
     TOK_DYNAMIC_PARAMETER;
     TOK_FLUSH_TASK_INFO;
+    TOK_LOAD_FILES;
+    TOK_REMOVE_FILE;
+    TOK_MOVE_FILE;
 }
 
 @header{
@@ -286,6 +289,7 @@ sqlStatement
     | administrationStatement
     | configurationStatement
     | showStatement
+    | operateFileStatement
     ;
 
 dmlStatement
@@ -775,6 +779,14 @@ loadConfigurationStatement
     -> ^(TOK_LOAD_CONFIGURATION)
     ;
 
+/*
+****
+*************
+Show info
+*************
+****
+*/
+
 showStatement
     : showFlushTaskInfo
     | showDynamicParameter
@@ -793,11 +805,39 @@ showDynamicParameter
 /*
 ****
 *************
-TTL
+Operate file
 *************
 ****
 */
 
+operateFileStatement
+    : loadFiles
+    | removeFile
+    | moveFile
+    ;
+
+loadFiles
+    : K_LOAD path=FILE
+    -> ^(TOK_LOAD_FILES $path)
+    ;
+
+removeFile
+    : K_REMOVE filename=FILE
+    -> ^(TOK_REMOVE_FILE $filename)
+    ;
+
+moveFile
+    : K_MOVE filename=FILE dir=FILE
+    -> ^(TOK_MOVE_FILE $filename $dir)
+    ;
+
+/*
+****
+*************
+TTL
+*************
+****
+*/
 ttlStatement
     : setTTLStatement
     | unsetTTLStatement
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/QueryProcessor.java b/server/src/main/java/org/apache/iotdb/db/qp/QueryProcessor.java
index 746465a..6587167 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/QueryProcessor.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/QueryProcessor.java
@@ -130,6 +130,9 @@ public class QueryProcessor {
       case TTL:
       case LOAD_CONFIGURATION:
       case SHOW:
+      case LOAD_FILES:
+      case REMOVE_FILE:
+      case MOVE_FILE:
         return operator;
       case QUERY:
       case UPDATE:
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/constant/SQLConstant.java b/server/src/main/java/org/apache/iotdb/db/qp/constant/SQLConstant.java
index d62ec8d..e5d3ffd 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/constant/SQLConstant.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/constant/SQLConstant.java
@@ -107,6 +107,10 @@ public class SQLConstant {
   public static final int TOK_FLUSH_TASK_INFO = 67;
   public static final int TOK_DYNAMIC_PARAMETER = 68;
 
+  public static final int TOK_LOAD_FILES = 69;
+  public static final int TOK_REMOVE_FILE = 70;
+  public static final int TOK_MOVE_FILE = 71;
+
   public static final Map<Integer, String> tokenSymbol = new HashMap<>();
   public static final Map<Integer, String> tokenNames = new HashMap<>();
   public static final Map<Integer, Integer> reverseWords = new HashMap<>();
@@ -169,6 +173,10 @@ public class SQLConstant {
     tokenNames.put(TOK_LOAD_CONFIGURATION, "TOK_LOAD_CONFIGURATION");
     tokenNames.put(TOK_FLUSH_TASK_INFO, "TOK_FLUSH_TASK_INFO");
     tokenNames.put(TOK_DYNAMIC_PARAMETER, "TOK_DYNAMIC_PARAMETER");
+
+    tokenNames.put(TOK_LOAD_FILES, "TOK_LOAD_FILES");
+    tokenNames.put(TOK_REMOVE_FILE, "TOK_REMOVE_FILE");
+    tokenNames.put(TOK_MOVE_FILE, "TOK_MOVE_FILE");
   }
 
   static {
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/executor/QueryProcessExecutor.java b/server/src/main/java/org/apache/iotdb/db/qp/executor/QueryProcessExecutor.java
index d3418bc..6fb4956 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/executor/QueryProcessExecutor.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/executor/QueryProcessExecutor.java
@@ -59,6 +59,7 @@ import org.apache.iotdb.db.qp.physical.sys.CreateTimeSeriesPlan;
 import org.apache.iotdb.db.qp.physical.sys.DataAuthPlan;
 import org.apache.iotdb.db.qp.physical.sys.DeleteStorageGroupPlan;
 import org.apache.iotdb.db.qp.physical.sys.DeleteTimeSeriesPlan;
+import org.apache.iotdb.db.qp.physical.sys.OperateFilePlan;
 import org.apache.iotdb.db.qp.physical.sys.PropertyPlan;
 import org.apache.iotdb.db.qp.physical.sys.SetStorageGroupPlan;
 import org.apache.iotdb.db.qp.physical.sys.SetTTLPlan;
@@ -140,12 +141,33 @@ public class QueryProcessExecutor extends AbstractQueryProcessExecutor {
       case LOAD_CONFIGURATION:
         IoTDBDescriptor.getInstance().loadHotModifiedProps();
         return true;
+      case LOAD_FILES:
+        operateLoadFiles((OperateFilePlan) plan);
+        return true;
+      case REMOVE_FILE:
+        operateRemoveFile((OperateFilePlan) plan);
+        return true;
+      case MOVE_FILE:
+        operateMoveFile((OperateFilePlan) plan);
+        return true;
       default:
         throw new UnsupportedOperationException(
             String.format("operation %s is not supported", plan.getOperatorType()));
     }
   }
 
+  private void operateLoadFiles(OperateFilePlan plan){
+
+  }
+
+  private void operateRemoveFile(OperateFilePlan plan){
+
+  }
+
+  private void operateMoveFile(OperateFilePlan plan){
+
+  }
+
   private void operateTTL(SetTTLPlan plan) throws QueryProcessException {
     try {
       MManager.getInstance().setTTL(plan.getStorageGroup(), plan.getDataTTL());
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/logical/Operator.java b/server/src/main/java/org/apache/iotdb/db/qp/logical/Operator.java
index 8c4eeac..50d87bc 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/logical/Operator.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/logical/Operator.java
@@ -74,6 +74,6 @@ public abstract class Operator {
     DELETE_ROLE, GRANT_ROLE_PRIVILEGE, REVOKE_ROLE_PRIVILEGE, LIST_USER, LIST_ROLE,
     LIST_USER_PRIVILEGE, LIST_ROLE_PRIVILEGE, LIST_USER_ROLES, LIST_ROLE_USERS,
     GRANT_WATERMARK_EMBEDDING, REVOKE_WATERMARK_EMBEDDING,
-    TTL, DELETE_STORAGE_GROUP, LOAD_CONFIGURATION, SHOW
+    TTL, DELETE_STORAGE_GROUP, LOAD_CONFIGURATION, SHOW, LOAD_FILES, REMOVE_FILE, MOVE_FILE
   }
 }
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/LoadFilesOperator.java b/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/LoadFilesOperator.java
new file mode 100644
index 0000000..15c2ca9
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/LoadFilesOperator.java
@@ -0,0 +1,38 @@
+/*
+ * 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.qp.logical.sys;
+
+import java.io.File;
+import org.apache.iotdb.db.qp.constant.SQLConstant;
+import org.apache.iotdb.db.qp.logical.RootOperator;
+
+public class LoadFilesOperator extends RootOperator {
+
+  private File file;
+
+  public LoadFilesOperator(File file) {
+    super(SQLConstant.TOK_LOAD_FILES);
+    this.file = file;
+    this.operatorType = OperatorType.LOAD_FILES;
+  }
+
+  public File getFile() {
+    return file;
+  }
+}
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/MoveFileOperator.java b/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/MoveFileOperator.java
new file mode 100644
index 0000000..11f88f9
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/MoveFileOperator.java
@@ -0,0 +1,44 @@
+/*
+ * 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.qp.logical.sys;
+
+import java.io.File;
+import org.apache.iotdb.db.qp.constant.SQLConstant;
+import org.apache.iotdb.db.qp.logical.RootOperator;
+
+public class MoveFileOperator extends RootOperator {
+
+  private File file;
+  private File targetDir;
+
+  public MoveFileOperator(File file, File targetDir) {
+    super(SQLConstant.TOK_MOVE_FILE);
+    this.file = file;
+    this.targetDir = targetDir;
+    this.operatorType = OperatorType.MOVE_FILE;
+  }
+
+  public File getFile() {
+    return file;
+  }
+
+  public File getTargetDir() {
+    return targetDir;
+  }
+}
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/RemoveFileOperator.java b/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/RemoveFileOperator.java
new file mode 100644
index 0000000..845387f
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/RemoveFileOperator.java
@@ -0,0 +1,43 @@
+/*
+ * 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.qp.logical.sys;
+
+import java.io.File;
+import org.apache.iotdb.db.qp.constant.SQLConstant;
+import org.apache.iotdb.db.qp.logical.RootOperator;
+
+public class RemoveFileOperator extends RootOperator {
+
+  private File file;
+
+  public RemoveFileOperator(File file) {
+    super(SQLConstant.TOK_REMOVE_FILE);
+    this.file = file;
+    this.operatorType = OperatorType.REMOVE_FILE;
+  }
+
+  public RemoveFileOperator(int tokenIntType, File file) {
+    super(tokenIntType);
+    this.file = file;
+  }
+
+  public File getFile() {
+    return file;
+  }
+}
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/OperateFilePlan.java b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/OperateFilePlan.java
new file mode 100644
index 0000000..864a432
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/OperateFilePlan.java
@@ -0,0 +1,64 @@
+/*
+ * 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.qp.physical.sys;
+
+import java.io.File;
+import java.util.List;
+import org.apache.iotdb.db.qp.logical.Operator.OperatorType;
+import org.apache.iotdb.db.qp.physical.PhysicalPlan;
+import org.apache.iotdb.tsfile.read.common.Path;
+
+public class OperateFilePlan extends PhysicalPlan {
+
+  private File file;
+  private File targetDir;
+
+  public OperateFilePlan(File file, OperatorType operatorType) {
+    super(false, operatorType);
+    this.file = file;
+  }
+
+  public OperateFilePlan(File file, File targetDir, OperatorType operatorType) {
+    super(false, operatorType);
+    this.file = file;
+    this.targetDir = targetDir;
+  }
+
+  @Override
+  public List<Path> getPaths() {
+    return null;
+  }
+
+  public File getFile() {
+    return file;
+  }
+
+  public File getTargetDir() {
+    return targetDir;
+  }
+
+  @Override
+  public String toString() {
+    return "OperateFilePlan{" +
+        "file=" + file.getPath() +
+        ", targetDir=" + (targetDir == null ? " null":targetDir.getPath()) +
+        ", operatorType=" + getOperatorType() +
+        '}';
+  }
+}
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 a8d4ae0..6fa0805 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
@@ -53,11 +53,14 @@ import static org.apache.iotdb.db.sql.parse.TqlParser.TOK_LINK;
 import static org.apache.iotdb.db.sql.parse.TqlParser.TOK_LIST;
 import static org.apache.iotdb.db.sql.parse.TqlParser.TOK_LOAD;
 import static org.apache.iotdb.db.sql.parse.TqlParser.TOK_LOAD_CONFIGURATION;
+import static org.apache.iotdb.db.sql.parse.TqlParser.TOK_LOAD_FILES;
+import static org.apache.iotdb.db.sql.parse.TqlParser.TOK_MOVE_FILE;
 import static org.apache.iotdb.db.sql.parse.TqlParser.TOK_PATH;
 import static org.apache.iotdb.db.sql.parse.TqlParser.TOK_PREVIOUS;
 import static org.apache.iotdb.db.sql.parse.TqlParser.TOK_PRIVILEGES;
 import static org.apache.iotdb.db.sql.parse.TqlParser.TOK_PROPERTY;
 import static org.apache.iotdb.db.sql.parse.TqlParser.TOK_QUERY;
+import static org.apache.iotdb.db.sql.parse.TqlParser.TOK_REMOVE_FILE;
 import static org.apache.iotdb.db.sql.parse.TqlParser.TOK_REVOKE;
 import static org.apache.iotdb.db.sql.parse.TqlParser.TOK_REVOKE_WATERMARK_EMBEDDING;
 import static org.apache.iotdb.db.sql.parse.TqlParser.TOK_ROLE;
@@ -76,6 +79,7 @@ import static org.apache.iotdb.db.sql.parse.TqlParser.TOK_UPDATE;
 import static org.apache.iotdb.db.sql.parse.TqlParser.TOK_USER;
 import static org.apache.iotdb.db.sql.parse.TqlParser.TOK_WHERE;
 
+import java.io.File;
 import java.time.ZoneId;
 import java.util.ArrayList;
 import java.util.EnumMap;
@@ -108,7 +112,10 @@ import org.apache.iotdb.db.qp.logical.sys.DeleteStorageGroupOperator;
 import org.apache.iotdb.db.qp.logical.sys.DeleteTimeSeriesOperator;
 import org.apache.iotdb.db.qp.logical.sys.LoadConfigurationOperator;
 import org.apache.iotdb.db.qp.logical.sys.LoadDataOperator;
+import org.apache.iotdb.db.qp.logical.sys.LoadFilesOperator;
+import org.apache.iotdb.db.qp.logical.sys.MoveFileOperator;
 import org.apache.iotdb.db.qp.logical.sys.PropertyOperator;
+import org.apache.iotdb.db.qp.logical.sys.RemoveFileOperator;
 import org.apache.iotdb.db.qp.logical.sys.SetStorageGroupOperator;
 import org.apache.iotdb.db.qp.logical.sys.SetTTLOperator;
 import org.apache.iotdb.db.qp.logical.sys.ShowOperator;
@@ -286,6 +293,16 @@ public class LogicalGenerator {
       case TOK_SHOW:
         analyzeShow(astNode);
         return;
+      case TOK_LOAD_FILES:
+        initializedOperator = new LoadFilesOperator(new File(astNode.getChild(0).getText()));
+        return;
+      case TOK_REMOVE_FILE:
+        initializedOperator = new RemoveFileOperator(new File(astNode.getChild(0).getText()));
+        return;
+      case TOK_MOVE_FILE:
+        initializedOperator = new MoveFileOperator(new File(astNode.getChild(0).getText()),
+            new File(astNode.getChild(1).getText()));
+        return;
       default:
         throw new QueryProcessException("Not supported TqlParser type " + token.getText());
     }
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/strategy/PhysicalGenerator.java b/server/src/main/java/org/apache/iotdb/db/qp/strategy/PhysicalGenerator.java
index e4ed293..6ab3eda 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/strategy/PhysicalGenerator.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/strategy/PhysicalGenerator.java
@@ -34,6 +34,7 @@ import org.apache.iotdb.db.exception.query.QueryProcessException;
 import org.apache.iotdb.db.qp.constant.SQLConstant;
 import org.apache.iotdb.db.qp.executor.IQueryProcessExecutor;
 import org.apache.iotdb.db.qp.logical.Operator;
+import org.apache.iotdb.db.qp.logical.Operator.OperatorType;
 import org.apache.iotdb.db.qp.logical.crud.BasicFunctionOperator;
 import org.apache.iotdb.db.qp.logical.crud.DeleteDataOperator;
 import org.apache.iotdb.db.qp.logical.crud.FilterOperator;
@@ -45,7 +46,10 @@ import org.apache.iotdb.db.qp.logical.sys.DataAuthOperator;
 import org.apache.iotdb.db.qp.logical.sys.DeleteStorageGroupOperator;
 import org.apache.iotdb.db.qp.logical.sys.DeleteTimeSeriesOperator;
 import org.apache.iotdb.db.qp.logical.sys.LoadDataOperator;
+import org.apache.iotdb.db.qp.logical.sys.LoadFilesOperator;
+import org.apache.iotdb.db.qp.logical.sys.MoveFileOperator;
 import org.apache.iotdb.db.qp.logical.sys.PropertyOperator;
+import org.apache.iotdb.db.qp.logical.sys.RemoveFileOperator;
 import org.apache.iotdb.db.qp.logical.sys.SetStorageGroupOperator;
 import org.apache.iotdb.db.qp.logical.sys.SetTTLOperator;
 import org.apache.iotdb.db.qp.logical.sys.ShowTTLOperator;
@@ -63,6 +67,7 @@ import org.apache.iotdb.db.qp.physical.sys.DeleteStorageGroupPlan;
 import org.apache.iotdb.db.qp.physical.sys.DeleteTimeSeriesPlan;
 import org.apache.iotdb.db.qp.physical.sys.LoadConfigurationPlan;
 import org.apache.iotdb.db.qp.physical.sys.LoadDataPlan;
+import org.apache.iotdb.db.qp.physical.sys.OperateFilePlan;
 import org.apache.iotdb.db.qp.physical.sys.PropertyPlan;
 import org.apache.iotdb.db.qp.physical.sys.SetStorageGroupPlan;
 import org.apache.iotdb.db.qp.physical.sys.SetTTLPlan;
@@ -167,6 +172,13 @@ public class PhysicalGenerator {
             throw new LogicalOperatorException(String
                 .format("not supported operator type %s in show operation.", operator.getType()));
         }
+      case LOAD_FILES:
+        return new OperateFilePlan(((LoadFilesOperator)operator).getFile(), OperatorType.LOAD_FILES);
+      case REMOVE_FILE:
+        return new OperateFilePlan(((RemoveFileOperator)operator).getFile(), OperatorType.REMOVE_FILE);
+      case MOVE_FILE:
+        return new OperateFilePlan(((MoveFileOperator) operator).getFile(),
+            ((MoveFileOperator) operator).getTargetDir(), OperatorType.MOVE_FILE);
       default:
         throw new LogicalOperatorException(operator.getType().toString(), "");
     }
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 2877bef..a67dd74 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
@@ -36,6 +36,7 @@ import org.apache.iotdb.db.qp.physical.sys.AuthorPlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateTimeSeriesPlan;
 import org.apache.iotdb.db.qp.physical.sys.DataAuthPlan;
 import org.apache.iotdb.db.qp.physical.sys.LoadConfigurationPlan;
+import org.apache.iotdb.db.qp.physical.sys.OperateFilePlan;
 import org.apache.iotdb.db.qp.physical.sys.PropertyPlan;
 import org.apache.iotdb.db.qp.physical.sys.ShowPlan;
 import org.apache.iotdb.db.qp.utils.MemIntQpExecutor;
@@ -511,4 +512,50 @@ public class PhysicalPlanTest {
     ShowPlan plan = (ShowPlan) processor.parseSQLToPhysicalPlan(metadata);
     assertEquals("SHOW FLUSH_TASK_INFO", plan.toString());
   }
+
+  @Test
+  public void testLoadFiles() throws QueryProcessException, MetadataException {
+    String metadata = "load /user/iotdb/data/213213441243-1-2.tsfile";
+    QueryProcessor processor = new QueryProcessor(new MemIntQpExecutor());
+    OperateFilePlan plan = (OperateFilePlan) processor.parseSQLToPhysicalPlan(metadata);
+    assertEquals(
+        "OperateFilePlan{file=/user/iotdb/data/213213441243-1-2.tsfile, targetDir= null, operatorType=LOAD_FILES}",
+        plan.toString());
+    metadata = "load C:\\\\iotdb\\\\data\\\\213213441243-1-2.tsfile";
+    plan = (OperateFilePlan) processor.parseSQLToPhysicalPlan(metadata);
+    assertEquals(
+        "OperateFilePlan{file=C:\\\\iotdb\\\\data\\\\213213441243-1-2.tsfile, targetDir= null, operatorType=LOAD_FILES}",
+        plan.toString());
+  }
+
+  @Test
+  public void testRemoveFile() throws QueryProcessException, MetadataException {
+    String metadata = "remove /user/iotdb/data/213213441243-1-2.tsfile";
+    QueryProcessor processor = new QueryProcessor(new MemIntQpExecutor());
+    OperateFilePlan plan = (OperateFilePlan) processor.parseSQLToPhysicalPlan(metadata);
+    assertEquals(
+        "OperateFilePlan{file=/user/iotdb/data/213213441243-1-2.tsfile, targetDir= null, operatorType=REMOVE_FILE}",
+        plan.toString());
+    metadata = "remove C:\\\\iotdb\\\\data\\\\213213441243-1-2.tsfile";
+    plan = (OperateFilePlan) processor.parseSQLToPhysicalPlan(metadata);
+    assertEquals(
+        "OperateFilePlan{file=C:\\\\iotdb\\\\data\\\\213213441243-1-2.tsfile, targetDir= null, operatorType=REMOVE_FILE}",
+        plan.toString());
+
+  }
+
+  @Test
+  public void testMoveFile() throws QueryProcessException, MetadataException {
+    String metadata = "move /user/iotdb/data/213213441243-1-2.tsfile /user/backup";
+    QueryProcessor processor = new QueryProcessor(new MemIntQpExecutor());
+    OperateFilePlan plan = (OperateFilePlan) processor.parseSQLToPhysicalPlan(metadata);
+    assertEquals(
+        "OperateFilePlan{file=/user/iotdb/data/213213441243-1-2.tsfile, targetDir=/user/backup, operatorType=MOVE_FILE}",
+        plan.toString());
+    metadata = "move C:\\\\iotdb\\\\data\\\\213213441243-1-2.tsfile C:\\\\backup";
+    plan = (OperateFilePlan) processor.parseSQLToPhysicalPlan(metadata);
+    assertEquals(
+        "OperateFilePlan{file=C:\\\\iotdb\\\\data\\\\213213441243-1-2.tsfile, targetDir=C:\\\\backup, operatorType=MOVE_FILE}",
+        plan.toString());
+  }
 }