This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a commit to branch new_vector
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/new_vector by this push:
new a3ad58e [IOTDB-1915] [To new_vector] Refactor the interaction with
MManager while generating the query plan (#4348)
a3ad58e is described below
commit a3ad58e6b10685962641d304998ea27853de14e1
Author: liuminghui233 <[email protected]>
AuthorDate: Thu Nov 11 15:24:31 2021 +0800
[IOTDB-1915] [To new_vector] Refactor the interaction with MManager while
generating the query plan (#4348)
---
.../query/ClusterDataQueryExecutorTest.java | 5 --
.../groupby/ClusterGroupByVFilterDataSetTest.java | 2 -
.../query/reader/ClusterTimeGeneratorTest.java | 7 +-
.../org/apache/iotdb/db/auth/AuthorityChecker.java | 5 +-
.../org/apache/iotdb/db/metadata/MManager.java | 11 ---
.../iotdb/db/metadata/path/MeasurementPath.java | 12 +++
.../apache/iotdb/db/metadata/path/PartialPath.java | 8 +-
.../db/qp/logical/crud/BasicFunctionOperator.java | 4 +-
.../iotdb/db/qp/logical/crud/FilterOperator.java | 5 +-
.../iotdb/db/qp/logical/crud/FunctionOperator.java | 3 +-
.../iotdb/db/qp/logical/crud/InOperator.java | 6 +-
.../iotdb/db/qp/logical/crud/LikeOperator.java | 3 +-
.../iotdb/db/qp/logical/crud/QueryOperator.java | 77 ++++++++---------
.../iotdb/db/qp/logical/crud/RegexpOperator.java | 3 +-
.../apache/iotdb/db/qp/physical/PhysicalPlan.java | 2 +-
.../db/qp/physical/crud/AlignByDevicePlan.java | 11 +++
.../iotdb/db/qp/physical/crud/LastQueryPlan.java | 1 -
.../iotdb/db/qp/physical/crud/QueryPlan.java | 24 ++++--
.../db/qp/physical/crud/RawDataQueryPlan.java | 37 +++-----
.../iotdb/db/qp/physical/crud/SelectIntoPlan.java | 3 +-
.../apache/iotdb/db/qp/physical/crud/UDTFPlan.java | 7 --
.../iotdb/db/qp/strategy/PhysicalGenerator.java | 6 --
.../qp/strategy/optimizer/ConcatPathOptimizer.java | 14 +--
.../apache/iotdb/db/qp/utils/WildcardsRemover.java | 7 +-
.../db/query/dataset/AlignByDeviceDataSet.java | 7 +-
.../db/query/executor/RawDataQueryExecutor.java | 6 +-
.../org/apache/iotdb/db/service/TSServiceImpl.java | 20 ++---
.../org/apache/iotdb/db/utils/SchemaUtils.java | 14 ++-
.../engine/compaction/cross/MergeOverLapTest.java | 7 +-
.../db/engine/compaction/cross/MergeTaskTest.java | 34 ++++----
.../inner/InnerCompactionMoreDataTest.java | 9 +-
.../SizeTieredCompactionRecoverTest.java | 46 +++++-----
.../engine/modification/DeletionFileNodeTest.java | 15 ++--
.../db/engine/modification/DeletionQueryTest.java | 99 +++++++++++-----------
.../iotdb/db/engine/storagegroup/TTLTest.java | 12 ++-
.../db/integration/IoTDBEngineTimeGeneratorIT.java | 40 +++++----
.../iotdb/db/integration/IoTDBMultiSeriesIT.java | 2 +-
.../db/integration/IoTDBSequenceDataQueryIT.java | 89 +++++++++----------
.../iotdb/db/integration/IoTDBSeriesReaderIT.java | 81 ++++++++----------
.../iotdb/db/qp/physical/PhysicalPlanTest.java | 2 +-
.../reader/series/SeriesAggregateReaderTest.java | 9 +-
.../reader/series/SeriesReaderByTimestampTest.java | 7 +-
.../org/apache/iotdb/db/utils/SchemaTestUtils.java | 39 +++++++++
43 files changed, 410 insertions(+), 391 deletions(-)
diff --git
a/cluster/src/test/java/org/apache/iotdb/cluster/query/ClusterDataQueryExecutorTest.java
b/cluster/src/test/java/org/apache/iotdb/cluster/query/ClusterDataQueryExecutorTest.java
index f4da2e5..e35bb68 100644
---
a/cluster/src/test/java/org/apache/iotdb/cluster/query/ClusterDataQueryExecutorTest.java
+++
b/cluster/src/test/java/org/apache/iotdb/cluster/query/ClusterDataQueryExecutorTest.java
@@ -63,7 +63,6 @@ public class ClusterDataQueryExecutorTest extends
BaseQueryTest {
public void testNoFilter() throws IOException, StorageEngineException {
RawDataQueryPlan plan = new RawDataQueryPlan();
plan.setDeduplicatedPathsAndUpdate(pathList);
- plan.setDeduplicatedDataTypes(dataTypes);
queryExecutor = new ClusterDataQueryExecutor(plan, testMetaMember);
RemoteQueryContext context =
new
RemoteQueryContext(QueryResourceManager.getInstance().assignQueryId(true));
@@ -83,7 +82,6 @@ public class ClusterDataQueryExecutorTest extends
BaseQueryTest {
new PartialPath(TestUtils.getTestSeries(0, 0)),
ValueFilter.gtEq(5.0));
RawDataQueryPlan plan = new RawDataQueryPlan();
plan.setDeduplicatedPathsAndUpdate(pathList);
- plan.setDeduplicatedDataTypes(dataTypes);
plan.setExpression(expression);
queryExecutor = new ClusterDataQueryExecutor(plan, testMetaMember);
RemoteQueryContext context =
@@ -100,7 +98,6 @@ public class ClusterDataQueryExecutorTest extends
BaseQueryTest {
public void testNoFilterWithRedirect() throws StorageEngineException {
RawDataQueryPlan plan = new RawDataQueryPlan();
plan.setDeduplicatedPathsAndUpdate(pathList);
- plan.setDeduplicatedDataTypes(dataTypes);
plan.setEnableRedirect(true);
queryExecutor = new ClusterDataQueryExecutor(plan, testMetaMember);
RemoteQueryContext context =
@@ -121,7 +118,6 @@ public class ClusterDataQueryExecutorTest extends
BaseQueryTest {
new PartialPath(TestUtils.getTestSeries(0, 0)),
ValueFilter.gtEq(5.0));
RawDataQueryPlan plan = new RawDataQueryPlan();
plan.setDeduplicatedPathsAndUpdate(pathList);
- plan.setDeduplicatedDataTypes(dataTypes);
plan.setExpression(expression);
plan.setEnableRedirect(true);
queryExecutor = new ClusterDataQueryExecutor(plan, testMetaMember);
@@ -142,7 +138,6 @@ public class ClusterDataQueryExecutorTest extends
BaseQueryTest {
new GlobalTimeExpression(new AndFilter(TimeFilter.gtEq(5),
TimeFilter.ltEq(10)));
RawDataQueryPlan plan = new RawDataQueryPlan();
plan.setDeduplicatedPathsAndUpdate(pathList.subList(0, 1));
- plan.setDeduplicatedDataTypes(dataTypes.subList(0, 1));
plan.setExpression(expression);
plan.setEnableRedirect(true);
queryExecutor = new ClusterDataQueryExecutor(plan, testMetaMember);
diff --git
a/cluster/src/test/java/org/apache/iotdb/cluster/query/groupby/ClusterGroupByVFilterDataSetTest.java
b/cluster/src/test/java/org/apache/iotdb/cluster/query/groupby/ClusterGroupByVFilterDataSetTest.java
index 41e08c4..740ae0a 100644
---
a/cluster/src/test/java/org/apache/iotdb/cluster/query/groupby/ClusterGroupByVFilterDataSetTest.java
+++
b/cluster/src/test/java/org/apache/iotdb/cluster/query/groupby/ClusterGroupByVFilterDataSetTest.java
@@ -64,8 +64,6 @@ public class ClusterGroupByVFilterDataSetTest extends
BaseQueryTest {
}
groupByPlan.setPaths(pathList);
groupByPlan.setDeduplicatedPathsAndUpdate(pathList);
- groupByPlan.setDataTypes(dataTypes);
- groupByPlan.setDeduplicatedDataTypes(dataTypes);
groupByPlan.setAggregations(aggregations);
groupByPlan.setDeduplicatedAggregations(aggregations);
diff --git
a/cluster/src/test/java/org/apache/iotdb/cluster/query/reader/ClusterTimeGeneratorTest.java
b/cluster/src/test/java/org/apache/iotdb/cluster/query/reader/ClusterTimeGeneratorTest.java
index 7e3c95b..3946631 100644
---
a/cluster/src/test/java/org/apache/iotdb/cluster/query/reader/ClusterTimeGeneratorTest.java
+++
b/cluster/src/test/java/org/apache/iotdb/cluster/query/reader/ClusterTimeGeneratorTest.java
@@ -26,6 +26,7 @@ import org.apache.iotdb.cluster.query.RemoteQueryContext;
import org.apache.iotdb.db.exception.StorageEngineException;
import org.apache.iotdb.db.exception.metadata.IllegalPathException;
import org.apache.iotdb.db.exception.query.QueryProcessException;
+import org.apache.iotdb.db.metadata.path.MeasurementPath;
import org.apache.iotdb.db.metadata.path.PartialPath;
import org.apache.iotdb.db.qp.physical.crud.RawDataQueryPlan;
import org.apache.iotdb.db.query.context.QueryContext;
@@ -66,8 +67,8 @@ public class ClusterTimeGeneratorTest extends BaseQueryTest {
new SingleSeriesExpression(
new PartialPath(TestUtils.getTestSeries(1, 1)),
ValueFilter.ltEq(8.0)));
dataQueryPlan.setExpression(expression);
- dataQueryPlan.addDeduplicatedPaths(new
PartialPath(TestUtils.getTestSeries(0, 0)));
- dataQueryPlan.addDeduplicatedPaths(new
PartialPath(TestUtils.getTestSeries(1, 1)));
+ dataQueryPlan.addDeduplicatedPaths(new
MeasurementPath(TestUtils.getTestSeries(0, 0)));
+ dataQueryPlan.addDeduplicatedPaths(new
MeasurementPath(TestUtils.getTestSeries(1, 1)));
ClusterTimeGenerator timeGenerator =
new ClusterTimeGenerator(context, testMetaMember, dataQueryPlan,
false);
@@ -95,7 +96,7 @@ public class ClusterTimeGeneratorTest extends BaseQueryTest {
new PartialPath(TestUtils.getTestSeries(0, 0)),
new AndFilter(valueFilter, timeFilter));
dataQueryPlan.setExpression(expression);
- dataQueryPlan.addDeduplicatedPaths(new
PartialPath(TestUtils.getTestSeries(0, 0)));
+ dataQueryPlan.addDeduplicatedPaths(new
MeasurementPath(TestUtils.getTestSeries(0, 0)));
// capture the time filter used to create a reader
AtomicReference<Filter> timeFilterRef = new AtomicReference<>(null);
diff --git
a/server/src/main/java/org/apache/iotdb/db/auth/AuthorityChecker.java
b/server/src/main/java/org/apache/iotdb/db/auth/AuthorityChecker.java
index 02d8b9d..9f64526 100644
--- a/server/src/main/java/org/apache/iotdb/db/auth/AuthorityChecker.java
+++ b/server/src/main/java/org/apache/iotdb/db/auth/AuthorityChecker.java
@@ -49,7 +49,10 @@ public class AuthorityChecker {
* @throws AuthException Authentication Exception
*/
public static boolean check(
- String username, List<PartialPath> paths, Operator.OperatorType type,
String targetUser)
+ String username,
+ List<? extends PartialPath> paths,
+ Operator.OperatorType type,
+ String targetUser)
throws AuthException {
if (SUPER_USER.equals(username)) {
return true;
diff --git a/server/src/main/java/org/apache/iotdb/db/metadata/MManager.java
b/server/src/main/java/org/apache/iotdb/db/metadata/MManager.java
index b957209..9edce98 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/MManager.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/MManager.java
@@ -1189,17 +1189,6 @@ public class MManager {
if (fullPath.equals(SQLConstant.TIME_PATH)) {
return TSDataType.INT64;
}
-
- // todo eliminate this after Query interaction refactor
- try {
- IMeasurementSchema schema = fullPath.getMeasurementSchema();
- if (schema != null) {
- return schema.getType();
- }
- } catch (MetadataException ignored) {
-
- }
-
return getSeriesSchema(fullPath).getType();
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/metadata/path/MeasurementPath.java
b/server/src/main/java/org/apache/iotdb/db/metadata/path/MeasurementPath.java
index 0fcab99..f5bbc9e 100644
---
a/server/src/main/java/org/apache/iotdb/db/metadata/path/MeasurementPath.java
+++
b/server/src/main/java/org/apache/iotdb/db/metadata/path/MeasurementPath.java
@@ -252,6 +252,18 @@ public class MeasurementPath extends PartialPath {
}
@Override
+ public MeasurementPath clone() {
+ MeasurementPath newMeasurementPath = null;
+ try {
+ newMeasurementPath =
+ new MeasurementPath(this.getDevice(), this.getMeasurement(),
this.getMeasurementSchema());
+ } catch (IllegalPathException e) {
+ e.printStackTrace();
+ }
+ return newMeasurementPath;
+ }
+
+ @Override
public List<IChunkMetadata> getVisibleMetadataListFromWriter(
RestorableTsFileIOWriter writer, TsFileResource tsFileResource,
QueryContext context) {
ModificationFile modificationFile = tsFileResource.getModFile();
diff --git
a/server/src/main/java/org/apache/iotdb/db/metadata/path/PartialPath.java
b/server/src/main/java/org/apache/iotdb/db/metadata/path/PartialPath.java
index 4aae3e5..828e00f 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/path/PartialPath.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/path/PartialPath.java
@@ -59,7 +59,7 @@ import static
org.apache.iotdb.db.conf.IoTDBConstant.ONE_LEVEL_PATH_WILDCARD;
* A prefix path, suffix path or fullPath generated from SQL. Usually used in
the IoTDB server
* module
*/
-public class PartialPath extends Path implements Comparable<Path> {
+public class PartialPath extends Path implements Comparable<Path>, Cloneable {
private static final Logger logger =
LoggerFactory.getLogger(PartialPath.class);
@@ -428,6 +428,12 @@ public class PartialPath extends Path implements
Comparable<Path> {
throw new UnsupportedOperationException("Should call exact sub class!");
}
+ @Override
+ public PartialPath clone() {
+ return new PartialPath(this.getNodes().clone());
+ }
+
+ @Override
public List<IChunkMetadata> getVisibleMetadataListFromWriter(
RestorableTsFileIOWriter writer, TsFileResource tsFileResource,
QueryContext context) {
throw new UnsupportedOperationException("Should call exact sub class!");
diff --git
a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/BasicFunctionOperator.java
b/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/BasicFunctionOperator.java
index 37c52e1..f514a7f 100644
---
a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/BasicFunctionOperator.java
+++
b/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/BasicFunctionOperator.java
@@ -135,9 +135,7 @@ public class BasicFunctionOperator extends FunctionOperator
{
public BasicFunctionOperator copy() {
BasicFunctionOperator ret;
try {
- ret =
- new BasicFunctionOperator(
- this.filterType, new PartialPath(singlePath.getNodes().clone()),
value);
+ ret = new BasicFunctionOperator(this.filterType, singlePath.clone(),
value);
} catch (SQLParserException e) {
logger.error("error copy:", e);
return null;
diff --git
a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/FilterOperator.java
b/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/FilterOperator.java
index 8b37883..7c67e2a 100644
---
a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/FilterOperator.java
+++
b/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/FilterOperator.java
@@ -104,9 +104,8 @@ public class FilterOperator implements
Comparable<FilterOperator> {
this.singlePath = singlePath;
}
- public boolean addChildOperator(FilterOperator op) {
+ public void addChildOperator(FilterOperator op) {
childOperators.add(op);
- return true;
}
public void setPathSet(Set<PartialPath> pathSet) {
@@ -286,7 +285,7 @@ public class FilterOperator implements
Comparable<FilterOperator> {
ret.isLeaf = isLeaf;
ret.isSingle = isSingle;
if (singlePath != null) {
- ret.singlePath = new PartialPath(singlePath.getNodes().clone());
+ ret.singlePath = singlePath.clone();
}
for (FilterOperator filterOperator : this.childOperators) {
ret.addChildOperator(filterOperator.copy());
diff --git
a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/FunctionOperator.java
b/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/FunctionOperator.java
index cc9dbd3..1c58d6f 100644
---
a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/FunctionOperator.java
+++
b/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/FunctionOperator.java
@@ -42,8 +42,7 @@ public class FunctionOperator extends FilterOperator {
}
@Override
- public boolean addChildOperator(FilterOperator op) {
+ public void addChildOperator(FilterOperator op) {
logger.error("cannot add child to leaf FilterOperator, now it's
FunctionOperator");
- return false;
}
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/InOperator.java
b/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/InOperator.java
index 14f79e9..37b5d90 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/InOperator.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/InOperator.java
@@ -156,11 +156,7 @@ public class InOperator extends FunctionOperator {
@Override
public InOperator copy() {
InOperator ret =
- new InOperator(
- this.filterType,
- new PartialPath(singlePath.getNodes().clone()),
- not,
- new HashSet<>(values));
+ new InOperator(this.filterType, singlePath.clone(), not, new
HashSet<>(values));
ret.isLeaf = isLeaf;
ret.isSingle = isSingle;
ret.pathSet = pathSet;
diff --git
a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/LikeOperator.java
b/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/LikeOperator.java
index 4e63a4a..61510c5 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/LikeOperator.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/LikeOperator.java
@@ -96,8 +96,7 @@ public class LikeOperator extends FunctionOperator {
@Override
public LikeOperator copy() {
- LikeOperator ret =
- new LikeOperator(this.filterType, new
PartialPath(singlePath.getNodes().clone()), value);
+ LikeOperator ret = new LikeOperator(this.filterType, singlePath.clone(),
value);
ret.isLeaf = isLeaf;
ret.isSingle = isSingle;
ret.pathSet = pathSet;
diff --git
a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/QueryOperator.java
b/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/QueryOperator.java
index 1e2ade4..0d2fb81 100644
---
a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/QueryOperator.java
+++
b/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/QueryOperator.java
@@ -19,12 +19,12 @@
package org.apache.iotdb.db.qp.logical.crud;
import org.apache.iotdb.db.exception.metadata.MetadataException;
-import org.apache.iotdb.db.exception.metadata.PathNotExistException;
import org.apache.iotdb.db.exception.query.LogicalOperatorException;
import org.apache.iotdb.db.exception.query.LogicalOptimizeException;
import org.apache.iotdb.db.exception.query.QueryProcessException;
import org.apache.iotdb.db.index.common.IndexType;
import org.apache.iotdb.db.metadata.path.AlignedPath;
+import org.apache.iotdb.db.metadata.path.MeasurementPath;
import org.apache.iotdb.db.metadata.path.PartialPath;
import org.apache.iotdb.db.qp.constant.SQLConstant;
import org.apache.iotdb.db.qp.logical.Operator;
@@ -50,7 +50,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
-import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -199,18 +198,15 @@ public class QueryOperator extends Operator {
if (whereComponent != null) {
FilterOperator filterOperator = whereComponent.getFilterOperator();
List<PartialPath> filterPaths = new
ArrayList<>(filterOperator.getPathSet());
- try {
- List<TSDataType> seriesTypes = generator.getSeriesTypes(filterPaths);
- HashMap<PartialPath, TSDataType> pathTSDataTypeHashMap = new
HashMap<>();
- for (int i = 0; i < filterPaths.size(); i++) {
-
rawDataQueryPlan.addFilterPathInDeviceToMeasurements(filterPaths.get(i));
- pathTSDataTypeHashMap.put(filterPaths.get(i), seriesTypes.get(i));
- }
- IExpression expression =
filterOperator.transformToExpression(pathTSDataTypeHashMap);
- rawDataQueryPlan.setExpression(expression);
- } catch (MetadataException e) {
- throw new LogicalOptimizeException(e.getMessage());
+ HashMap<PartialPath, TSDataType> pathTSDataTypeHashMap = new HashMap<>();
+ for (PartialPath filterPath : filterPaths) {
+ rawDataQueryPlan.addFilterPathInDeviceToMeasurements(filterPath);
+ pathTSDataTypeHashMap.put(
+ filterPath,
+ SQLConstant.isReservedPath(filterPath) ? TSDataType.INT64 :
filterPath.getSeriesType());
}
+ IExpression expression =
filterOperator.transformToExpression(pathTSDataTypeHashMap);
+ rawDataQueryPlan.setExpression(expression);
}
if (queryPlan instanceof QueryIndexPlan) {
@@ -220,7 +216,6 @@ public class QueryOperator extends Operator {
}
try {
-
rawDataQueryPlan.setDataTypes(generator.getSeriesTypes(selectComponent.getPaths()));
queryPlan.deduplicate(generator);
} catch (MetadataException e) {
throw new QueryProcessException(e);
@@ -257,9 +252,8 @@ public class QueryOperator extends Operator {
PartialPath fullPath = device.concatPath(suffixPath);
try {
// remove stars in SELECT to get actual paths
- List<PartialPath> actualPaths = getMatchedTimeseries(fullPath);
- if (suffixPath.getNodes().length > 1
- && (actualPaths.isEmpty() || !(actualPaths.get(0) instanceof
AlignedPath))) {
+ List<MeasurementPath> actualPaths = getMatchedTimeseries(fullPath);
+ if (suffixPath.getNodes().length > 1) {
throw new
QueryProcessException(AlignByDevicePlan.MEASUREMENT_ERROR_MESSAGE);
}
if (resultColumn.hasAlias() && actualPaths.size() >= 2) {
@@ -275,7 +269,7 @@ public class QueryOperator extends Operator {
} else {
for (PartialPath path : actualPaths) {
String measurementName = getMeasurementName(path, aggregation);
- TSDataType measurementDataType =
IoTDB.metaManager.getSeriesType(path);
+ TSDataType measurementDataType = path.getSeriesType();
TSDataType columnDataType = getAggregationType(aggregation);
columnDataType = columnDataType == null ? measurementDataType :
columnDataType;
MeasurementInfo measurementInfo =
@@ -329,7 +323,7 @@ public class QueryOperator extends Operator {
if (whereComponent != null) {
alignByDevicePlan.setDeviceToFilterMap(
- concatFilterByDevice(generator, devices,
whereComponent.getFilterOperator()));
+ concatFilterByDevice(devices, whereComponent.getFilterOperator()));
}
return alignByDevicePlan;
@@ -419,34 +413,31 @@ public class QueryOperator extends Operator {
// [root.ln.d1 -> root.ln.d1.s1 < 20 AND root.ln.d1.s2 > 10,
// root.ln.d2 -> root.ln.d2.s1 < 20 AND root.ln.d2.s2 > 10)]
private Map<String, IExpression> concatFilterByDevice(
- PhysicalGenerator generator, List<PartialPath> devices, FilterOperator
operator)
- throws QueryProcessException {
+ List<PartialPath> devices, FilterOperator operator) throws
QueryProcessException {
Map<String, IExpression> deviceToFilterMap = new HashMap<>();
Set<PartialPath> filterPaths = new HashSet<>();
Iterator<PartialPath> deviceIterator = devices.iterator();
while (deviceIterator.hasNext()) {
PartialPath device = deviceIterator.next();
- FilterOperator newOperator = operator.copy();
+ FilterOperator newOperator;
try {
+ newOperator = operator.copy();
concatFilterPath(device, newOperator, filterPaths);
- } catch (PathNotExistException e) {
+ } catch (LogicalOptimizeException | MetadataException e) {
deviceIterator.remove();
continue;
}
// transform to a list so it can be indexed
List<PartialPath> filterPathList = new ArrayList<>(filterPaths);
- try {
- List<TSDataType> seriesTypes =
generator.getSeriesTypes(filterPathList);
- Map<PartialPath, TSDataType> pathTSDataTypeHashMap = new HashMap<>();
- for (int i = 0; i < filterPathList.size(); i++) {
- pathTSDataTypeHashMap.put(filterPathList.get(i), seriesTypes.get(i));
- }
- deviceToFilterMap.put(
- device.getFullPath(),
newOperator.transformToExpression(pathTSDataTypeHashMap));
- filterPaths.clear();
- } catch (MetadataException e) {
- throw new QueryProcessException(e);
+ Map<PartialPath, TSDataType> pathTSDataTypeHashMap = new HashMap<>();
+ for (PartialPath filterPath : filterPathList) {
+ pathTSDataTypeHashMap.put(
+ filterPath,
+ SQLConstant.isReservedPath(filterPath) ? TSDataType.INT64 :
filterPath.getSeriesType());
}
+ deviceToFilterMap.put(
+ device.getFullPath(),
newOperator.transformToExpression(pathTSDataTypeHashMap));
+ filterPaths.clear();
}
return deviceToFilterMap;
@@ -454,7 +445,7 @@ public class QueryOperator extends Operator {
private void concatFilterPath(
PartialPath prefix, FilterOperator operator, Set<PartialPath>
filterPaths)
- throws PathNotExistException {
+ throws LogicalOptimizeException, MetadataException {
if (!operator.isLeaf()) {
for (FilterOperator child : operator.getChildren()) {
concatFilterPath(prefix, child, filterPaths);
@@ -481,21 +472,21 @@ public class QueryOperator extends Operator {
}
PartialPath concatPath = prefix.concatPath(filterPath);
- if (IoTDB.metaManager.isPathExist(concatPath)) {
- filterPaths.add(concatPath);
- basicOperator.setSinglePath(concatPath);
- } else {
- throw new PathNotExistException(concatPath.getFullPath());
+ List<MeasurementPath> concatMeasurementPaths =
getMatchedTimeseries(concatPath);
+ if (concatMeasurementPaths.isEmpty()) {
+ throw new LogicalOptimizeException(
+ String.format("Unknown time series %s in `where clause`",
concatPath));
}
+ filterPaths.add(concatMeasurementPaths.get(0));
+ basicOperator.setSinglePath(concatMeasurementPaths.get(0));
}
protected Set<PartialPath> getMatchedDevices(PartialPath path) throws
MetadataException {
return IoTDB.metaManager.getMatchedDevices(path);
}
- protected List<PartialPath> getMatchedTimeseries(PartialPath path) throws
MetadataException {
- // todo eliminate this transform and use MeasurementPath directly
- return new LinkedList<>(IoTDB.metaManager.getMeasurementPaths(path));
+ protected List<MeasurementPath> getMatchedTimeseries(PartialPath path)
throws MetadataException {
+ return IoTDB.metaManager.getMeasurementPaths(path);
}
public boolean isEnableTracing() {
diff --git
a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/RegexpOperator.java
b/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/RegexpOperator.java
index 1710d0d..3067908 100644
---
a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/RegexpOperator.java
+++
b/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/RegexpOperator.java
@@ -95,8 +95,7 @@ public class RegexpOperator extends FunctionOperator {
@Override
public RegexpOperator copy() {
- RegexpOperator ret =
- new RegexpOperator(this.filterType, new
PartialPath(singlePath.getNodes().clone()), value);
+ RegexpOperator ret = new RegexpOperator(this.filterType,
singlePath.clone(), value);
ret.isLeaf = isLeaf;
ret.isSingle = isSingle;
ret.pathSet = pathSet;
diff --git
a/server/src/main/java/org/apache/iotdb/db/qp/physical/PhysicalPlan.java
b/server/src/main/java/org/apache/iotdb/db/qp/physical/PhysicalPlan.java
index e8845fb..4325fb4 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/physical/PhysicalPlan.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/physical/PhysicalPlan.java
@@ -116,7 +116,7 @@ public abstract class PhysicalPlan {
return "abstract plan";
}
- public abstract List<PartialPath> getPaths();
+ public abstract List<? extends PartialPath> getPaths();
public void setPaths(List<PartialPath> paths) {}
diff --git
a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/AlignByDevicePlan.java
b/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/AlignByDevicePlan.java
index ad46292..a4079a1 100644
---
a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/AlignByDevicePlan.java
+++
b/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/AlignByDevicePlan.java
@@ -22,6 +22,7 @@ import org.apache.iotdb.db.metadata.path.PartialPath;
import org.apache.iotdb.db.qp.logical.Operator;
import org.apache.iotdb.db.qp.logical.Operator.OperatorType;
import org.apache.iotdb.db.qp.strategy.PhysicalGenerator;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
import org.apache.iotdb.tsfile.read.expression.IExpression;
import java.util.List;
@@ -36,6 +37,7 @@ public class AlignByDevicePlan extends QueryPlan {
// to record result measurement columns, e.g. temperature, status, speed
private List<String> measurements;
+ private List<TSDataType> dataTypes;
private Map<String, MeasurementInfo> measurementInfoMap;
// to check data type consistency for the same name sensor of different
devices
@@ -63,6 +65,15 @@ public class AlignByDevicePlan extends QueryPlan {
return measurements;
}
+ @Override
+ public List<TSDataType> getDataTypes() {
+ return dataTypes;
+ }
+
+ public void setDataTypes(List<TSDataType> dataTypes) {
+ this.dataTypes = dataTypes;
+ }
+
public void setDevices(List<PartialPath> devices) {
this.devices = devices;
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/LastQueryPlan.java
b/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/LastQueryPlan.java
index 9f4f684..08511f7 100644
---
a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/LastQueryPlan.java
+++
b/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/LastQueryPlan.java
@@ -50,7 +50,6 @@ public class LastQueryPlan extends RawDataQueryPlan {
String column = resultColumns.get(i).getResultColumnName();
if (!columnForReaderSet.contains(column)) {
addDeduplicatedPaths(paths.get(i));
- addDeduplicatedDataTypes(dataTypes.get(i));
deduplicatedResultColumns.add(resultColumns.get(i));
columnForReaderSet.add(column);
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/QueryPlan.java
b/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/QueryPlan.java
index c00f479..e947144 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/QueryPlan.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/QueryPlan.java
@@ -19,13 +19,16 @@
package org.apache.iotdb.db.qp.physical.crud;
import org.apache.iotdb.db.exception.metadata.MetadataException;
+import org.apache.iotdb.db.metadata.path.MeasurementPath;
import org.apache.iotdb.db.metadata.path.PartialPath;
import org.apache.iotdb.db.qp.logical.Operator;
import org.apache.iotdb.db.qp.physical.PhysicalPlan;
import org.apache.iotdb.db.qp.strategy.PhysicalGenerator;
import org.apache.iotdb.db.query.expression.ResultColumn;
+import org.apache.iotdb.db.utils.SchemaUtils;
import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -33,8 +36,8 @@ import java.util.Map;
public abstract class QueryPlan extends PhysicalPlan {
protected List<ResultColumn> resultColumns = null;
- protected List<PartialPath> paths = null;
- protected List<TSDataType> dataTypes = null;
+ protected List<MeasurementPath> paths = null;
+
private boolean alignByTime = true; // for disable align sql
private int rowLimit = 0;
@@ -65,21 +68,24 @@ public abstract class QueryPlan extends PhysicalPlan {
public abstract void deduplicate(PhysicalGenerator physicalGenerator) throws
MetadataException;
@Override
- public List<PartialPath> getPaths() {
+ public List<MeasurementPath> getPaths() {
return paths;
}
@Override
public void setPaths(List<PartialPath> paths) {
- this.paths = paths;
+ if (paths == null) this.paths = null; // align by device
+ else {
+ List<MeasurementPath> measurementPaths = new ArrayList<>();
+ for (PartialPath path : paths) {
+ measurementPaths.add((MeasurementPath) path);
+ }
+ this.paths = measurementPaths;
+ }
}
public List<TSDataType> getDataTypes() {
- return dataTypes;
- }
-
- public void setDataTypes(List<TSDataType> dataTypes) {
- this.dataTypes = dataTypes;
+ return SchemaUtils.getSeriesTypesByPaths(paths);
}
public int getRowLimit() {
diff --git
a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/RawDataQueryPlan.java
b/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/RawDataQueryPlan.java
index 5bd1bdf..814a4c7 100644
---
a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/RawDataQueryPlan.java
+++
b/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/RawDataQueryPlan.java
@@ -24,6 +24,7 @@ import org.apache.iotdb.db.metadata.path.AlignedPath;
import org.apache.iotdb.db.metadata.path.PartialPath;
import org.apache.iotdb.db.qp.logical.Operator;
import org.apache.iotdb.db.qp.strategy.PhysicalGenerator;
+import org.apache.iotdb.db.utils.SchemaUtils;
import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
import org.apache.iotdb.tsfile.read.common.Path;
import org.apache.iotdb.tsfile.read.expression.IExpression;
@@ -40,7 +41,7 @@ import java.util.Set;
public class RawDataQueryPlan extends QueryPlan {
private List<PartialPath> deduplicatedPaths = new ArrayList<>();
- private List<TSDataType> deduplicatedDataTypes = new ArrayList<>();
+
private IExpression expression = null;
private Map<String, Set<String>> deviceToMeasurements = new HashMap<>();
@@ -48,8 +49,6 @@ public class RawDataQueryPlan extends QueryPlan {
/** used to group all the sub sensors of one vector into VectorPartialPath */
private List<PartialPath> deduplicatedVectorPaths = new ArrayList<>();
- private List<TSDataType> deduplicatedVectorDataTypes = new ArrayList<>();
-
public RawDataQueryPlan() {
super();
}
@@ -78,7 +77,6 @@ public class RawDataQueryPlan extends QueryPlan {
String columnForReader = getColumnForReaderFromPath(originalPath,
originalIndex);
if (!columnForReaderSet.contains(columnForReader)) {
addDeduplicatedPaths(originalPath);
- addDeduplicatedDataTypes(dataTypes.get(originalIndex));
pathNameToReaderIndex.put(columnForReader,
pathNameToReaderIndex.size());
if (this instanceof AggregationPlan) {
((AggregationPlan) this)
@@ -118,6 +116,10 @@ public class RawDataQueryPlan extends QueryPlan {
this.deduplicatedPaths.add(path);
}
+ public List<TSDataType> getDeduplicatedDataTypes() {
+ return SchemaUtils.getSeriesTypesByPaths(deduplicatedPaths);
+ }
+
/**
* used for AlignByDevice Query, the query is executed by each device, So we
only maintain
* measurements of current device.
@@ -136,16 +138,8 @@ public class RawDataQueryPlan extends QueryPlan {
this.deduplicatedPaths = deduplicatedPaths;
}
- public List<TSDataType> getDeduplicatedDataTypes() {
- return deduplicatedDataTypes;
- }
-
- public void addDeduplicatedDataTypes(TSDataType dataType) {
- this.deduplicatedDataTypes.add(dataType);
- }
-
- public void setDeduplicatedDataTypes(List<TSDataType> deduplicatedDataTypes)
{
- this.deduplicatedDataTypes = deduplicatedDataTypes;
+ public void setDeduplicatedPaths(List<PartialPath> deduplicatedPaths) {
+ this.deduplicatedPaths = deduplicatedPaths;
}
public Set<String> getAllMeasurementsInDevice(String device) {
@@ -164,35 +158,26 @@ public class RawDataQueryPlan extends QueryPlan {
/**
* Group all the subSensors of one vector into one VectorPartialPath save
the grouped
- * VectorPartialPath in deduplicatedVectorPaths and
deduplicatedVectorDataTypes instead of putting
- * them directly into deduplicatedPaths and deduplicatedDataTypes, because
we don't know whether
- * the raw query has value filter here.
+ * VectorPartialPath in deduplicatedVectorPaths instead of putting them
directly into
+ * deduplicatedPaths, because we don't know whether the raw query has value
filter here.
*/
public void groupVectorPaths(PhysicalGenerator physicalGenerator) throws
MetadataException {
List<PartialPath> vectorizedDeduplicatedPaths =
physicalGenerator.groupVectorPaths(getDeduplicatedPaths());
- List<TSDataType> vectorizedDeduplicatedDataTypes =
- new
ArrayList<>(physicalGenerator.getSeriesTypes(vectorizedDeduplicatedPaths));
setDeduplicatedVectorPaths(vectorizedDeduplicatedPaths);
- setDeduplicatedVectorDataTypes(vectorizedDeduplicatedDataTypes);
}
public void setDeduplicatedVectorPaths(List<PartialPath>
deduplicatedVectorPaths) {
this.deduplicatedVectorPaths = deduplicatedVectorPaths;
}
- public void setDeduplicatedVectorDataTypes(List<TSDataType>
deduplicatedVectorDataTypes) {
- this.deduplicatedVectorDataTypes = deduplicatedVectorDataTypes;
- }
-
/**
* RawQueryWithoutValueFilter should call this method to use grouped vector
partial path to
- * replace the previous deduplicatedPaths and deduplicatedDataTypes
+ * replace the previous deduplicatedPaths
*/
public void transformToVector() {
if (!this.deduplicatedVectorPaths.isEmpty()) {
this.deduplicatedPaths = this.deduplicatedVectorPaths;
- this.deduplicatedDataTypes = this.deduplicatedVectorDataTypes;
}
}
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/SelectIntoPlan.java
b/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/SelectIntoPlan.java
index 8fea388..bdb4ea3 100644
---
a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/SelectIntoPlan.java
+++
b/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/SelectIntoPlan.java
@@ -20,6 +20,7 @@
package org.apache.iotdb.db.qp.physical.crud;
import org.apache.iotdb.db.exception.metadata.IllegalPathException;
+import org.apache.iotdb.db.metadata.path.MeasurementPath;
import org.apache.iotdb.db.metadata.path.PartialPath;
import org.apache.iotdb.db.qp.logical.Operator.OperatorType;
import org.apache.iotdb.db.qp.physical.PhysicalPlan;
@@ -95,7 +96,7 @@ public class SelectIntoPlan extends PhysicalPlan {
/** mainly for query auth. */
@Override
- public List<PartialPath> getPaths() {
+ public List<MeasurementPath> getPaths() {
return queryPlan.getPaths();
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/UDTFPlan.java
b/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/UDTFPlan.java
index 49dd105..63f9bb5 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/UDTFPlan.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/UDTFPlan.java
@@ -25,10 +25,8 @@ import org.apache.iotdb.db.qp.logical.Operator;
import org.apache.iotdb.db.qp.strategy.PhysicalGenerator;
import org.apache.iotdb.db.query.expression.ResultColumn;
import org.apache.iotdb.db.query.expression.unary.FunctionExpression;
-import org.apache.iotdb.db.query.expression.unary.TimeSeriesOperand;
import org.apache.iotdb.db.query.udf.core.executor.UDTFExecutor;
import org.apache.iotdb.db.query.udf.service.UDFClassLoaderManager;
-import org.apache.iotdb.db.service.IoTDB;
import org.apache.iotdb.tsfile.utils.Pair;
import java.time.ZoneId;
@@ -72,14 +70,9 @@ public class UDTFPlan extends RawDataQueryPlan implements
UDFPlan {
PartialPath originalPath = indexedPath.left;
Integer originalIndex = indexedPath.right;
- boolean isUdf =
- !(resultColumns.get(originalIndex).getExpression() instanceof
TimeSeriesOperand);
-
String columnForReader = getColumnForReaderFromPath(originalPath,
originalIndex);
if (!columnForReaderSet.contains(columnForReader)) {
addDeduplicatedPaths(originalPath);
- addDeduplicatedDataTypes(
- isUdf ? IoTDB.metaManager.getSeriesType(originalPath) :
dataTypes.get(originalIndex));
pathNameToReaderIndex.put(columnForReader,
pathNameToReaderIndex.size());
columnForReaderSet.add(columnForReader);
}
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 8e9816b..2575716 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
@@ -27,8 +27,6 @@ import
org.apache.iotdb.db.qp.logical.sys.LoadConfigurationOperator.LoadConfigur
import org.apache.iotdb.db.qp.physical.PhysicalPlan;
import org.apache.iotdb.db.qp.physical.sys.LoadConfigurationPlan;
import
org.apache.iotdb.db.qp.physical.sys.LoadConfigurationPlan.LoadConfigurationPlanType;
-import org.apache.iotdb.db.utils.SchemaUtils;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
import java.util.List;
@@ -54,10 +52,6 @@ public class PhysicalGenerator {
}
}
- public List<TSDataType> getSeriesTypes(List<PartialPath> paths) throws
MetadataException {
- return SchemaUtils.getSeriesTypesByPaths(paths);
- }
-
public List<PartialPath> groupVectorPaths(List<PartialPath> paths) throws
MetadataException {
return MetaUtils.groupAlignedPaths(paths);
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/qp/strategy/optimizer/ConcatPathOptimizer.java
b/server/src/main/java/org/apache/iotdb/db/qp/strategy/optimizer/ConcatPathOptimizer.java
index 6d2ad0f..cc07a59 100644
---
a/server/src/main/java/org/apache/iotdb/db/qp/strategy/optimizer/ConcatPathOptimizer.java
+++
b/server/src/main/java/org/apache/iotdb/db/qp/strategy/optimizer/ConcatPathOptimizer.java
@@ -164,14 +164,18 @@ public class ConcatPathOptimizer implements
ILogicalOptimizer {
}
FunctionOperator functionOperator = (FunctionOperator) operator;
PartialPath filterPath = functionOperator.getSinglePath();
- // do nothing in the cases of "where time > 5" or "where root.d1.s1 > 5"
- if (SQLConstant.isReservedPath(filterPath)
- || filterPath.getFirstNode().startsWith(SQLConstant.ROOT)) {
+ List<PartialPath> concatPaths = new ArrayList<>();
+ if (SQLConstant.isReservedPath(filterPath)) {
+ // do nothing in the case of "where time > 5"
filterPaths.add(filterPath);
return operator;
+ } else if (filterPath.getFirstNode().startsWith(SQLConstant.ROOT)) {
+ // do nothing in the case of "where root.d1.s1 > 5"
+ concatPaths.add(filterPath);
+ } else {
+ fromPaths.forEach(fromPath ->
concatPaths.add(fromPath.concatPath(filterPath)));
}
- List<PartialPath> concatPaths = new ArrayList<>();
- fromPaths.forEach(fromPath ->
concatPaths.add(fromPath.concatPath(filterPath)));
+
List<PartialPath> noStarPaths = removeWildcardsInConcatPaths(concatPaths);
filterPaths.addAll(noStarPaths);
if (noStarPaths.size() == 1) {
diff --git
a/server/src/main/java/org/apache/iotdb/db/qp/utils/WildcardsRemover.java
b/server/src/main/java/org/apache/iotdb/db/qp/utils/WildcardsRemover.java
index 3c159f7..725e301 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/utils/WildcardsRemover.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/utils/WildcardsRemover.java
@@ -34,7 +34,6 @@ import org.apache.iotdb.tsfile.utils.Pair;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.LinkedList;
import java.util.List;
/** Removes wildcards (applying memory control and slimit/soffset control) */
@@ -58,7 +57,8 @@ public class WildcardsRemover {
public WildcardsRemover() {}
- public List<PartialPath> removeWildcardFrom(PartialPath path) throws
LogicalOptimizeException {
+ public List<MeasurementPath> removeWildcardFrom(PartialPath path)
+ throws LogicalOptimizeException {
try {
Pair<List<MeasurementPath>, Integer> pair =
IoTDB.metaManager.getMeasurementPathsWithAlias(path, currentLimit,
currentOffset);
@@ -74,8 +74,7 @@ public class WildcardsRemover {
currentLimit -= pair.right;
}
- // todo eliminate this transform
- return new LinkedList<>(pair.left);
+ return pair.left;
} catch (MetadataException e) {
throw new LogicalOptimizeException("error occurred when removing star: "
+ e.getMessage());
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/query/dataset/AlignByDeviceDataSet.java
b/server/src/main/java/org/apache/iotdb/db/query/dataset/AlignByDeviceDataSet.java
index 5066043..83cafa6 100644
---
a/server/src/main/java/org/apache/iotdb/db/query/dataset/AlignByDeviceDataSet.java
+++
b/server/src/main/java/org/apache/iotdb/db/query/dataset/AlignByDeviceDataSet.java
@@ -22,6 +22,7 @@ import org.apache.iotdb.db.exception.StorageEngineException;
import org.apache.iotdb.db.exception.metadata.MetadataException;
import org.apache.iotdb.db.exception.query.QueryProcessException;
import org.apache.iotdb.db.metadata.path.AlignedPath;
+import org.apache.iotdb.db.metadata.path.MeasurementPath;
import org.apache.iotdb.db.metadata.path.PartialPath;
import org.apache.iotdb.db.qp.physical.crud.AggregationPlan;
import org.apache.iotdb.db.qp.physical.crud.AlignByDevicePlan;
@@ -177,7 +178,6 @@ public class AlignByDeviceDataSet extends QueryDataSet {
switch (dataSetType) {
case GROUPBYTIME:
groupByTimePlan.setDeduplicatedPathsAndUpdate(executePaths);
- groupByTimePlan.setDeduplicatedDataTypes(tsDataTypes);
groupByTimePlan.setDeduplicatedAggregations(executeAggregations);
groupByTimePlan.setExpression(expression);
currentDataSet = queryRouter.groupBy(groupByTimePlan, context);
@@ -185,18 +185,15 @@ public class AlignByDeviceDataSet extends QueryDataSet {
case AGGREGATE:
aggregationPlan.setDeduplicatedPathsAndUpdate(executePaths);
aggregationPlan.setDeduplicatedAggregations(executeAggregations);
- aggregationPlan.setDeduplicatedDataTypes(tsDataTypes);
aggregationPlan.setExpression(expression);
currentDataSet = queryRouter.aggregate(aggregationPlan, context);
break;
case FILL:
- fillQueryPlan.setDeduplicatedDataTypes(tsDataTypes);
fillQueryPlan.setDeduplicatedPathsAndUpdate(executePaths);
currentDataSet = queryRouter.fill(fillQueryPlan, context);
break;
case QUERY:
rawDataQueryPlan.setDeduplicatedPathsAndUpdate(executePaths);
- rawDataQueryPlan.setDeduplicatedDataTypes(tsDataTypes);
rawDataQueryPlan.setExpression(expression);
currentDataSet = queryRouter.rawDataQuery(rawDataQueryPlan,
context);
break;
@@ -261,7 +258,7 @@ public class AlignByDeviceDataSet extends QueryDataSet {
PartialPath fullPath = new PartialPath(device.getFullPath(),
measurement);
IMeasurementSchema schema = IoTDB.metaManager.getSeriesSchema(fullPath);
if (schema instanceof UnaryMeasurementSchema) {
- return fullPath;
+ return new MeasurementPath(device.getFullPath(), measurement, schema);
} else {
String vectorPath = fullPath.getDevice();
return new AlignedPath(vectorPath, fullPath.getMeasurement());
diff --git
a/server/src/main/java/org/apache/iotdb/db/query/executor/RawDataQueryExecutor.java
b/server/src/main/java/org/apache/iotdb/db/query/executor/RawDataQueryExecutor.java
index d33c4ed..88481d9 100644
---
a/server/src/main/java/org/apache/iotdb/db/query/executor/RawDataQueryExecutor.java
+++
b/server/src/main/java/org/apache/iotdb/db/query/executor/RawDataQueryExecutor.java
@@ -106,9 +106,9 @@ public class RawDataQueryExecutor {
List<StorageGroupProcessor> list =
StorageEngine.getInstance().mergeLock(queryPlan.getDeduplicatedPaths());
try {
- for (int i = 0; i < queryPlan.getDeduplicatedPaths().size(); i++) {
- PartialPath path = queryPlan.getDeduplicatedPaths().get(i);
- TSDataType dataType = queryPlan.getDeduplicatedDataTypes().get(i);
+ List<PartialPath> paths = queryPlan.getDeduplicatedPaths();
+ for (PartialPath path : paths) {
+ TSDataType dataType = path.getSeriesType();
QueryDataSource queryDataSource =
QueryResourceManager.getInstance().getQueryDataSource(path,
context, timeFilter);
diff --git
a/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
b/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
index 172e5fb..8de33d7 100644
--- a/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
+++ b/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
@@ -63,7 +63,6 @@ import org.apache.iotdb.db.qp.physical.crud.QueryPlan;
import org.apache.iotdb.db.qp.physical.crud.SelectIntoPlan;
import org.apache.iotdb.db.qp.physical.crud.SetSchemaTemplatePlan;
import org.apache.iotdb.db.qp.physical.crud.UDFPlan;
-import org.apache.iotdb.db.qp.physical.crud.UDTFPlan;
import org.apache.iotdb.db.qp.physical.crud.UnsetSchemaTemplatePlan;
import org.apache.iotdb.db.qp.physical.sys.AuthorPlan;
import org.apache.iotdb.db.qp.physical.sys.CreateAlignedTimeSeriesPlan;
@@ -393,6 +392,10 @@ public class TSServiceImpl implements TSIService.Iface {
return IoTDB.metaManager.getMeasurementPaths(path);
}
+ protected TSDataType getSeriesTypeByPath(PartialPath path) throws
MetadataException {
+ return IoTDB.metaManager.getSeriesType(path);
+ }
+
private boolean executeInsertRowsPlan(InsertRowsPlan insertRowsPlan,
List<TSStatus> result) {
long t1 = System.currentTimeMillis();
TSStatus tsStatus = executeNonQueryPlan(insertRowsPlan);
@@ -951,7 +954,7 @@ public class TSServiceImpl implements TSIService.Iface {
BitSet aliasList)
throws TException, MetadataException {
List<ResultColumn> resultColumns = plan.getResultColumns();
- List<PartialPath> paths = plan.getPaths();
+ List<MeasurementPath> paths = plan.getPaths();
List<TSDataType> seriesTypes = new ArrayList<>();
switch (plan.getOperatorType()) {
case QUERY:
@@ -971,7 +974,7 @@ public class TSServiceImpl implements TSIService.Iface {
} else {
respColumns.add(resultColumns.get(i).getResultColumnName());
}
- seriesTypes.add(getSeriesTypeByPath(paths.get(i)));
+ seriesTypes.add(paths.get(i).getSeriesType());
}
break;
case AGGREGATION:
@@ -990,7 +993,6 @@ public class TSServiceImpl implements TSIService.Iface {
break;
case UDTF:
seriesTypes = new ArrayList<>();
- UDTFPlan udtfPlan = (UDTFPlan) plan;
for (int i = 0; i < paths.size(); i++) {
respColumns.add(resultColumns.get(i).getResultColumnName());
seriesTypes.add(resultColumns.get(i).getDataType());
@@ -1318,8 +1320,8 @@ public class TSServiceImpl implements TSIService.Iface {
return isLoggedIn;
}
- private boolean checkAuthorization(List<PartialPath> paths, PhysicalPlan
plan, String username)
- throws AuthException {
+ private boolean checkAuthorization(
+ List<? extends PartialPath> paths, PhysicalPlan plan, String username)
throws AuthException {
String targetUser = null;
if (plan instanceof AuthorPlan) {
targetUser = ((AuthorPlan) plan).getUserName();
@@ -2145,7 +2147,7 @@ public class TSServiceImpl implements TSIService.Iface {
}
private TSStatus checkAuthority(PhysicalPlan plan, long sessionId) {
- List<PartialPath> paths = plan.getPaths();
+ List<? extends PartialPath> paths = plan.getPaths();
try {
if (!checkAuthorization(paths, plan,
sessionManager.getUsername(sessionId))) {
return RpcUtils.getStatus(
@@ -2187,10 +2189,6 @@ public class TSServiceImpl implements TSIService.Iface {
return executor.processNonQuery(plan);
}
- protected TSDataType getSeriesTypeByPath(PartialPath path) throws
MetadataException {
- return SchemaUtils.getSeriesTypeByPath(path);
- }
-
private TSStatus onQueryException(Exception e, String operation) {
TSStatus status = tryCatchQueryException(e);
return status != null
diff --git a/server/src/main/java/org/apache/iotdb/db/utils/SchemaUtils.java
b/server/src/main/java/org/apache/iotdb/db/utils/SchemaUtils.java
index 295930d..3df6ed7 100644
--- a/server/src/main/java/org/apache/iotdb/db/utils/SchemaUtils.java
+++ b/server/src/main/java/org/apache/iotdb/db/utils/SchemaUtils.java
@@ -25,6 +25,7 @@ import
org.apache.iotdb.db.exception.metadata.PathNotExistException;
import org.apache.iotdb.db.exception.metadata.StorageGroupNotSetException;
import org.apache.iotdb.db.metadata.mnode.IMeasurementMNode;
import org.apache.iotdb.db.metadata.mnode.MeasurementMNode;
+import org.apache.iotdb.db.metadata.path.MeasurementPath;
import org.apache.iotdb.db.metadata.path.PartialPath;
import org.apache.iotdb.db.qp.constant.SQLConstant;
import org.apache.iotdb.db.service.IoTDB;
@@ -125,11 +126,10 @@ public class SchemaUtils {
IoTDB.metaManager.cacheMeta(path, measurementMNode, true);
}
- public static List<TSDataType> getSeriesTypesByPaths(Collection<PartialPath>
paths)
- throws MetadataException {
+ public static List<TSDataType> getSeriesTypesByPaths(Collection<? extends
PartialPath> paths) {
List<TSDataType> dataTypes = new ArrayList<>();
for (PartialPath path : paths) {
- dataTypes.add(path == null ? null :
IoTDB.metaManager.getSeriesType(path));
+ dataTypes.add(path == null ? null : path.getSeriesType());
}
return dataTypes;
}
@@ -152,12 +152,8 @@ public class SchemaUtils {
return measurementDataType;
}
- public static TSDataType getSeriesTypeByPath(PartialPath path) throws
MetadataException {
- return IoTDB.metaManager.getSeriesType(path);
- }
-
public static List<TSDataType> getSeriesTypesByPaths(
- List<PartialPath> paths, List<String> aggregations) throws
MetadataException {
+ List<MeasurementPath> paths, List<String> aggregations) throws
MetadataException {
List<TSDataType> tsDataTypes = new ArrayList<>();
for (int i = 0; i < paths.size(); i++) {
String aggrStr = aggregations != null ? aggregations.get(i) : null;
@@ -166,7 +162,7 @@ public class SchemaUtils {
tsDataTypes.add(dataType);
} else {
PartialPath path = paths.get(i);
- tsDataTypes.add(path == null ? null :
IoTDB.metaManager.getSeriesType(path));
+ tsDataTypes.add(path == null ? null : path.getSeriesType());
}
}
return tsDataTypes;
diff --git
a/server/src/test/java/org/apache/iotdb/db/engine/compaction/cross/MergeOverLapTest.java
b/server/src/test/java/org/apache/iotdb/db/engine/compaction/cross/MergeOverLapTest.java
index 295cec7..9ffcee2 100644
---
a/server/src/test/java/org/apache/iotdb/db/engine/compaction/cross/MergeOverLapTest.java
+++
b/server/src/test/java/org/apache/iotdb/db/engine/compaction/cross/MergeOverLapTest.java
@@ -26,9 +26,10 @@ import
org.apache.iotdb.db.engine.compaction.cross.inplace.task.CrossSpaceMergeT
import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
import org.apache.iotdb.db.exception.StorageEngineException;
import org.apache.iotdb.db.exception.metadata.MetadataException;
-import org.apache.iotdb.db.metadata.path.PartialPath;
+import org.apache.iotdb.db.metadata.path.MeasurementPath;
import org.apache.iotdb.db.query.reader.series.SeriesRawDataBatchReader;
import org.apache.iotdb.db.utils.EnvironmentUtils;
+import org.apache.iotdb.db.utils.SchemaTestUtils;
import org.apache.iotdb.tsfile.common.constant.TsFileConstant;
import org.apache.iotdb.tsfile.exception.write.WriteProcessException;
import org.apache.iotdb.tsfile.read.common.BatchData;
@@ -168,8 +169,8 @@ public class MergeOverLapTest extends MergeTest {
MERGE_TEST_SG);
mergeTask.call();
- PartialPath path =
- new PartialPath(
+ MeasurementPath path =
+ SchemaTestUtils.getMeasurementPath(
deviceIds[0]
+ TsFileConstant.PATH_SEPARATOR
+ measurementSchemas[0].getMeasurementId());
diff --git
a/server/src/test/java/org/apache/iotdb/db/engine/compaction/cross/MergeTaskTest.java
b/server/src/test/java/org/apache/iotdb/db/engine/compaction/cross/MergeTaskTest.java
index 33baef4..7ebea08 100644
---
a/server/src/test/java/org/apache/iotdb/db/engine/compaction/cross/MergeTaskTest.java
+++
b/server/src/test/java/org/apache/iotdb/db/engine/compaction/cross/MergeTaskTest.java
@@ -28,9 +28,11 @@ import org.apache.iotdb.db.engine.modification.Deletion;
import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
import org.apache.iotdb.db.exception.StorageEngineException;
import org.apache.iotdb.db.exception.metadata.MetadataException;
+import org.apache.iotdb.db.metadata.path.MeasurementPath;
import org.apache.iotdb.db.metadata.path.PartialPath;
import org.apache.iotdb.db.query.reader.series.SeriesRawDataBatchReader;
import org.apache.iotdb.db.utils.EnvironmentUtils;
+import org.apache.iotdb.db.utils.SchemaTestUtils;
import org.apache.iotdb.tsfile.common.constant.TsFileConstant;
import org.apache.iotdb.tsfile.exception.write.WriteProcessException;
import org.apache.iotdb.tsfile.read.common.BatchData;
@@ -87,8 +89,8 @@ public class MergeTaskTest extends MergeTest {
1,
MERGE_TEST_SG);
mergeTask.call();
- PartialPath path =
- new PartialPath(
+ MeasurementPath path =
+ SchemaTestUtils.getMeasurementPath(
deviceIds[0]
+ TsFileConstant.PATH_SEPARATOR
+ measurementSchemas[0].getMeasurementId());
@@ -198,8 +200,8 @@ public class MergeTaskTest extends MergeTest {
MERGE_TEST_SG);
mergeTask.call();
- PartialPath path =
- new PartialPath(
+ MeasurementPath path =
+ SchemaTestUtils.getMeasurementPath(
deviceIds[0]
+ TsFileConstant.PATH_SEPARATOR
+ measurementSchemas[9].getMeasurementId());
@@ -241,8 +243,8 @@ public class MergeTaskTest extends MergeTest {
MERGE_TEST_SG);
mergeTask.call();
- PartialPath path =
- new PartialPath(
+ MeasurementPath path =
+ SchemaTestUtils.getMeasurementPath(
deviceIds[0]
+ TsFileConstant.PATH_SEPARATOR
+ measurementSchemas[0].getMeasurementId());
@@ -280,8 +282,8 @@ public class MergeTaskTest extends MergeTest {
MERGE_TEST_SG);
mergeTask.call();
- PartialPath path =
- new PartialPath(
+ MeasurementPath path =
+ SchemaTestUtils.getMeasurementPath(
deviceIds[0]
+ TsFileConstant.PATH_SEPARATOR
+ measurementSchemas[0].getMeasurementId());
@@ -323,8 +325,8 @@ public class MergeTaskTest extends MergeTest {
MERGE_TEST_SG);
mergeTask.call();
- PartialPath path =
- new PartialPath(
+ MeasurementPath path =
+ SchemaTestUtils.getMeasurementPath(
deviceIds[0]
+ TsFileConstant.PATH_SEPARATOR
+ measurementSchemas[0].getMeasurementId());
@@ -362,8 +364,8 @@ public class MergeTaskTest extends MergeTest {
MERGE_TEST_SG);
mergeTask.call();
- PartialPath path =
- new PartialPath(
+ MeasurementPath path =
+ SchemaTestUtils.getMeasurementPath(
deviceIds[0]
+ TsFileConstant.PATH_SEPARATOR
+ measurementSchemas[0].getMeasurementId());
@@ -426,8 +428,8 @@ public class MergeTaskTest extends MergeTest {
MERGE_TEST_SG);
mergeTask.call();
- PartialPath path =
- new PartialPath(
+ MeasurementPath path =
+ SchemaTestUtils.getMeasurementPath(
deviceIds[0]
+ TsFileConstant.PATH_SEPARATOR
+ measurementSchemas[0].getMeasurementId());
@@ -475,8 +477,8 @@ public class MergeTaskTest extends MergeTest {
MERGE_TEST_SG);
mergeTask.call();
- PartialPath path =
- new PartialPath(
+ MeasurementPath path =
+ SchemaTestUtils.getMeasurementPath(
deviceIds[0]
+ TsFileConstant.PATH_SEPARATOR
+ measurementSchemas[0].getMeasurementId());
diff --git
a/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/InnerCompactionMoreDataTest.java
b/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/InnerCompactionMoreDataTest.java
index b0489a5..572e7de 100644
---
a/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/InnerCompactionMoreDataTest.java
+++
b/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/InnerCompactionMoreDataTest.java
@@ -25,12 +25,13 @@ import
org.apache.iotdb.db.engine.compaction.CompactionScheduler;
import org.apache.iotdb.db.engine.storagegroup.TsFileManager;
import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
import org.apache.iotdb.db.exception.StorageEngineException;
-import org.apache.iotdb.db.exception.metadata.IllegalPathException;
import org.apache.iotdb.db.exception.metadata.MetadataException;
+import org.apache.iotdb.db.metadata.path.MeasurementPath;
import org.apache.iotdb.db.metadata.path.PartialPath;
import org.apache.iotdb.db.query.context.QueryContext;
import org.apache.iotdb.db.query.reader.series.SeriesRawDataBatchReader;
import org.apache.iotdb.db.service.IoTDB;
+import org.apache.iotdb.db.utils.SchemaTestUtils;
import org.apache.iotdb.tsfile.common.constant.TsFileConstant;
import org.apache.iotdb.tsfile.exception.write.WriteProcessException;
import org.apache.iotdb.tsfile.file.metadata.enums.CompressionType;
@@ -200,7 +201,7 @@ public class InnerCompactionMoreDataTest extends
InnerCompactionTest {
// test file compaction larger than 1024 sensor
@Test
- public void testSensorWithTwoOrThreeNode() throws IllegalPathException,
IOException {
+ public void testSensorWithTwoOrThreeNode() throws MetadataException,
IOException {
tsFileManager.addAll(seqResources, true);
tsFileManager.addAll(unseqResources, false);
CompactionScheduler.scheduleCompaction(tsFileManager, 0);
@@ -208,8 +209,8 @@ public class InnerCompactionMoreDataTest extends
InnerCompactionTest {
// wait
}
QueryContext context = new QueryContext();
- PartialPath path =
- new PartialPath(
+ MeasurementPath path =
+ SchemaTestUtils.getMeasurementPath(
deviceIds[0]
+ TsFileConstant.PATH_SEPARATOR
+ measurementSchemas[2688].getMeasurementId());
diff --git
a/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/sizetiered/SizeTieredCompactionRecoverTest.java
b/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/sizetiered/SizeTieredCompactionRecoverTest.java
index 305e9ab..2718642 100644
---
a/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/sizetiered/SizeTieredCompactionRecoverTest.java
+++
b/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/sizetiered/SizeTieredCompactionRecoverTest.java
@@ -29,11 +29,11 @@ import
org.apache.iotdb.db.engine.fileSystem.SystemFileFactory;
import org.apache.iotdb.db.engine.storagegroup.TsFileManager;
import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
import org.apache.iotdb.db.exception.StorageEngineException;
-import org.apache.iotdb.db.exception.metadata.IllegalPathException;
import org.apache.iotdb.db.exception.metadata.MetadataException;
-import org.apache.iotdb.db.metadata.path.PartialPath;
+import org.apache.iotdb.db.metadata.path.MeasurementPath;
import org.apache.iotdb.db.query.reader.series.SeriesRawDataBatchReader;
import org.apache.iotdb.db.utils.EnvironmentUtils;
+import org.apache.iotdb.db.utils.SchemaTestUtils;
import org.apache.iotdb.tsfile.common.constant.TsFileConstant;
import org.apache.iotdb.tsfile.exception.write.WriteProcessException;
import org.apache.iotdb.tsfile.fileSystem.FSFactoryProducer;
@@ -98,8 +98,8 @@ public class SizeTieredCompactionRecoverTest extends
InnerCompactionTest {
new TsFileManager(COMPACTION_TEST_SG, "0",
tempSGDir.getAbsolutePath());
tsFileManager.addAll(seqResources, true);
tsFileManager.addAll(unseqResources, false);
- PartialPath path =
- new PartialPath(
+ MeasurementPath path =
+ SchemaTestUtils.getMeasurementPath(
deviceIds[0]
+ TsFileConstant.PATH_SEPARATOR
+ measurementSchemas[0].getMeasurementId());
@@ -196,7 +196,7 @@ public class SizeTieredCompactionRecoverTest extends
InnerCompactionTest {
CompactionTaskManager.currentTaskNum)
.call();
path =
- new PartialPath(
+ SchemaTestUtils.getMeasurementPath(
deviceIds[0]
+ TsFileConstant.PATH_SEPARATOR
+ measurementSchemas[0].getMeasurementId());
@@ -229,8 +229,8 @@ public class SizeTieredCompactionRecoverTest extends
InnerCompactionTest {
new TsFileManager(COMPACTION_TEST_SG, "0",
tempSGDir.getAbsolutePath());
tsFileManager.addAll(seqResources, true);
tsFileManager.addAll(unseqResources, false);
- PartialPath path =
- new PartialPath(
+ MeasurementPath path =
+ SchemaTestUtils.getMeasurementPath(
deviceIds[0]
+ TsFileConstant.PATH_SEPARATOR
+ measurementSchemas[0].getMeasurementId());
@@ -301,7 +301,7 @@ public class SizeTieredCompactionRecoverTest extends
InnerCompactionTest {
CompactionTaskManager.currentTaskNum)
.call();
path =
- new PartialPath(
+ SchemaTestUtils.getMeasurementPath(
deviceIds[0]
+ TsFileConstant.PATH_SEPARATOR
+ measurementSchemas[0].getMeasurementId());
@@ -333,8 +333,8 @@ public class SizeTieredCompactionRecoverTest extends
InnerCompactionTest {
new TsFileManager(COMPACTION_TEST_SG, "0",
tempSGDir.getAbsolutePath());
tsFileManager.addAll(seqResources, true);
tsFileManager.addAll(unseqResources, false);
- PartialPath path =
- new PartialPath(
+ MeasurementPath path =
+ SchemaTestUtils.getMeasurementPath(
deviceIds[0]
+ TsFileConstant.PATH_SEPARATOR
+ measurementSchemas[0].getMeasurementId());
@@ -409,7 +409,7 @@ public class SizeTieredCompactionRecoverTest extends
InnerCompactionTest {
CompactionTaskManager.currentTaskNum)
.call();
path =
- new PartialPath(
+ SchemaTestUtils.getMeasurementPath(
deviceIds[0]
+ TsFileConstant.PATH_SEPARATOR
+ measurementSchemas[0].getMeasurementId());
@@ -442,8 +442,8 @@ public class SizeTieredCompactionRecoverTest extends
InnerCompactionTest {
new TsFileManager(COMPACTION_TEST_SG, "0",
tempSGDir.getAbsolutePath());
tsFileManager.addAll(seqResources, true);
tsFileManager.addAll(unseqResources, false);
- PartialPath path =
- new PartialPath(
+ MeasurementPath path =
+ SchemaTestUtils.getMeasurementPath(
deviceIds[0]
+ TsFileConstant.PATH_SEPARATOR
+ measurementSchemas[0].getMeasurementId());
@@ -520,7 +520,7 @@ public class SizeTieredCompactionRecoverTest extends
InnerCompactionTest {
CompactionTaskManager.currentTaskNum)
.call();
path =
- new PartialPath(
+ SchemaTestUtils.getMeasurementPath(
deviceIds[0]
+ TsFileConstant.PATH_SEPARATOR
+ measurementSchemas[0].getMeasurementId());
@@ -550,7 +550,7 @@ public class SizeTieredCompactionRecoverTest extends
InnerCompactionTest {
/** compaction recover merge start just log source file */
@Test
public void testCompactionMergeRecoverMergeStartSourceLog()
- throws IOException, IllegalPathException {
+ throws IOException, MetadataException {
tsFileManager.addAll(seqResources, true);
tsFileManager.addAll(unseqResources, false);
SizeTieredCompactionLogger sizeTieredCompactionLogger =
@@ -559,8 +559,8 @@ public class SizeTieredCompactionRecoverTest extends
InnerCompactionTest {
sizeTieredCompactionLogger.logFile(SOURCE_NAME,
seqResources.get(1).getTsFile());
sizeTieredCompactionLogger.logFile(SOURCE_NAME,
seqResources.get(2).getTsFile());
sizeTieredCompactionLogger.close();
- PartialPath path =
- new PartialPath(
+ MeasurementPath path =
+ SchemaTestUtils.getMeasurementPath(
deviceIds[0]
+ TsFileConstant.PATH_SEPARATOR
+ measurementSchemas[0].getMeasurementId());
@@ -589,7 +589,7 @@ public class SizeTieredCompactionRecoverTest extends
InnerCompactionTest {
/** compaction recover merge start just log source file and sequence flag */
@Test
public void testCompactionMergeRecoverMergeStartSequenceLog()
- throws IOException, IllegalPathException {
+ throws IOException, MetadataException {
tsFileManager.addAll(seqResources, true);
tsFileManager.addAll(unseqResources, false);
SizeTieredCompactionLogger sizeTieredCompactionLogger =
@@ -599,8 +599,8 @@ public class SizeTieredCompactionRecoverTest extends
InnerCompactionTest {
sizeTieredCompactionLogger.logFile(SOURCE_NAME,
seqResources.get(2).getTsFile());
sizeTieredCompactionLogger.logSequence(true);
sizeTieredCompactionLogger.close();
- PartialPath path =
- new PartialPath(
+ MeasurementPath path =
+ SchemaTestUtils.getMeasurementPath(
deviceIds[0]
+ TsFileConstant.PATH_SEPARATOR
+ measurementSchemas[0].getMeasurementId());
@@ -628,7 +628,7 @@ public class SizeTieredCompactionRecoverTest extends
InnerCompactionTest {
/** compaction recover merge start target file logged */
@Test
- public void testCompactionMergeRecoverMergeStart() throws IOException,
IllegalPathException {
+ public void testCompactionMergeRecoverMergeStart() throws IOException,
MetadataException {
tsFileManager.addAll(seqResources, true);
tsFileManager.addAll(unseqResources, false);
SizeTieredCompactionLogger sizeTieredCompactionLogger =
@@ -653,8 +653,8 @@ public class SizeTieredCompactionRecoverTest extends
InnerCompactionTest {
sizeTieredCompactionLogger.logFile(TARGET_NAME,
targetTsFileResource.getTsFile());
tsFileManager.addForRecover(targetTsFileResource, true);
sizeTieredCompactionLogger.close();
- PartialPath path =
- new PartialPath(
+ MeasurementPath path =
+ SchemaTestUtils.getMeasurementPath(
deviceIds[0]
+ TsFileConstant.PATH_SEPARATOR
+ measurementSchemas[0].getMeasurementId());
diff --git
a/server/src/test/java/org/apache/iotdb/db/engine/modification/DeletionFileNodeTest.java
b/server/src/test/java/org/apache/iotdb/db/engine/modification/DeletionFileNodeTest.java
index 15616f7..d585a5a 100644
---
a/server/src/test/java/org/apache/iotdb/db/engine/modification/DeletionFileNodeTest.java
+++
b/server/src/test/java/org/apache/iotdb/db/engine/modification/DeletionFileNodeTest.java
@@ -36,6 +36,7 @@ import org.apache.iotdb.db.qp.physical.crud.InsertRowPlan;
import org.apache.iotdb.db.query.control.QueryResourceManager;
import org.apache.iotdb.db.service.IoTDB;
import org.apache.iotdb.db.utils.EnvironmentUtils;
+import org.apache.iotdb.db.utils.SchemaTestUtils;
import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
import org.apache.iotdb.tsfile.common.constant.TsFileConstant;
import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
@@ -97,7 +98,7 @@ public class DeletionFileNodeTest {
@Test
public void testDeleteInBufferWriteCache()
- throws StorageEngineException, QueryProcessException, IOException,
IllegalPathException {
+ throws StorageEngineException, QueryProcessException, IOException,
MetadataException {
for (int i = 1; i <= 100; i++) {
TSRecord record = new TSRecord(i, processorName);
@@ -146,6 +147,8 @@ public class DeletionFileNodeTest {
-1,
(storageGroupName, timePartitionId) -> timePartitionId < 5);
checkSeriesPointCount(0, 5);
+ } catch (MetadataException e) {
+ e.printStackTrace();
} finally {
StorageEngine.setEnablePartition(prevEnablePartition);
StorageEngine.setTimePartitionInterval(prevPartitionInterval);
@@ -156,10 +159,10 @@ public class DeletionFileNodeTest {
}
private void checkSeriesPointCount(int measurementIdx, int expectedCount)
- throws IllegalPathException, StorageEngineException,
QueryProcessException, IOException {
+ throws MetadataException, StorageEngineException, QueryProcessException,
IOException {
SingleSeriesExpression expression =
new SingleSeriesExpression(
- new PartialPath(
+ SchemaTestUtils.getMeasurementPath(
processorName + TsFileConstant.PATH_SEPARATOR +
measurements[measurementIdx]),
null);
List<StorageGroupProcessor> list =
@@ -265,7 +268,7 @@ public class DeletionFileNodeTest {
@Test
public void testDeleteInOverflowCache()
- throws StorageEngineException, QueryProcessException, IOException,
IllegalPathException {
+ throws StorageEngineException, QueryProcessException, IOException,
MetadataException {
// insert sequence data
for (int i = 101; i <= 200; i++) {
TSRecord record = new TSRecord(i, processorName);
@@ -296,7 +299,9 @@ public class DeletionFileNodeTest {
SingleSeriesExpression expression =
new SingleSeriesExpression(
- new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR +
measurements[5]), null);
+ SchemaTestUtils.getMeasurementPath(
+ processorName + TsFileConstant.PATH_SEPARATOR +
measurements[5]),
+ null);
List<StorageGroupProcessor> list =
StorageEngine.getInstance()
diff --git
a/server/src/test/java/org/apache/iotdb/db/engine/modification/DeletionQueryTest.java
b/server/src/test/java/org/apache/iotdb/db/engine/modification/DeletionQueryTest.java
index ce9dda3..c01a20d 100644
---
a/server/src/test/java/org/apache/iotdb/db/engine/modification/DeletionQueryTest.java
+++
b/server/src/test/java/org/apache/iotdb/db/engine/modification/DeletionQueryTest.java
@@ -21,7 +21,6 @@ package org.apache.iotdb.db.engine.modification;
import org.apache.iotdb.db.engine.StorageEngine;
import org.apache.iotdb.db.exception.StorageEngineException;
-import org.apache.iotdb.db.exception.metadata.IllegalPathException;
import org.apache.iotdb.db.exception.metadata.MetadataException;
import org.apache.iotdb.db.exception.query.QueryProcessException;
import org.apache.iotdb.db.metadata.path.PartialPath;
@@ -30,6 +29,7 @@ import org.apache.iotdb.db.qp.physical.crud.RawDataQueryPlan;
import org.apache.iotdb.db.query.executor.QueryRouter;
import org.apache.iotdb.db.service.IoTDB;
import org.apache.iotdb.db.utils.EnvironmentUtils;
+import org.apache.iotdb.db.utils.SchemaTestUtils;
import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
import org.apache.iotdb.tsfile.common.constant.TsFileConstant;
import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
@@ -86,7 +86,7 @@ public class DeletionQueryTest {
@Test
public void testDeleteInBufferWriteCache()
- throws StorageEngineException, IOException, QueryProcessException,
IllegalPathException {
+ throws StorageEngineException, IOException, QueryProcessException,
MetadataException {
for (int i = 1; i <= 100; i++) {
TSRecord record = new TSRecord(i, processorName);
@@ -106,16 +106,17 @@ public class DeletionQueryTest {
.delete(new PartialPath(processorName, measurements[5]), 30, 50, -1,
null);
List<PartialPath> pathList = new ArrayList<>();
- pathList.add(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR
+ measurements[3]));
- pathList.add(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR
+ measurements[4]));
- pathList.add(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR
+ measurements[5]));
- List<TSDataType> dataTypes = new ArrayList<>();
- dataTypes.add(dataType);
- dataTypes.add(dataType);
- dataTypes.add(dataType);
+ pathList.add(
+ SchemaTestUtils.getMeasurementPath(
+ processorName + TsFileConstant.PATH_SEPARATOR + measurements[3]));
+ pathList.add(
+ SchemaTestUtils.getMeasurementPath(
+ processorName + TsFileConstant.PATH_SEPARATOR + measurements[4]));
+ pathList.add(
+ SchemaTestUtils.getMeasurementPath(
+ processorName + TsFileConstant.PATH_SEPARATOR + measurements[5]));
RawDataQueryPlan queryPlan = new RawDataQueryPlan();
- queryPlan.setDeduplicatedDataTypes(dataTypes);
queryPlan.setDeduplicatedPathsAndUpdate(pathList);
QueryDataSet dataSet = router.rawDataQuery(queryPlan, TEST_QUERY_CONTEXT);
@@ -129,7 +130,7 @@ public class DeletionQueryTest {
@Test
public void testDeleteInBufferWriteFile()
- throws StorageEngineException, IOException, QueryProcessException,
IllegalPathException {
+ throws StorageEngineException, IOException, QueryProcessException,
MetadataException {
for (int i = 1; i <= 100; i++) {
TSRecord record = new TSRecord(i, processorName);
for (int j = 0; j < 10; j++) {
@@ -147,17 +148,17 @@ public class DeletionQueryTest {
.delete(new PartialPath(processorName, measurements[3]), 0, 30, -1,
null);
List<PartialPath> pathList = new ArrayList<>();
- pathList.add(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR
+ measurements[3]));
- pathList.add(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR
+ measurements[4]));
- pathList.add(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR
+ measurements[5]));
-
- List<TSDataType> dataTypes = new ArrayList<>();
- dataTypes.add(dataType);
- dataTypes.add(dataType);
- dataTypes.add(dataType);
+ pathList.add(
+ SchemaTestUtils.getMeasurementPath(
+ processorName + TsFileConstant.PATH_SEPARATOR + measurements[3]));
+ pathList.add(
+ SchemaTestUtils.getMeasurementPath(
+ processorName + TsFileConstant.PATH_SEPARATOR + measurements[4]));
+ pathList.add(
+ SchemaTestUtils.getMeasurementPath(
+ processorName + TsFileConstant.PATH_SEPARATOR + measurements[5]));
RawDataQueryPlan queryPlan = new RawDataQueryPlan();
- queryPlan.setDeduplicatedDataTypes(dataTypes);
queryPlan.setDeduplicatedPathsAndUpdate(pathList);
QueryDataSet dataSet = router.rawDataQuery(queryPlan, TEST_QUERY_CONTEXT);
@@ -171,7 +172,7 @@ public class DeletionQueryTest {
@Test
public void testDeleteInOverflowCache()
- throws StorageEngineException, IOException, QueryProcessException,
IllegalPathException {
+ throws StorageEngineException, IOException, QueryProcessException,
MetadataException {
// insert into BufferWrite
for (int i = 101; i <= 200; i++) {
TSRecord record = new TSRecord(i, processorName);
@@ -201,16 +202,17 @@ public class DeletionQueryTest {
.delete(new PartialPath(processorName, measurements[5]), 30, 50, -1,
null);
List<PartialPath> pathList = new ArrayList<>();
- pathList.add(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR
+ measurements[3]));
- pathList.add(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR
+ measurements[4]));
- pathList.add(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR
+ measurements[5]));
- List<TSDataType> dataTypes = new ArrayList<>();
- dataTypes.add(dataType);
- dataTypes.add(dataType);
- dataTypes.add(dataType);
+ pathList.add(
+ SchemaTestUtils.getMeasurementPath(
+ processorName + TsFileConstant.PATH_SEPARATOR + measurements[3]));
+ pathList.add(
+ SchemaTestUtils.getMeasurementPath(
+ processorName + TsFileConstant.PATH_SEPARATOR + measurements[4]));
+ pathList.add(
+ SchemaTestUtils.getMeasurementPath(
+ processorName + TsFileConstant.PATH_SEPARATOR + measurements[5]));
RawDataQueryPlan queryPlan = new RawDataQueryPlan();
- queryPlan.setDeduplicatedDataTypes(dataTypes);
queryPlan.setDeduplicatedPathsAndUpdate(pathList);
QueryDataSet dataSet = router.rawDataQuery(queryPlan, TEST_QUERY_CONTEXT);
@@ -224,7 +226,7 @@ public class DeletionQueryTest {
@Test
public void testDeleteInOverflowFile()
- throws StorageEngineException, IOException, QueryProcessException,
IllegalPathException {
+ throws StorageEngineException, IOException, QueryProcessException,
MetadataException {
// insert into BufferWrite
for (int i = 101; i <= 200; i++) {
TSRecord record = new TSRecord(i, processorName);
@@ -253,17 +255,17 @@ public class DeletionQueryTest {
.delete(new PartialPath(processorName, measurements[3]), 0, 30, -1,
null);
List<PartialPath> pathList = new ArrayList<>();
- pathList.add(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR
+ measurements[3]));
- pathList.add(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR
+ measurements[4]));
- pathList.add(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR
+ measurements[5]));
-
- List<TSDataType> dataTypes = new ArrayList<>();
- dataTypes.add(dataType);
- dataTypes.add(dataType);
- dataTypes.add(dataType);
+ pathList.add(
+ SchemaTestUtils.getMeasurementPath(
+ processorName + TsFileConstant.PATH_SEPARATOR + measurements[3]));
+ pathList.add(
+ SchemaTestUtils.getMeasurementPath(
+ processorName + TsFileConstant.PATH_SEPARATOR + measurements[4]));
+ pathList.add(
+ SchemaTestUtils.getMeasurementPath(
+ processorName + TsFileConstant.PATH_SEPARATOR + measurements[5]));
RawDataQueryPlan queryPlan = new RawDataQueryPlan();
- queryPlan.setDeduplicatedDataTypes(dataTypes);
queryPlan.setDeduplicatedPathsAndUpdate(pathList);
QueryDataSet dataSet = router.rawDataQuery(queryPlan, TEST_QUERY_CONTEXT);
@@ -277,7 +279,7 @@ public class DeletionQueryTest {
@Test
public void testSuccessiveDeletion()
- throws StorageEngineException, IOException, QueryProcessException,
IllegalPathException {
+ throws StorageEngineException, IOException, QueryProcessException,
MetadataException {
for (int i = 1; i <= 100; i++) {
TSRecord record = new TSRecord(i, processorName);
for (int j = 0; j < 10; j++) {
@@ -336,16 +338,17 @@ public class DeletionQueryTest {
StorageEngine.getInstance().syncCloseAllProcessor();
List<PartialPath> pathList = new ArrayList<>();
- pathList.add(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR
+ measurements[3]));
- pathList.add(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR
+ measurements[4]));
- pathList.add(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR
+ measurements[5]));
- List<TSDataType> dataTypes = new ArrayList<>();
- dataTypes.add(dataType);
- dataTypes.add(dataType);
- dataTypes.add(dataType);
+ pathList.add(
+ SchemaTestUtils.getMeasurementPath(
+ processorName + TsFileConstant.PATH_SEPARATOR + measurements[3]));
+ pathList.add(
+ SchemaTestUtils.getMeasurementPath(
+ processorName + TsFileConstant.PATH_SEPARATOR + measurements[4]));
+ pathList.add(
+ SchemaTestUtils.getMeasurementPath(
+ processorName + TsFileConstant.PATH_SEPARATOR + measurements[5]));
RawDataQueryPlan queryPlan = new RawDataQueryPlan();
- queryPlan.setDeduplicatedDataTypes(dataTypes);
queryPlan.setDeduplicatedPathsAndUpdate(pathList);
QueryDataSet dataSet = router.rawDataQuery(queryPlan, TEST_QUERY_CONTEXT);
diff --git
a/server/src/test/java/org/apache/iotdb/db/engine/storagegroup/TTLTest.java
b/server/src/test/java/org/apache/iotdb/db/engine/storagegroup/TTLTest.java
index 1abe173..75394ba 100644
--- a/server/src/test/java/org/apache/iotdb/db/engine/storagegroup/TTLTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/engine/storagegroup/TTLTest.java
@@ -36,6 +36,7 @@ import
org.apache.iotdb.db.exception.query.QueryProcessException;
import org.apache.iotdb.db.metadata.mnode.IMeasurementMNode;
import org.apache.iotdb.db.metadata.mnode.IStorageGroupMNode;
import org.apache.iotdb.db.metadata.mnode.MeasurementMNode;
+import org.apache.iotdb.db.metadata.path.MeasurementPath;
import org.apache.iotdb.db.metadata.path.PartialPath;
import org.apache.iotdb.db.qp.Planner;
import org.apache.iotdb.db.qp.executor.PlanExecutor;
@@ -45,6 +46,7 @@ import org.apache.iotdb.db.qp.physical.sys.ShowTTLPlan;
import org.apache.iotdb.db.query.reader.series.SeriesRawDataBatchReader;
import org.apache.iotdb.db.service.IoTDB;
import org.apache.iotdb.db.utils.EnvironmentUtils;
+import org.apache.iotdb.db.utils.SchemaTestUtils;
import org.apache.iotdb.tsfile.common.constant.TsFileConstant;
import
org.apache.iotdb.tsfile.exception.filter.QueryFilterOptimizationException;
import org.apache.iotdb.tsfile.file.metadata.enums.CompressionType;
@@ -217,13 +219,16 @@ public class TTLTest {
@Test
public void testTTLRead()
throws IOException, WriteProcessException, StorageEngineException,
QueryProcessException,
- IllegalPathException {
+ MetadataException {
prepareData();
// files before ttl
QueryDataSource dataSource =
storageGroupProcessor.query(
- new PartialPath(sg1, s1), EnvironmentUtils.TEST_QUERY_CONTEXT,
null, null);
+ SchemaTestUtils.getMeasurementPath(sg1 +
TsFileConstant.PATH_SEPARATOR + s1),
+ EnvironmentUtils.TEST_QUERY_CONTEXT,
+ null,
+ null);
List<TsFileResource> seqResource = dataSource.getSeqResources();
List<TsFileResource> unseqResource = dataSource.getUnseqResources();
assertEquals(4, seqResource.size());
@@ -239,7 +244,8 @@ public class TTLTest {
unseqResource = dataSource.getUnseqResources();
assertTrue(seqResource.size() < 4);
assertEquals(0, unseqResource.size());
- PartialPath path = new PartialPath(sg1 + TsFileConstant.PATH_SEPARATOR +
s1);
+ MeasurementPath path =
+ SchemaTestUtils.getMeasurementPath(sg1 + TsFileConstant.PATH_SEPARATOR
+ s1);
Set<String> allSensors = new HashSet<>();
allSensors.add(s1);
IBatchReader reader =
diff --git
a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBEngineTimeGeneratorIT.java
b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBEngineTimeGeneratorIT.java
index 61a76ef..b3ce319 100644
---
a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBEngineTimeGeneratorIT.java
+++
b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBEngineTimeGeneratorIT.java
@@ -21,12 +21,14 @@ package org.apache.iotdb.db.integration;
import org.apache.iotdb.db.conf.IoTDBDescriptor;
import org.apache.iotdb.db.constant.TestConstant;
import org.apache.iotdb.db.exception.StorageEngineException;
-import org.apache.iotdb.db.exception.metadata.IllegalPathException;
+import org.apache.iotdb.db.exception.metadata.MetadataException;
import org.apache.iotdb.db.exception.query.QueryProcessException;
+import org.apache.iotdb.db.metadata.path.MeasurementPath;
import org.apache.iotdb.db.metadata.path.PartialPath;
import org.apache.iotdb.db.qp.physical.crud.RawDataQueryPlan;
import org.apache.iotdb.db.query.timegenerator.ServerTimeGenerator;
import org.apache.iotdb.db.utils.EnvironmentUtils;
+import org.apache.iotdb.db.utils.SchemaTestUtils;
import org.apache.iotdb.jdbc.Config;
import org.apache.iotdb.tsfile.common.conf.TSFileConfig;
import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
@@ -89,9 +91,9 @@ public class IoTDBEngineTimeGeneratorIT {
insertData();
}
+ // recovery value
@AfterClass
public static void tearDown() throws Exception {
- // recovery value
tsFileConfig.setMaxNumberOfPointsInPage(maxNumberOfPointsInPage);
tsFileConfig.setPageSizeInByte(pageSizeInByte);
tsFileConfig.setGroupSizeInByte(groupSizeInByte);
@@ -189,12 +191,13 @@ public class IoTDBEngineTimeGeneratorIT {
/** value >= 14 && time > 500 */
@Test
public void testOneSeriesWithValueAndTimeFilter()
- throws IOException, StorageEngineException, IllegalPathException,
QueryProcessException {
+ throws IOException, StorageEngineException, MetadataException,
QueryProcessException {
// System.out.println("Test >>> root.vehicle.d0.s0 >= 14 && time > 500");
- PartialPath pd0s0 =
- new PartialPath(TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s0);
- ValueFilter.ValueGtEq valueGtEq = ValueFilter.gtEq(14);
+ MeasurementPath pd0s0 =
+ SchemaTestUtils.getMeasurementPath(
+ TestConstant.d0 + TsFileConstant.PATH_SEPARATOR + TestConstant.s0);
+ ValueFilter.ValueGtEq<Integer> valueGtEq = ValueFilter.gtEq(14);
TimeFilter.TimeGt timeGt = TimeFilter.gt(500);
SingleSeriesExpression singleSeriesExpression =
@@ -219,12 +222,13 @@ public class IoTDBEngineTimeGeneratorIT {
/** root.vehicle.d1.s0 >= 5, and d1.s0 has no data */
@Test
public void testEmptySeriesWithValueFilter()
- throws IOException, StorageEngineException, IllegalPathException,
QueryProcessException {
+ throws IOException, StorageEngineException, MetadataException,
QueryProcessException {
// System.out.println("Test >>> root.vehicle.d1.s0 >= 5");
- PartialPath pd1s0 =
- new PartialPath(TestConstant.d1 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s0);
- ValueFilter.ValueGtEq valueGtEq = ValueFilter.gtEq(5);
+ MeasurementPath pd1s0 =
+ SchemaTestUtils.getMeasurementPath(
+ TestConstant.d1 + TsFileConstant.PATH_SEPARATOR + TestConstant.s0);
+ ValueFilter.ValueGtEq<Integer> valueGtEq = ValueFilter.gtEq(5);
IExpression singleSeriesExpression = new SingleSeriesExpression(pd1s0,
valueGtEq);
RawDataQueryPlan queryPlan = new RawDataQueryPlan();
@@ -244,17 +248,19 @@ public class IoTDBEngineTimeGeneratorIT {
/** root.vehicle.d0.s0 >= 5 && root.vehicle.d0.s2 >= 11.5 || time > 900 */
@Test
public void testMultiSeriesWithValueFilterAndTimeFilter()
- throws IOException, StorageEngineException, IllegalPathException,
QueryProcessException {
+ throws IOException, StorageEngineException, MetadataException,
QueryProcessException {
System.out.println(
"Test >>> root.vehicle.d0.s0 >= 5 && root.vehicle.d0.s2 >= 11.5 ||
time > 900");
- PartialPath pd0s0 =
- new PartialPath(TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s0);
- PartialPath pd0s2 =
- new PartialPath(TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s2);
+ MeasurementPath pd0s0 =
+ SchemaTestUtils.getMeasurementPath(
+ TestConstant.d0 + TsFileConstant.PATH_SEPARATOR + TestConstant.s0);
+ MeasurementPath pd0s2 =
+ SchemaTestUtils.getMeasurementPath(
+ TestConstant.d0 + TsFileConstant.PATH_SEPARATOR + TestConstant.s2);
- ValueFilter.ValueGtEq valueGtEq5 = ValueFilter.gtEq(5);
- ValueFilter.ValueGtEq valueGtEq11 = ValueFilter.gtEq(11.5f);
+ ValueFilter.ValueGtEq<Integer> valueGtEq5 = ValueFilter.gtEq(5);
+ ValueFilter.ValueGtEq<Float> valueGtEq11 = ValueFilter.gtEq(11.5f);
TimeFilter.TimeGt timeGt = TimeFilter.gt(900L);
IExpression singleSeriesExpression1 =
diff --git
a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBMultiSeriesIT.java
b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBMultiSeriesIT.java
index faa554c..0776bd2 100644
---
a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBMultiSeriesIT.java
+++
b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBMultiSeriesIT.java
@@ -462,7 +462,7 @@ public class IoTDBMultiSeriesIT {
fail("not throw exception when unknown time series in where clause");
} catch (SQLException e) {
assertEquals(
- "411: Error occurred in query process: Path [root.vehicle.d0.s10]
does not exist",
+ "411: Error occurred in query process: Unknown time series
root.vehicle.d0.s10 in `where clause`",
e.getMessage());
}
}
diff --git
a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBSequenceDataQueryIT.java
b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBSequenceDataQueryIT.java
index c3a76b1..50b0eea 100644
---
a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBSequenceDataQueryIT.java
+++
b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBSequenceDataQueryIT.java
@@ -21,12 +21,13 @@ package org.apache.iotdb.db.integration;
import org.apache.iotdb.db.conf.IoTDBDescriptor;
import org.apache.iotdb.db.constant.TestConstant;
import org.apache.iotdb.db.exception.StorageEngineException;
-import org.apache.iotdb.db.exception.metadata.IllegalPathException;
+import org.apache.iotdb.db.exception.metadata.MetadataException;
import org.apache.iotdb.db.exception.query.QueryProcessException;
import org.apache.iotdb.db.metadata.path.PartialPath;
import org.apache.iotdb.db.qp.physical.crud.RawDataQueryPlan;
import org.apache.iotdb.db.query.executor.QueryRouter;
import org.apache.iotdb.db.utils.EnvironmentUtils;
+import org.apache.iotdb.db.utils.SchemaTestUtils;
import org.apache.iotdb.jdbc.Config;
import org.apache.iotdb.tsfile.common.conf.TSFileConfig;
import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
@@ -176,35 +177,33 @@ public class IoTDBSequenceDataQueryIT {
@Test
public void readWithoutFilterTest()
- throws IOException, StorageEngineException, QueryProcessException,
IllegalPathException {
+ throws IOException, StorageEngineException, QueryProcessException,
MetadataException {
QueryRouter queryRouter = new QueryRouter();
List<PartialPath> pathList = new ArrayList<>();
- List<TSDataType> dataTypes = new ArrayList<>();
pathList.add(
- new PartialPath(TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s0));
- dataTypes.add(TSDataType.INT32);
+ SchemaTestUtils.getMeasurementPath(
+ TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s0));
pathList.add(
- new PartialPath(TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s1));
- dataTypes.add(TSDataType.INT64);
+ SchemaTestUtils.getMeasurementPath(
+ TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s1));
pathList.add(
- new PartialPath(TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s2));
- dataTypes.add(TSDataType.FLOAT);
+ SchemaTestUtils.getMeasurementPath(
+ TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s2));
pathList.add(
- new PartialPath(TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s3));
- dataTypes.add(TSDataType.TEXT);
+ SchemaTestUtils.getMeasurementPath(
+ TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s3));
pathList.add(
- new PartialPath(TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s4));
- dataTypes.add(TSDataType.BOOLEAN);
+ SchemaTestUtils.getMeasurementPath(
+ TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s4));
pathList.add(
- new PartialPath(TestConstant.d1 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s0));
- dataTypes.add(TSDataType.INT32);
+ SchemaTestUtils.getMeasurementPath(
+ TestConstant.d1 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s0));
pathList.add(
- new PartialPath(TestConstant.d1 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s1));
- dataTypes.add(TSDataType.INT64);
+ SchemaTestUtils.getMeasurementPath(
+ TestConstant.d1 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s1));
RawDataQueryPlan queryPlan = new RawDataQueryPlan();
- queryPlan.setDeduplicatedDataTypes(dataTypes);
queryPlan.setDeduplicatedPathsAndUpdate(pathList);
QueryDataSet queryDataSet = queryRouter.rawDataQuery(queryPlan,
TEST_QUERY_CONTEXT);
@@ -218,24 +217,22 @@ public class IoTDBSequenceDataQueryIT {
@Test
public void readWithTimeFilterTest()
- throws IOException, StorageEngineException, QueryProcessException,
IllegalPathException {
+ throws IOException, StorageEngineException, QueryProcessException,
MetadataException {
QueryRouter queryRouter = new QueryRouter();
List<PartialPath> pathList = new ArrayList<>();
- List<TSDataType> dataTypes = new ArrayList<>();
pathList.add(
- new PartialPath(TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s0));
- dataTypes.add(TSDataType.INT32);
+ SchemaTestUtils.getMeasurementPath(
+ TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s0));
pathList.add(
- new PartialPath(TestConstant.d1 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s0));
- dataTypes.add(TSDataType.INT32);
+ SchemaTestUtils.getMeasurementPath(
+ TestConstant.d1 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s0));
pathList.add(
- new PartialPath(TestConstant.d1 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s1));
- dataTypes.add(TSDataType.INT64);
+ SchemaTestUtils.getMeasurementPath(
+ TestConstant.d1 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s1));
GlobalTimeExpression globalTimeExpression = new
GlobalTimeExpression(TimeFilter.gtEq(800L));
RawDataQueryPlan queryPlan = new RawDataQueryPlan();
- queryPlan.setDeduplicatedDataTypes(dataTypes);
queryPlan.setDeduplicatedPathsAndUpdate(pathList);
queryPlan.setExpression(globalTimeExpression);
QueryDataSet queryDataSet = queryRouter.rawDataQuery(queryPlan,
TEST_QUERY_CONTEXT);
@@ -253,40 +250,39 @@ public class IoTDBSequenceDataQueryIT {
@Test
public void readWithValueFilterTest()
- throws IOException, StorageEngineException, QueryProcessException,
IllegalPathException {
+ throws IOException, StorageEngineException, QueryProcessException,
MetadataException {
// select * from root.** where root.vehicle.d0.s0 >=14
QueryRouter queryRouter = new QueryRouter();
List<PartialPath> pathList = new ArrayList<>();
- List<TSDataType> dataTypes = new ArrayList<>();
pathList.add(
- new PartialPath(TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s0));
- dataTypes.add(TSDataType.INT32);
+ SchemaTestUtils.getMeasurementPath(
+ TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s0));
pathList.add(
- new PartialPath(TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s1));
- dataTypes.add(TSDataType.INT64);
+ SchemaTestUtils.getMeasurementPath(
+ TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s1));
pathList.add(
- new PartialPath(TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s2));
- dataTypes.add(TSDataType.FLOAT);
+ SchemaTestUtils.getMeasurementPath(
+ TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s2));
pathList.add(
- new PartialPath(TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s3));
- dataTypes.add(TSDataType.TEXT);
+ SchemaTestUtils.getMeasurementPath(
+ TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s3));
pathList.add(
- new PartialPath(TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s4));
- dataTypes.add(TSDataType.BOOLEAN);
+ SchemaTestUtils.getMeasurementPath(
+ TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s4));
pathList.add(
- new PartialPath(TestConstant.d1 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s0));
- dataTypes.add(TSDataType.INT32);
+ SchemaTestUtils.getMeasurementPath(
+ TestConstant.d1 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s0));
pathList.add(
- new PartialPath(TestConstant.d1 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s1));
- dataTypes.add(TSDataType.INT64);
+ SchemaTestUtils.getMeasurementPath(
+ TestConstant.d1 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s1));
Path queryPath =
- new PartialPath(TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s0);
+ SchemaTestUtils.getMeasurementPath(
+ TestConstant.d0 + TsFileConstant.PATH_SEPARATOR + TestConstant.s0);
SingleSeriesExpression singleSeriesExpression =
new SingleSeriesExpression(queryPath, ValueFilter.gtEq(14));
RawDataQueryPlan queryPlan = new RawDataQueryPlan();
- queryPlan.setDeduplicatedDataTypes(dataTypes);
queryPlan.setDeduplicatedPathsAndUpdate(pathList);
queryPlan.setExpression(singleSeriesExpression);
QueryDataSet queryDataSet = queryRouter.rawDataQuery(queryPlan,
TEST_QUERY_CONTEXT);
@@ -301,7 +297,7 @@ public class IoTDBSequenceDataQueryIT {
@Test
public void readIncorrectTimeFilterTest()
- throws IllegalPathException, QueryProcessException,
StorageEngineException, IOException {
+ throws MetadataException, QueryProcessException, StorageEngineException,
IOException {
QueryRouter queryRouter = new QueryRouter();
List<PartialPath> pathList = new ArrayList<>();
@@ -320,7 +316,6 @@ public class IoTDBSequenceDataQueryIT {
GlobalTimeExpression globalTimeExpression = new
GlobalTimeExpression(andFilter);
RawDataQueryPlan queryPlan = new RawDataQueryPlan();
- queryPlan.setDeduplicatedDataTypes(dataTypes);
queryPlan.setDeduplicatedPathsAndUpdate(pathList);
queryPlan.setExpression(globalTimeExpression);
QueryDataSet queryDataSet = queryRouter.rawDataQuery(queryPlan,
TEST_QUERY_CONTEXT);
diff --git
a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBSeriesReaderIT.java
b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBSeriesReaderIT.java
index 11c822a..df321c0 100644
---
a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBSeriesReaderIT.java
+++
b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBSeriesReaderIT.java
@@ -21,17 +21,18 @@ package org.apache.iotdb.db.integration;
import org.apache.iotdb.db.conf.IoTDBDescriptor;
import org.apache.iotdb.db.constant.TestConstant;
import org.apache.iotdb.db.exception.StorageEngineException;
-import org.apache.iotdb.db.exception.metadata.IllegalPathException;
+import org.apache.iotdb.db.exception.metadata.MetadataException;
import org.apache.iotdb.db.exception.query.QueryProcessException;
+import org.apache.iotdb.db.metadata.path.MeasurementPath;
import org.apache.iotdb.db.metadata.path.PartialPath;
import org.apache.iotdb.db.qp.physical.crud.RawDataQueryPlan;
import org.apache.iotdb.db.query.executor.QueryRouter;
import org.apache.iotdb.db.utils.EnvironmentUtils;
+import org.apache.iotdb.db.utils.SchemaTestUtils;
import org.apache.iotdb.jdbc.Config;
import org.apache.iotdb.tsfile.common.conf.TSFileConfig;
import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
import org.apache.iotdb.tsfile.common.constant.TsFileConstant;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
import org.apache.iotdb.tsfile.read.expression.impl.SingleSeriesExpression;
import org.apache.iotdb.tsfile.read.filter.TimeFilter;
import org.apache.iotdb.tsfile.read.filter.ValueFilter;
@@ -274,37 +275,35 @@ public class IoTDBSeriesReaderIT {
@Test
public void selectAllTest()
- throws IOException, StorageEngineException, QueryProcessException,
IllegalPathException {
+ throws IOException, StorageEngineException, QueryProcessException,
MetadataException {
QueryRouter queryRouter = new QueryRouter();
List<PartialPath> pathList = new ArrayList<>();
- List<TSDataType> dataTypes = new ArrayList<>();
pathList.add(
- new PartialPath(TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s0));
- dataTypes.add(TSDataType.INT32);
+ SchemaTestUtils.getMeasurementPath(
+ TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s0));
pathList.add(
- new PartialPath(TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s1));
- dataTypes.add(TSDataType.INT64);
+ SchemaTestUtils.getMeasurementPath(
+ TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s1));
pathList.add(
- new PartialPath(TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s2));
- dataTypes.add(TSDataType.FLOAT);
+ SchemaTestUtils.getMeasurementPath(
+ TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s2));
pathList.add(
- new PartialPath(TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s3));
- dataTypes.add(TSDataType.TEXT);
+ SchemaTestUtils.getMeasurementPath(
+ TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s3));
pathList.add(
- new PartialPath(TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s4));
- dataTypes.add(TSDataType.BOOLEAN);
+ SchemaTestUtils.getMeasurementPath(
+ TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s4));
pathList.add(
- new PartialPath(TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s5));
- dataTypes.add(TSDataType.DOUBLE);
+ SchemaTestUtils.getMeasurementPath(
+ TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s5));
pathList.add(
- new PartialPath(TestConstant.d1 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s0));
- dataTypes.add(TSDataType.INT32);
+ SchemaTestUtils.getMeasurementPath(
+ TestConstant.d1 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s0));
pathList.add(
- new PartialPath(TestConstant.d1 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s1));
- dataTypes.add(TSDataType.INT64);
+ SchemaTestUtils.getMeasurementPath(
+ TestConstant.d1 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s1));
RawDataQueryPlan queryPlan = new RawDataQueryPlan();
- queryPlan.setDeduplicatedDataTypes(dataTypes);
queryPlan.setDeduplicatedPathsAndUpdate(pathList);
QueryDataSet queryDataSet = queryRouter.rawDataQuery(queryPlan,
TEST_QUERY_CONTEXT);
@@ -318,19 +317,17 @@ public class IoTDBSeriesReaderIT {
@Test
public void selectOneSeriesWithValueFilterTest()
- throws IOException, StorageEngineException, QueryProcessException,
IllegalPathException {
+ throws IOException, StorageEngineException, QueryProcessException,
MetadataException {
QueryRouter queryRouter = new QueryRouter();
List<PartialPath> pathList = new ArrayList<>();
- List<TSDataType> dataTypes = new ArrayList<>();
- PartialPath p =
- new PartialPath(TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s0);
- pathList.add(p);
- dataTypes.add(TSDataType.INT32);
+ PartialPath path =
+ SchemaTestUtils.getMeasurementPath(
+ TestConstant.d0 + TsFileConstant.PATH_SEPARATOR + TestConstant.s0);
+ pathList.add(path);
SingleSeriesExpression singleSeriesExpression =
- new SingleSeriesExpression(p, ValueFilter.gtEq(20));
+ new SingleSeriesExpression(path, ValueFilter.gtEq(20));
RawDataQueryPlan queryPlan = new RawDataQueryPlan();
- queryPlan.setDeduplicatedDataTypes(dataTypes);
queryPlan.setDeduplicatedPathsAndUpdate(pathList);
queryPlan.setExpression(singleSeriesExpression);
QueryDataSet queryDataSet = queryRouter.rawDataQuery(queryPlan,
TEST_QUERY_CONTEXT);
@@ -345,15 +342,14 @@ public class IoTDBSeriesReaderIT {
@Test
public void seriesTimeDigestReadTest()
- throws IOException, StorageEngineException, QueryProcessException,
IllegalPathException {
+ throws IOException, StorageEngineException, QueryProcessException,
MetadataException {
QueryRouter queryRouter = new QueryRouter();
- PartialPath path =
- new PartialPath(TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s0);
- List<TSDataType> dataTypes = Collections.singletonList(TSDataType.INT32);
+ MeasurementPath path =
+ SchemaTestUtils.getMeasurementPath(
+ TestConstant.d0 + TsFileConstant.PATH_SEPARATOR + TestConstant.s0);
SingleSeriesExpression expression = new SingleSeriesExpression(path,
TimeFilter.gt(22987L));
RawDataQueryPlan queryPlan = new RawDataQueryPlan();
- queryPlan.setDeduplicatedDataTypes(dataTypes);
queryPlan.setDeduplicatedPathsAndUpdate(Collections.singletonList(path));
queryPlan.setExpression(expression);
QueryDataSet queryDataSet = queryRouter.rawDataQuery(queryPlan,
TEST_QUERY_CONTEXT);
@@ -368,12 +364,14 @@ public class IoTDBSeriesReaderIT {
@Test
public void crossSeriesReadUpdateTest()
- throws IOException, StorageEngineException, QueryProcessException,
IllegalPathException {
+ throws IOException, StorageEngineException, QueryProcessException,
MetadataException {
QueryRouter queryRouter = new QueryRouter();
- PartialPath path1 =
- new PartialPath(TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s0);
- PartialPath path2 =
- new PartialPath(TestConstant.d0 + TsFileConstant.PATH_SEPARATOR +
TestConstant.s1);
+ MeasurementPath path1 =
+ SchemaTestUtils.getMeasurementPath(
+ TestConstant.d0 + TsFileConstant.PATH_SEPARATOR + TestConstant.s0);
+ MeasurementPath path2 =
+ SchemaTestUtils.getMeasurementPath(
+ TestConstant.d0 + TsFileConstant.PATH_SEPARATOR + TestConstant.s1);
RawDataQueryPlan queryPlan = new RawDataQueryPlan();
@@ -382,11 +380,6 @@ public class IoTDBSeriesReaderIT {
pathList.add(path2);
queryPlan.setDeduplicatedPathsAndUpdate(pathList);
- List<TSDataType> dataTypes = new ArrayList<>();
- dataTypes.add(TSDataType.INT32);
- dataTypes.add(TSDataType.INT64);
- queryPlan.setDeduplicatedDataTypes(dataTypes);
-
SingleSeriesExpression singleSeriesExpression =
new SingleSeriesExpression(path1, ValueFilter.lt(111));
queryPlan.setExpression(singleSeriesExpression);
diff --git
a/server/src/test/java/org/apache/iotdb/db/qp/physical/PhysicalPlanTest.java
b/server/src/test/java/org/apache/iotdb/db/qp/physical/PhysicalPlanTest.java
index ca6ae00..6101fae 100644
--- a/server/src/test/java/org/apache/iotdb/db/qp/physical/PhysicalPlanTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/qp/physical/PhysicalPlanTest.java
@@ -1091,7 +1091,7 @@ public class PhysicalPlanTest {
}
@Test
- public void testLastPlanDataTypes() throws QueryProcessException {
+ public void testLastPlanDataTypes() throws QueryProcessException,
MetadataException {
String sqlStr1 = "SELECT last s1 FROM root.vehicle.d1";
String sqlStr2 = "SELECT last s1 FROM root.vehicle.d2, root.vehicle.d3,
root.vehicle.d4";
diff --git
a/server/src/test/java/org/apache/iotdb/db/query/reader/series/SeriesAggregateReaderTest.java
b/server/src/test/java/org/apache/iotdb/db/query/reader/series/SeriesAggregateReaderTest.java
index 4b3ba71..287022d 100644
---
a/server/src/test/java/org/apache/iotdb/db/query/reader/series/SeriesAggregateReaderTest.java
+++
b/server/src/test/java/org/apache/iotdb/db/query/reader/series/SeriesAggregateReaderTest.java
@@ -22,13 +22,13 @@ package org.apache.iotdb.db.query.reader.series;
import org.apache.iotdb.db.engine.querycontext.QueryDataSource;
import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
import org.apache.iotdb.db.exception.StorageEngineException;
-import org.apache.iotdb.db.exception.metadata.IllegalPathException;
import org.apache.iotdb.db.exception.metadata.MetadataException;
import org.apache.iotdb.db.exception.query.QueryProcessException;
-import org.apache.iotdb.db.metadata.path.PartialPath;
+import org.apache.iotdb.db.metadata.path.MeasurementPath;
import org.apache.iotdb.db.query.aggregation.AggregateResult;
import org.apache.iotdb.db.query.factory.AggregateResultFactory;
import org.apache.iotdb.db.utils.EnvironmentUtils;
+import org.apache.iotdb.db.utils.SchemaTestUtils;
import org.apache.iotdb.tsfile.exception.write.WriteProcessException;
import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
import org.apache.iotdb.tsfile.file.metadata.statistics.Statistics;
@@ -73,7 +73,8 @@ public class SeriesAggregateReaderTest {
@Test
public void aggregateTest() {
try {
- PartialPath path = new PartialPath(SERIES_READER_TEST_SG +
".device0.sensor0");
+ MeasurementPath path =
+ SchemaTestUtils.getMeasurementPath(SERIES_READER_TEST_SG +
".device0.sensor0");
Set<String> allSensors = new HashSet<>();
allSensors.add("sensor0");
QueryDataSource queryDataSource = new QueryDataSource(seqResources,
unseqResources);
@@ -133,7 +134,7 @@ public class SeriesAggregateReaderTest {
}
}
assertEquals(500L, aggregateResult.getResult());
- } catch (IOException | QueryProcessException | IllegalPathException e) {
+ } catch (IOException | QueryProcessException | MetadataException e) {
e.printStackTrace();
fail();
}
diff --git
a/server/src/test/java/org/apache/iotdb/db/query/reader/series/SeriesReaderByTimestampTest.java
b/server/src/test/java/org/apache/iotdb/db/query/reader/series/SeriesReaderByTimestampTest.java
index 160b580..0aeb568 100644
---
a/server/src/test/java/org/apache/iotdb/db/query/reader/series/SeriesReaderByTimestampTest.java
+++
b/server/src/test/java/org/apache/iotdb/db/query/reader/series/SeriesReaderByTimestampTest.java
@@ -22,10 +22,9 @@ package org.apache.iotdb.db.query.reader.series;
import org.apache.iotdb.db.engine.querycontext.QueryDataSource;
import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
import org.apache.iotdb.db.exception.StorageEngineException;
-import org.apache.iotdb.db.exception.metadata.IllegalPathException;
import org.apache.iotdb.db.exception.metadata.MetadataException;
-import org.apache.iotdb.db.metadata.path.PartialPath;
import org.apache.iotdb.db.utils.EnvironmentUtils;
+import org.apache.iotdb.db.utils.SchemaTestUtils;
import org.apache.iotdb.tsfile.exception.write.WriteProcessException;
import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
import org.apache.iotdb.tsfile.write.schema.UnaryMeasurementSchema;
@@ -63,7 +62,7 @@ public class SeriesReaderByTimestampTest {
}
@Test
- public void test() throws IOException, IllegalPathException {
+ public void test() throws IOException, MetadataException {
QueryDataSource dataSource = new QueryDataSource(seqResources,
unseqResources);
Set<String> allSensors = new HashSet<>();
@@ -71,7 +70,7 @@ public class SeriesReaderByTimestampTest {
SeriesReaderByTimestamp seriesReader =
new SeriesReaderByTimestamp(
- new PartialPath(SERIES_READER_TEST_SG + ".device0.sensor0"),
+ SchemaTestUtils.getMeasurementPath(SERIES_READER_TEST_SG +
".device0.sensor0"),
allSensors,
TSDataType.INT32,
EnvironmentUtils.TEST_QUERY_CONTEXT,
diff --git
a/server/src/test/java/org/apache/iotdb/db/utils/SchemaTestUtils.java
b/server/src/test/java/org/apache/iotdb/db/utils/SchemaTestUtils.java
new file mode 100644
index 0000000..ae12c6f
--- /dev/null
+++ b/server/src/test/java/org/apache/iotdb/db/utils/SchemaTestUtils.java
@@ -0,0 +1,39 @@
+/*
+ * 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.utils;
+
+import org.apache.iotdb.db.exception.metadata.MetadataException;
+import org.apache.iotdb.db.metadata.path.MeasurementPath;
+import org.apache.iotdb.db.metadata.path.PartialPath;
+import org.apache.iotdb.db.service.IoTDB;
+
+import java.util.List;
+
+import static org.junit.Assert.assertFalse;
+
+public class SchemaTestUtils {
+
+ public static MeasurementPath getMeasurementPath(String pathPatternString)
+ throws MetadataException {
+ PartialPath pathPattern = new PartialPath(pathPatternString);
+ List<MeasurementPath> measurementPaths =
IoTDB.metaManager.getMeasurementPaths(pathPattern);
+ assertFalse(measurementPaths.isEmpty());
+ return measurementPaths.get(0);
+ }
+}