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/08 06:59:11 UTC
[incubator-iotdb] 03/03: add load configuration in anltr
This is an automated email from the ASF dual-hosted git repository.
lta pushed a commit to branch add_hot_load_configuration
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git
commit cba5533720e0c37242ba3e52a62aaa29ffd63656
Author: lta <li...@163.com>
AuthorDate: Fri Nov 8 14:21:20 2019 +0800
add load configuration in anltr
---
.../org/apache/iotdb/db/sql/parse/TqlLexer.g | 4 ++
.../org/apache/iotdb/db/sql/parse/TqlParser.g | 34 ++++++++++-------
.../org/apache/iotdb/db/qp/QueryProcessor.java | 34 ++++++-----------
.../apache/iotdb/db/qp/constant/SQLConstant.java | 3 ++
.../iotdb/db/qp/executor/QueryProcessExecutor.java | 31 ++++++++++------
.../org/apache/iotdb/db/qp/logical/Operator.java | 2 +-
.../qp/logical/sys/LoadConfigurationOperator.java | 31 ++++++++++++++++
.../db/qp/physical/sys/LoadConfigurationPlan.java | 43 ++++++++++++++++++++++
.../iotdb/db/qp/strategy/LogicalGenerator.java | 8 +++-
.../iotdb/db/qp/strategy/PhysicalGenerator.java | 20 ++++++----
.../apache/iotdb/db/qp/plan/PhysicalPlanTest.java | 10 +++++
11 files changed, 161 insertions(+), 59 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 c49fb6f..6a00dde 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
@@ -273,6 +273,10 @@ K_UNSET
: U N S E T
;
+K_CONFIGURATION
+ : C O N F I G U R A T I O N
+ ;
+
//************** logical operator***********
OPERATOR_AND
: A N D
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 734adc2..9f420c4 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
@@ -107,6 +107,7 @@ tokens{
TOK_SHOW;
TOK_DATE_EXPR;
TOK_DURATION;
+ TOK_LOAD_CONFIGURATION;
}
@header{
@@ -121,13 +122,13 @@ ArrayList<ParseError> errors = new ArrayList<ParseError>();
Stack messages = new Stack<String>();
private static HashMap<String, String> tokenNameMap;
static {
- tokenNameMap = new HashMap<String, String>();
- tokenNameMap.put("K_AND", "AND");
- tokenNameMap.put("K_OR", "OR");
- tokenNameMap.put("K_NOT", "NOT");
- tokenNameMap.put("K_LIKE", "LIKE");
- tokenNameMap.put("K_BY", "BY");
- tokenNameMap.put("K_GROUP", "GROUP");
+ tokenNameMap = new HashMap<String, String>();
+ tokenNameMap.put("K_AND", "AND");
+ tokenNameMap.put("K_OR", "OR");
+ tokenNameMap.put("K_NOT", "NOT");
+ tokenNameMap.put("K_LIKE", "LIKE");
+ tokenNameMap.put("K_BY", "BY");
+ tokenNameMap.put("K_GROUP", "GROUP");
tokenNameMap.put("K_FILL", "FILL");
tokenNameMap.put("K_LINEAR", "LINEAR");
tokenNameMap.put("K_PREVIOUS", "PREVIOUS");
@@ -274,6 +275,7 @@ sqlStatement
: ddlStatement
| dmlStatement
| administrationStatement
+ | configurationStatement
;
dmlStatement
@@ -754,6 +756,15 @@ rootOrId
| ID
;
+configurationStatement
+ : loadConfigurationStatement
+ ;
+
+loadConfigurationStatement
+ : K_LOAD K_CONFIGURATION
+ -> ^(TOK_LOAD_CONFIGURATION)
+ ;
+
/*
****
*************
@@ -763,21 +774,18 @@ TTL
*/
ttlStatement
- :
- setTTLStatement
+ : setTTLStatement
| unsetTTLStatement
| showTTLStatement
;
setTTLStatement
- :
- K_SET K_TTL K_TO path=prefixPath time=INT
+ : K_SET K_TTL K_TO path=prefixPath time=INT
-> ^(TOK_TTL TOK_SET $path $time)
;
unsetTTLStatement
- :
- K_UNSET K_TTL K_TO path=prefixPath
+ : K_UNSET K_TTL K_TO path=prefixPath
-> ^(TOK_TTL TOK_UNSET $path)
;
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 4feb85d..c39d44a 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
@@ -18,9 +18,9 @@
*/
package org.apache.iotdb.db.qp;
+import java.time.ZoneId;
import org.apache.iotdb.db.conf.IoTDBConfig;
import org.apache.iotdb.db.conf.IoTDBDescriptor;
-import org.apache.iotdb.db.exception.ArgsErrorException;
import org.apache.iotdb.db.exception.MetadataErrorException;
import org.apache.iotdb.db.exception.qp.IllegalASTFormatException;
import org.apache.iotdb.db.exception.qp.LogicalOperatorException;
@@ -43,8 +43,6 @@ import org.apache.iotdb.db.sql.parse.AstNode;
import org.apache.iotdb.db.sql.parse.ParseException;
import org.apache.iotdb.db.sql.parse.ParseUtils;
-import java.time.ZoneId;
-
/**
* provide a integration method for other user.
*/
@@ -61,8 +59,7 @@ public class QueryProcessor {
}
public PhysicalPlan parseSQLToPhysicalPlan(String sqlStr)
- throws QueryProcessorException, ArgsErrorException,
- MetadataErrorException {
+ throws QueryProcessorException, MetadataErrorException {
IoTDBConfig config = IoTDBDescriptor.getInstance().getConfig();
return parseSQLToPhysicalPlan(sqlStr, config.getZoneID());
}
@@ -79,11 +76,9 @@ public class QueryProcessor {
/**
* Convert ast tree to Operator which type maybe {@code SFWOperator} or {@code AuthorOperator}
*
- * @param astNode
- * - input ast tree
+ * @param astNode - input ast tree
* @return - RootOperator has four subclass:Query/Insert/Delete/Update/Author
- * @throws QueryProcessorException
- * exception in converting sql to operator
+ * @throws QueryProcessorException exception in converting sql to operator
*/
private RootOperator parseASTToOperator(AstNode astNode, ZoneId zoneId)
throws QueryProcessorException, MetadataErrorException {
@@ -94,11 +89,9 @@ public class QueryProcessor {
/**
* Given a SQL statement and generate an ast tree
*
- * @param sqlStr
- * input sql command
+ * @param sqlStr input sql command
* @return ast tree
- * @throws IllegalASTFormatException
- * exception in sql parsing
+ * @throws IllegalASTFormatException exception in sql parsing
*/
private AstNode parseSQLToAST(String sqlStr) throws IllegalASTFormatException {
AstNode astTree;
@@ -115,12 +108,9 @@ public class QueryProcessor {
/**
* given an unoptimized logical operator tree and return a optimized result.
*
- * @param operator
- * unoptimized logical operator
- * @param executor
+ * @param operator unoptimized logical operator
* @return optimized logical operator
- * @throws LogicalOptimizeException
- * exception in logical optimizing
+ * @throws LogicalOptimizeException exception in logical optimizing
*/
private Operator logicalOptimize(Operator operator, IQueryProcessExecutor executor)
throws LogicalOperatorException {
@@ -139,6 +129,7 @@ public class QueryProcessor {
case GRANT_WATERMARK_EMBEDDING:
case REVOKE_WATERMARK_EMBEDDING:
case TTL:
+ case LOAD_CONFIGURATION:
return operator;
case QUERY:
case UPDATE:
@@ -153,12 +144,9 @@ public class QueryProcessor {
/**
* given an unoptimized select-from-where operator and return an optimized result.
*
- * @param root
- * unoptimized select-from-where operator
- * @param executor
+ * @param root unoptimized select-from-where operator
* @return optimized select-from-where operator
- * @throws LogicalOptimizeException
- * exception in SFW optimizing
+ * @throws LogicalOptimizeException exception in SFW optimizing
*/
private SFWOperator optimizeSFWOperator(SFWOperator root, IQueryProcessExecutor executor)
throws LogicalOperatorException {
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 8479e7a..adc63f6 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
@@ -102,6 +102,7 @@ public class SQLConstant {
public static final int TOK_SET = 63;
public static final int TOK_UNSET = 64;
public static final int TOK_SHOW = 65;
+ public static final int TOK_LOAD_CONFIGURATION = 66;
public static final Map<Integer, String> tokenSymbol = new HashMap<>();
public static final Map<Integer, String> tokenNames = new HashMap<>();
@@ -161,6 +162,8 @@ public class SQLConstant {
tokenNames.put(TOK_SET, "TOK_SET");
tokenNames.put(TOK_UNSET, "TOK_UNSET");
tokenNames.put(TOK_SHOW, "TOK_SHOW");
+
+ tokenNames.put(TOK_LOAD_CONFIGURATION, "TOK_LOAD_CONFIGURATION");
}
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 d3d6b64..779fec3 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
@@ -54,14 +54,14 @@ import org.apache.iotdb.db.qp.physical.crud.BatchInsertPlan;
import org.apache.iotdb.db.qp.physical.crud.DeletePlan;
import org.apache.iotdb.db.qp.physical.crud.InsertPlan;
import org.apache.iotdb.db.qp.physical.crud.UpdatePlan;
-import org.apache.iotdb.db.qp.physical.sys.CreateTimeSeriesPlan;
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.DeleteTimeSeriesPlan;
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.PropertyPlan;
-import org.apache.iotdb.db.qp.physical.sys.SetTTLPlan;
import org.apache.iotdb.db.qp.physical.sys.SetStorageGroupPlan;
+import org.apache.iotdb.db.qp.physical.sys.SetTTLPlan;
import org.apache.iotdb.db.query.context.QueryContext;
import org.apache.iotdb.db.query.dataset.ListDataSet;
import org.apache.iotdb.db.query.fill.IFill;
@@ -130,13 +130,16 @@ public class QueryProcessExecutor extends AbstractQueryProcessExecutor {
case SET_STORAGE_GROUP:
return setStorageGroup((SetStorageGroupPlan) plan);
case DELETE_STORAGE_GROUP:
- return deleteStorageGroup((DeleteStorageGroupPlan) plan);
+ return deleteStorageGroup((DeleteStorageGroupPlan) plan);
case PROPERTY:
PropertyPlan property = (PropertyPlan) plan;
return operateProperty(property);
case TTL:
operateTTL((SetTTLPlan) plan);
return true;
+ case LOAD_CONFIGURATION:
+ IoTDBDescriptor.getInstance().loadHotModifiedProps();
+ return true;
default:
throw new UnsupportedOperationException(
String.format("operation %s is not supported", plan.getOperatorType()));
@@ -384,8 +387,9 @@ public class QueryProcessExecutor extends AbstractQueryProcessExecutor {
}
return true;
}
-
- private boolean createTimeSeries(CreateTimeSeriesPlan createTimeSeriesPlan) throws ProcessorException {
+
+ private boolean createTimeSeries(CreateTimeSeriesPlan createTimeSeriesPlan)
+ throws ProcessorException {
Path path = createTimeSeriesPlan.getPath();
TSDataType dataType = createTimeSeriesPlan.getDataType();
CompressionType compressor = createTimeSeriesPlan.getCompressor();
@@ -401,8 +405,9 @@ public class QueryProcessExecutor extends AbstractQueryProcessExecutor {
}
return true;
}
-
- private boolean deleteTimeSeries(DeleteTimeSeriesPlan deleteTimeSeriesPlan) throws ProcessorException {
+
+ private boolean deleteTimeSeries(DeleteTimeSeriesPlan deleteTimeSeriesPlan)
+ throws ProcessorException {
List<Path> deletePathList = deleteTimeSeriesPlan.getPaths();
try {
deleteDataOfTimeSeries(deletePathList);
@@ -415,8 +420,9 @@ public class QueryProcessExecutor extends AbstractQueryProcessExecutor {
}
return true;
}
-
- private boolean setStorageGroup(SetStorageGroupPlan setStorageGroupPlan) throws ProcessorException {
+
+ private boolean setStorageGroup(SetStorageGroupPlan setStorageGroupPlan)
+ throws ProcessorException {
Path path = setStorageGroupPlan.getPath();
try {
mManager.setStorageGroupToMTree(path.getFullPath());
@@ -425,8 +431,9 @@ public class QueryProcessExecutor extends AbstractQueryProcessExecutor {
}
return true;
}
-
- private boolean deleteStorageGroup(DeleteStorageGroupPlan deleteStorageGroupPlan) throws ProcessorException {
+
+ private boolean deleteStorageGroup(DeleteStorageGroupPlan deleteStorageGroupPlan)
+ throws ProcessorException {
List<Path> deletePathList = deleteStorageGroupPlan.getPaths();
try {
mManager.deleteStorageGroupsFromMTree(deletePathList);
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 8b889a8..06fc4be 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
+ TTL, DELETE_STORAGE_GROUP, LOAD_CONFIGURATION
}
}
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/LoadConfigurationOperator.java b/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/LoadConfigurationOperator.java
new file mode 100644
index 0000000..18ad4ae
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/LoadConfigurationOperator.java
@@ -0,0 +1,31 @@
+/*
+ * 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 org.apache.iotdb.db.qp.constant.SQLConstant;
+import org.apache.iotdb.db.qp.logical.RootOperator;
+
+public class LoadConfigurationOperator extends RootOperator {
+
+ public LoadConfigurationOperator() {
+ super(SQLConstant.TOK_LOAD_CONFIGURATION);
+ this.operatorType = OperatorType.LOAD_CONFIGURATION;
+ }
+}
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/LoadConfigurationPlan.java b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/LoadConfigurationPlan.java
new file mode 100644
index 0000000..ae0f77e
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/LoadConfigurationPlan.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.physical.sys;
+
+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 LoadConfigurationPlan extends PhysicalPlan {
+
+ public LoadConfigurationPlan() {
+ super(false);
+ this.setOperatorType(OperatorType.LOAD_CONFIGURATION);
+ }
+
+ @Override
+ public List<Path> getPaths() {
+ return null;
+ }
+
+ @Override
+ public String toString() {
+ return getOperatorType().toString();
+ }
+}
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 cca6ec0..1d24406 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
@@ -50,6 +50,7 @@ import static org.apache.iotdb.db.sql.parse.TqlParser.TOK_LINEAR;
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_PATH;
import static org.apache.iotdb.db.sql.parse.TqlParser.TOK_PREVIOUS;
import static org.apache.iotdb.db.sql.parse.TqlParser.TOK_PRIVILEGES;
@@ -103,6 +104,7 @@ import org.apache.iotdb.db.qp.logical.sys.CreateTimeSeriesOperator;
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.LoadConfigurationOperator;
import org.apache.iotdb.db.qp.logical.sys.LoadDataOperator;
import org.apache.iotdb.db.qp.logical.sys.PropertyOperator;
import org.apache.iotdb.db.qp.logical.sys.SetStorageGroupOperator;
@@ -274,6 +276,9 @@ public class LogicalGenerator {
case TOK_GROUPBY_DEVICE:
((QueryOperator) initializedOperator).setGroupByDevice(true);
return;
+ case TOK_LOAD_CONFIGURATION:
+ initializedOperator = new LoadConfigurationOperator();
+ return;
default:
throw new QueryProcessorException("Not supported TqlParser type " + token.getText());
}
@@ -301,8 +306,7 @@ public class LogicalGenerator {
private void analyzeSetTTL(AstNode astNode) {
String path = parsePath(astNode.getChild(1)).getFullPath();
- long dataTTL;
- dataTTL = Long.parseLong(astNode.getChild(2).getText());
+ long dataTTL = Long.parseLong(astNode.getChild(2).getText());
SetTTLOperator operator = new SetTTLOperator(SQLConstant.TOK_SET);
initializedOperator = operator;
operator.setStorageGroup(path);
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 5658e18..874c937 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
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.iotdb.db.qp.strategy;
import java.util.ArrayList;
@@ -40,16 +39,16 @@ import org.apache.iotdb.db.qp.logical.crud.DeleteDataOperator;
import org.apache.iotdb.db.qp.logical.crud.FilterOperator;
import org.apache.iotdb.db.qp.logical.crud.InsertOperator;
import org.apache.iotdb.db.qp.logical.crud.QueryOperator;
-import org.apache.iotdb.db.qp.logical.sys.CreateTimeSeriesOperator;
import org.apache.iotdb.db.qp.logical.sys.AuthorOperator;
+import org.apache.iotdb.db.qp.logical.sys.CreateTimeSeriesOperator;
import org.apache.iotdb.db.qp.logical.sys.DataAuthOperator;
-import org.apache.iotdb.db.qp.logical.sys.DeleteTimeSeriesOperator;
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.PropertyOperator;
+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;
-import org.apache.iotdb.db.qp.logical.sys.SetStorageGroupOperator;
import org.apache.iotdb.db.qp.physical.PhysicalPlan;
import org.apache.iotdb.db.qp.physical.crud.AggregationPlan;
import org.apache.iotdb.db.qp.physical.crud.DeletePlan;
@@ -57,16 +56,17 @@ import org.apache.iotdb.db.qp.physical.crud.FillQueryPlan;
import org.apache.iotdb.db.qp.physical.crud.GroupByPlan;
import org.apache.iotdb.db.qp.physical.crud.InsertPlan;
import org.apache.iotdb.db.qp.physical.crud.QueryPlan;
-import org.apache.iotdb.db.qp.physical.sys.CreateTimeSeriesPlan;
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.DeleteTimeSeriesPlan;
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.PropertyPlan;
+import org.apache.iotdb.db.qp.physical.sys.SetStorageGroupPlan;
import org.apache.iotdb.db.qp.physical.sys.SetTTLPlan;
import org.apache.iotdb.db.qp.physical.sys.ShowTTLPlan;
-import org.apache.iotdb.db.qp.physical.sys.SetStorageGroupPlan;
import org.apache.iotdb.db.service.TSServiceImpl;
import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
import org.apache.iotdb.tsfile.read.common.Path;
@@ -149,8 +149,12 @@ public class PhysicalGenerator {
case SQLConstant.TOK_SHOW:
ShowTTLOperator showTTLOperator = (ShowTTLOperator) operator;
return new ShowTTLPlan(showTTLOperator.getStorageGroups());
+ default:
+ throw new LogicalOperatorException(String
+ .format("not supported operator type %s in ttl operation.", operator.getType()));
}
-
+ case LOAD_CONFIGURATION:
+ return new LoadConfigurationPlan();
default:
throw new LogicalOperatorException("not supported operator type: " + operator.getType());
}
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 09ad27a..3297fb0 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
@@ -37,6 +37,7 @@ import org.apache.iotdb.db.qp.physical.crud.QueryPlan;
import org.apache.iotdb.db.qp.physical.sys.CreateTimeSeriesPlan;
import org.apache.iotdb.db.qp.physical.sys.AuthorPlan;
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.PropertyPlan;
import org.apache.iotdb.db.qp.utils.MemIntQpExecutor;
import org.apache.iotdb.db.query.fill.LinearFill;
@@ -487,4 +488,13 @@ public class PhysicalPlanTest {
Assert.assertEquals(2, dataAuthPlan.getUsers().size());
Assert.assertEquals(OperatorType.REVOKE_WATERMARK_EMBEDDING, dataAuthPlan.getOperatorType());
}
+
+ @Test
+ public void testConfiguration()
+ throws QueryProcessorException, MetadataErrorException {
+ String metadata = "load configuration";
+ QueryProcessor processor = new QueryProcessor(new MemIntQpExecutor());
+ LoadConfigurationPlan plan = (LoadConfigurationPlan) processor.parseSQLToPhysicalPlan(metadata);
+ assertEquals("LOAD_CONFIGURATION", plan.toString());
+ }
}