This is an automated email from the ASF dual-hosted git repository.
geniuspig pushed a commit to branch optimize_path_v2
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git
The following commit(s) were added to refs/heads/optimize_path_v2 by this push:
new 1aa68bd all
1aa68bd is described below
commit 1aa68bde74e342261c939a0a9ac81d494635bd5e
Author: zhutianci <[email protected]>
AuthorDate: Sun Aug 16 20:27:04 2020 +0800
all
---
.../org/apache/iotdb/db/auth/AuthorityChecker.java | 10 +-
.../iotdb/db/engine/memtable/AbstractMemTable.java | 4 +-
.../iotdb/db/engine/merge/recover/LogAnalyzer.java | 7 +-
.../iotdb/db/engine/merge/task/MergeTask.java | 7 +-
.../io/LocalTextModificationAccessor.java | 6 +-
.../engine/storagegroup/StorageGroupProcessor.java | 3 +-
.../db/engine/storagegroup/TsFileResource.java | 6 +-
.../org/apache/iotdb/db/metadata/MLogWriter.java | 2 +-
.../java/org/apache/iotdb/db/metadata/MTree.java | 2 +-
.../org/apache/iotdb/db/monitor/StatMonitor.java | 13 +-
.../org/apache/iotdb/db/mqtt/PublishHandler.java | 6 +-
.../main/java/org/apache/iotdb/db/qp/Planner.java | 3 +-
.../apache/iotdb/db/qp/executor/IPlanExecutor.java | 2 +-
.../apache/iotdb/db/qp/executor/PlanExecutor.java | 2 +-
.../db/qp/physical/crud/InsertTabletPlan.java | 27 +-
.../iotdb/db/qp/physical/crud/UpdatePlan.java | 15 +-
.../iotdb/db/qp/physical/sys/ClearCachePlan.java | 3 +-
.../db/qp/physical/sys/CreateSnapshotPlan.java | 3 +-
.../iotdb/db/qp/physical/sys/DataAuthPlan.java | 3 +-
.../db/qp/physical/sys/LoadConfigurationPlan.java | 3 +-
.../iotdb/db/qp/physical/sys/LoadDataPlan.java | 8 +-
.../apache/iotdb/db/qp/physical/sys/MergePlan.java | 4 +-
.../iotdb/db/qp/physical/sys/OperateFilePlan.java | 3 +-
.../iotdb/db/qp/physical/sys/TracingPlan.java | 3 +-
.../optimizer/MergeSingleFilterOptimizer.java | 17 +-
.../db/query/control/QueryResourceManager.java | 1 +
.../db/query/dataset/AlignByDeviceDataSet.java | 29 +-
.../dataset/RawQueryDataSetWithoutValueFilter.java | 1 +
.../dataset/groupby/GroupByEngineDataSet.java | 5 +-
.../query/dataset/groupby/GroupByFillDataSet.java | 10 +-
.../query/dataset/groupby/GroupByTimeDataSet.java | 7 +-
.../db/query/executor/AggregationExecutor.java | 17 +-
.../iotdb/db/query/executor/FillQueryExecutor.java | 3 +-
.../iotdb/db/query/executor/IQueryRouter.java | 8 +-
.../iotdb/db/query/executor/LastQueryExecutor.java | 36 +--
.../iotdb/db/query/executor/QueryRouter.java | 8 +-
.../db/query/executor/RawDataQueryExecutor.java | 44 +--
.../apache/iotdb/db/query/executor/fill/IFill.java | 3 +-
.../iotdb/db/query/executor/fill/LinearFill.java | 7 +-
.../iotdb/db/query/executor/fill/PreviousFill.java | 3 +-
.../query/timegenerator/ServerTimeGenerator.java | 21 +-
.../org/apache/iotdb/db/service/TSServiceImpl.java | 305 ++++++++++++---------
.../iotdb/db/sync/receiver/load/FileLoader.java | 10 +-
.../apache/iotdb/db/tools/IoTDBDataDirViewer.java | 12 +-
.../iotdb/db/tools/TsFileResourcePrinter.java | 5 +-
.../org/apache/iotdb/db/utils/FileLoaderUtils.java | 4 +-
.../org/apache/iotdb/db/utils/FilePathUtils.java | 9 +-
.../org/apache/iotdb/db/utils/UpgradeUtils.java | 7 +-
.../iotdb/db/writelog/recover/LogReplayer.java | 23 +-
.../writelog/recover/TsFileRecoverPerformer.java | 3 +-
.../db/engine/cache/ChunkMetadataCacheTest.java | 15 +-
.../db/integration/IoTDBEngineTimeGeneratorIT.java | 23 +-
.../iotdb/db/metadata/MManagerAdvancedTest.java | 68 ++---
.../apache/iotdb/db/writelog/WriteLogNodeTest.java | 14 +-
54 files changed, 486 insertions(+), 377 deletions(-)
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 3ee55f5..bfa8e4d 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
@@ -23,8 +23,8 @@ import org.apache.iotdb.db.auth.authorizer.BasicAuthorizer;
import org.apache.iotdb.db.auth.authorizer.IAuthorizer;
import org.apache.iotdb.db.auth.entity.PrivilegeType;
import org.apache.iotdb.db.conf.IoTDBConstant;
+import org.apache.iotdb.db.metadata.PartialPath;
import org.apache.iotdb.db.qp.logical.Operator;
-import org.apache.iotdb.tsfile.read.common.Path;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -47,7 +47,7 @@ public class AuthorityChecker {
* @return if permission-check is passed
* @throws AuthException Authentication Exception
*/
- public static boolean check(String username, List<Path> paths,
Operator.OperatorType type,
+ public static boolean check(String username, List<PartialPath> paths,
Operator.OperatorType type,
String targetUser)
throws AuthException {
if (SUPER_USER.equals(username)) {
@@ -63,7 +63,7 @@ public class AuthorityChecker {
return true;
}
if (!paths.isEmpty()) {
- for (Path path : paths) {
+ for (PartialPath path : paths) {
if (!checkOnePath(username, path, permission)) {
return false;
}
@@ -74,11 +74,11 @@ public class AuthorityChecker {
return true;
}
- private static boolean checkOnePath(String username, Path path, int
permission)
+ private static boolean checkOnePath(String username, PartialPath path, int
permission)
throws AuthException {
IAuthorizer authorizer = BasicAuthorizer.getInstance();
try {
- String fullPath = path == null ? IoTDBConstant.PATH_ROOT :
path.getFullPath();
+ String fullPath = path == null ? IoTDBConstant.PATH_ROOT :
path.toString();
if (authorizer.checkUserPrivileges(username, fullPath, permission)) {
return true;
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/engine/memtable/AbstractMemTable.java
b/server/src/main/java/org/apache/iotdb/db/engine/memtable/AbstractMemTable.java
index f671316..1ea4b62 100644
---
a/server/src/main/java/org/apache/iotdb/db/engine/memtable/AbstractMemTable.java
+++
b/server/src/main/java/org/apache/iotdb/db/engine/memtable/AbstractMemTable.java
@@ -108,7 +108,7 @@ public abstract class AbstractMemTable implements IMemTable
{
Object value = insertRowPlan.getValues()[i];
memSize +=
MemUtils.getRecordSize(insertRowPlan.getSchemas()[i].getType(), value);
- write(insertRowPlan.getDeviceId(), insertRowPlan.getMeasurements()[i],
+ write(insertRowPlan.getDeviceId().toString(),
insertRowPlan.getMeasurements()[i],
insertRowPlan.getSchemas()[i], insertRowPlan.getTime(), value);
}
@@ -142,7 +142,7 @@ public abstract class AbstractMemTable implements IMemTable
{
if (insertTabletPlan.getColumns()[i] == null) {
continue;
}
- IWritableMemChunk memSeries =
createIfNotExistAndGet(insertTabletPlan.getDeviceId(),
+ IWritableMemChunk memSeries =
createIfNotExistAndGet(insertTabletPlan.getDeviceId().toString(),
insertTabletPlan.getMeasurements()[i],
insertTabletPlan.getSchemas()[i]);
memSeries.write(insertTabletPlan.getTimes(),
insertTabletPlan.getColumns()[i],
insertTabletPlan.getDataTypes()[i], start, end);
diff --git
a/server/src/main/java/org/apache/iotdb/db/engine/merge/recover/LogAnalyzer.java
b/server/src/main/java/org/apache/iotdb/db/engine/merge/recover/LogAnalyzer.java
index 67f2add..fda743f 100644
---
a/server/src/main/java/org/apache/iotdb/db/engine/merge/recover/LogAnalyzer.java
+++
b/server/src/main/java/org/apache/iotdb/db/engine/merge/recover/LogAnalyzer.java
@@ -24,6 +24,7 @@ import org.apache.iotdb.db.engine.merge.manage.MergeResource;
import org.apache.iotdb.db.engine.merge.task.MergeTask;
import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
import org.apache.iotdb.db.exception.metadata.MetadataException;
+import org.apache.iotdb.db.metadata.PartialPath;
import org.apache.iotdb.db.service.IoTDB;
import org.apache.iotdb.tsfile.read.common.Path;
import org.slf4j.Logger;
@@ -99,10 +100,10 @@ public class LogAnalyzer {
analyzeUnseqFiles(bufferedReader);
- List<String> storageGroupPaths =
IoTDB.metaManager.getAllTimeseriesName(storageGroupName + ".*");
+ List<PartialPath> storageGroupPaths =
IoTDB.metaManager.getAllTimeseriesName(new PartialPath(storageGroupName +
".*"));
unmergedPaths = new ArrayList<>();
- for (String path : storageGroupPaths) {
- unmergedPaths.add(new Path(path));
+ for (PartialPath path : storageGroupPaths) {
+ unmergedPaths.add(path.toTSFilePath());
}
analyzeMergedSeries(bufferedReader, unmergedPaths);
diff --git
a/server/src/main/java/org/apache/iotdb/db/engine/merge/task/MergeTask.java
b/server/src/main/java/org/apache/iotdb/db/engine/merge/task/MergeTask.java
index f7db174..2a58d3b 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/merge/task/MergeTask.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/merge/task/MergeTask.java
@@ -24,6 +24,7 @@ import org.apache.iotdb.db.engine.merge.manage.MergeResource;
import org.apache.iotdb.db.engine.merge.recover.MergeLogger;
import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
import org.apache.iotdb.db.exception.metadata.MetadataException;
+import org.apache.iotdb.db.metadata.PartialPath;
import org.apache.iotdb.db.metadata.mnode.MNode;
import org.apache.iotdb.db.metadata.mnode.MeasurementMNode;
import org.apache.iotdb.db.service.IoTDB;
@@ -122,13 +123,13 @@ public class MergeTask implements Callable<Void> {
mergeLogger.logFiles(resource);
- Set<String> devices = IoTDB.metaManager.getDevices(storageGroupName);
+ Set<PartialPath> devices = IoTDB.metaManager.getDevices(new
PartialPath(storageGroupName));
Map<Path, MeasurementSchema> measurementSchemaMap = new HashMap<>();
List<Path> unmergedSeries = new ArrayList<>();
- for (String device : devices) {
+ for (PartialPath device : devices) {
MNode deviceNode = IoTDB.metaManager.getNodeByPath(device);
for (Entry<String, MNode> entry : deviceNode.getChildren().entrySet()) {
- Path path = new Path(device, entry.getKey());
+ Path path = new Path(device.toString(), entry.getKey());
measurementSchemaMap.put(path, ((MeasurementMNode)
entry.getValue()).getSchema());
unmergedSeries.add(path);
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/engine/modification/io/LocalTextModificationAccessor.java
b/server/src/main/java/org/apache/iotdb/db/engine/modification/io/LocalTextModificationAccessor.java
index 4ccaba1..2f69494 100644
---
a/server/src/main/java/org/apache/iotdb/db/engine/modification/io/LocalTextModificationAccessor.java
+++
b/server/src/main/java/org/apache/iotdb/db/engine/modification/io/LocalTextModificationAccessor.java
@@ -21,6 +21,8 @@ package org.apache.iotdb.db.engine.modification.io;
import org.apache.iotdb.db.engine.modification.Deletion;
import org.apache.iotdb.db.engine.modification.Modification;
+import org.apache.iotdb.db.exception.metadata.IllegalPathException;
+import org.apache.iotdb.db.metadata.PartialPath;
import org.apache.iotdb.tsfile.fileSystem.FSFactoryProducer;
import org.apache.iotdb.tsfile.read.common.Path;
import org.slf4j.Logger;
@@ -150,10 +152,10 @@ public class LocalTextModificationAccessor implements
ModificationReader, Modifi
startTimestamp = Long.parseLong(fields[3]);
endTimestamp = Long.parseLong(fields[4]);
}
- } catch (NumberFormatException e) {
+ return new Deletion(new PartialPath(path), versionNum, startTimestamp,
endTimestamp);
+ } catch (NumberFormatException | IllegalPathException e) {
throw new IOException("Invalid timestamp: " + e.getMessage());
}
- return new Deletion(new Path(path), versionNum, startTimestamp,
endTimestamp);
}
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
index a51daea..a5a5c54 100755
---
a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
+++
b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
@@ -73,6 +73,7 @@ import org.apache.iotdb.db.exception.MergeException;
import org.apache.iotdb.db.exception.StorageGroupProcessorException;
import org.apache.iotdb.db.exception.TsFileProcessorException;
import org.apache.iotdb.db.exception.WriteProcessException;
+import org.apache.iotdb.db.exception.metadata.IllegalPathException;
import org.apache.iotdb.db.exception.metadata.MetadataException;
import org.apache.iotdb.db.exception.query.OutOfTTLException;
import org.apache.iotdb.db.exception.query.QueryProcessException;
@@ -441,7 +442,7 @@ public class StorageGroupProcessor {
}
private Pair<List<TsFileResource>, List<TsFileResource>>
getAllFiles(List<String> folders)
- throws IOException {
+ throws IOException, IllegalPathException {
List<File> tsFiles = new ArrayList<>();
List<File> upgradeFiles = new ArrayList<>();
for (String baseDir : folders) {
diff --git
a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java
b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java
index 205aaab..0f30f73 100644
---
a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java
+++
b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java
@@ -25,6 +25,8 @@ import
org.apache.iotdb.db.engine.querycontext.ReadOnlyMemChunk;
import
org.apache.iotdb.db.engine.storagegroup.StorageGroupProcessor.UpgradeTsFileResourceCallBack;
import org.apache.iotdb.db.engine.upgrade.UpgradeTask;
import org.apache.iotdb.db.exception.PartitionViolationException;
+import org.apache.iotdb.db.exception.metadata.IllegalPathException;
+import org.apache.iotdb.db.metadata.PartialPath;
import org.apache.iotdb.db.service.IoTDB;
import org.apache.iotdb.db.service.UpgradeSevice;
import org.apache.iotdb.db.utils.FilePathUtils;
@@ -275,7 +277,7 @@ public class TsFileResource {
fsFactory.moveFile(src, dest);
}
- public void deserialize() throws IOException {
+ public void deserialize() throws IOException, IllegalPathException {
try (InputStream inputStream = fsFactory.getBufferedInputStream(
file + RESOURCE_SUFFIX)) {
int size = ReadWriteIOUtils.readInt(inputStream);
@@ -287,7 +289,7 @@ public class TsFileResource {
long time = ReadWriteIOUtils.readLong(inputStream);
// To reduce the String number in memory,
// use the deviceId from MManager instead of the deviceId read from
disk
- path = IoTDB.metaManager.getDeviceId(path);
+ path = IoTDB.metaManager.getDeviceId(new PartialPath(path));
deviceMap.put(path, i);
startTimesArray[i] = time;
}
diff --git a/server/src/main/java/org/apache/iotdb/db/metadata/MLogWriter.java
b/server/src/main/java/org/apache/iotdb/db/metadata/MLogWriter.java
index c00206e..a782117 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/MLogWriter.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/MLogWriter.java
@@ -60,7 +60,7 @@ public class MLogWriter {
public void createTimeseries(CreateTimeSeriesPlan plan, long offset) throws
IOException {
writer.write(String.format("%s,%s,%s,%s,%s",
MetadataOperationType.CREATE_TIMESERIES,
- plan.getPath().getFullPath(), plan.getDataType().serialize(),
+ plan.getPath().toString(), plan.getDataType().serialize(),
plan.getEncoding().serialize(), plan.getCompressor().serialize()));
writer.write(",");
diff --git a/server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
b/server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
index 41c3316..8b8dc3a 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
@@ -757,7 +757,7 @@ public class MTree implements Serializable {
return node.getCachedLast().getTimestamp();
} else {
try {
- last = calculateLastPairForOneSeriesLocally(new
Path(node.getFullPath()),
+ last = calculateLastPairForOneSeriesLocally(node.getPartialPath(),
node.getSchema().getType(), queryContext, Collections.emptySet());
return last.getTimestamp();
} catch (Exception e) {
diff --git a/server/src/main/java/org/apache/iotdb/db/monitor/StatMonitor.java
b/server/src/main/java/org/apache/iotdb/db/monitor/StatMonitor.java
index 7116ac4..bce9867 100644
--- a/server/src/main/java/org/apache/iotdb/db/monitor/StatMonitor.java
+++ b/server/src/main/java/org/apache/iotdb/db/monitor/StatMonitor.java
@@ -30,6 +30,7 @@ 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.MManager;
+import org.apache.iotdb.db.metadata.PartialPath;
import
org.apache.iotdb.db.monitor.MonitorConstants.FileNodeManagerStatConstants;
import
org.apache.iotdb.db.monitor.MonitorConstants.FileNodeProcessorStatConstants;
import org.apache.iotdb.db.monitor.collector.FileSize;
@@ -86,7 +87,7 @@ public class StatMonitor implements IService {
backLoopPeriod = config.getBackLoopPeriodSec();
if (config.isEnableStatMonitor()) {
try {
- String prefix = MonitorConstants.STAT_STORAGE_GROUP_PREFIX;
+ PartialPath prefix = new
PartialPath(MonitorConstants.STAT_STORAGE_GROUP_PREFIX_ARRAY);
if (!mmanager.isPathExist(prefix)) {
mmanager.setStorageGroup(prefix);
}
@@ -142,7 +143,7 @@ public class StatMonitor implements IService {
void registerStatStorageGroup() {
MManager mManager = IoTDB.metaManager;
- String prefix = MonitorConstants.STAT_STORAGE_GROUP_PREFIX;
+ PartialPath prefix = new
PartialPath(MonitorConstants.STAT_STORAGE_GROUP_PREFIX_ARRAY);
try {
if (!mManager.isPathExist(prefix)) {
mManager.setStorageGroup(prefix);
@@ -165,8 +166,8 @@ public class StatMonitor implements IService {
logger.error("Registering metadata but data type of {} is null",
entry.getKey());
}
- if (!mManager.isPathExist(entry.getKey())) {
- mManager.createTimeseries(entry.getKey(),
TSDataType.valueOf(entry.getValue()),
+ if (!mManager.isPathExist(new PartialPath(entry.getKey()))) {
+ mManager.createTimeseries(new PartialPath(entry.getKey()),
TSDataType.valueOf(entry.getValue()),
TSEncoding.valueOf("RLE"),
TSFileDescriptor.getInstance().getConfig().getCompressor(),
Collections.emptyMap());
@@ -366,12 +367,12 @@ public class StatMonitor implements IService {
for (Map.Entry<String, IStatistic> entry : statisticMap.entrySet()) {
for (String statParamName :
entry.getValue().getStatParamsHashMap().keySet()) {
if (temporaryStatList.contains(statParamName)) {
- fManager.delete(entry.getKey(), statParamName, Long.MIN_VALUE,
+ fManager.delete(new PartialPath(entry.getKey()), statParamName,
Long.MIN_VALUE,
currentTimeMillis - statMonitorRetainIntervalSec * 1000);
}
}
}
- } catch (StorageEngineException e) {
+ } catch (StorageEngineException | IllegalPathException e) {
logger
.error("Error occurred when deleting statistics information
periodically, because",
e);
diff --git a/server/src/main/java/org/apache/iotdb/db/mqtt/PublishHandler.java
b/server/src/main/java/org/apache/iotdb/db/mqtt/PublishHandler.java
index 87b70e5..9f6c71c 100644
--- a/server/src/main/java/org/apache/iotdb/db/mqtt/PublishHandler.java
+++ b/server/src/main/java/org/apache/iotdb/db/mqtt/PublishHandler.java
@@ -25,8 +25,10 @@ import java.util.List;
import org.apache.iotdb.db.conf.IoTDBConfig;
import org.apache.iotdb.db.conf.IoTDBDescriptor;
import org.apache.iotdb.db.exception.StorageEngineException;
+import org.apache.iotdb.db.exception.metadata.IllegalPathException;
import org.apache.iotdb.db.exception.metadata.StorageGroupNotSetException;
import org.apache.iotdb.db.exception.query.QueryProcessException;
+import org.apache.iotdb.db.metadata.PartialPath;
import org.apache.iotdb.db.qp.executor.IPlanExecutor;
import org.apache.iotdb.db.qp.executor.PlanExecutor;
import org.apache.iotdb.db.qp.physical.PhysicalPlan;
@@ -86,7 +88,6 @@ public class PublishHandler extends AbstractInterceptHandler {
}
InsertRowPlan plan = new InsertRowPlan();
- plan.setDeviceId(event.getDevice());
plan.setTime(event.getTimestamp());
plan.setMeasurements(event.getMeasurements().toArray(new
String[event.getMeasurements().size()]));
plan.setValues(event.getValues().toArray(new
Object[event.getValues().size()]));
@@ -95,8 +96,9 @@ public class PublishHandler extends AbstractInterceptHandler {
boolean status = false;
try {
+ plan.setDeviceId(new PartialPath(event.getDevice()));
status = executeNonQuery(plan);
- } catch (QueryProcessException | StorageGroupNotSetException |
StorageEngineException e ) {
+ } catch (QueryProcessException | StorageGroupNotSetException |
StorageEngineException | IllegalPathException e ) {
LOG.warn(
"meet error when inserting device {}, measurements {}, at
time {}, because ",
event.getDevice(), event.getMeasurements(),
event.getTimestamp(), e);
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/Planner.java
b/server/src/main/java/org/apache/iotdb/db/qp/Planner.java
index 05a41c1..509332f 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/Planner.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/Planner.java
@@ -23,6 +23,7 @@ import org.apache.iotdb.db.conf.IoTDBDescriptor;
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.metadata.PartialPath;
import org.apache.iotdb.db.qp.logical.Operator;
import org.apache.iotdb.db.qp.logical.crud.FilterOperator;
import org.apache.iotdb.db.qp.logical.crud.SFWOperator;
@@ -129,7 +130,7 @@ public class Planner {
if (filter == null) {
return root;
}
- Set<Path> pathSet = filter.getPathSet();
+ Set<PartialPath> pathSet = filter.getPathSet();
RemoveNotOptimizer removeNot = new RemoveNotOptimizer();
filter = removeNot.optimize(filter);
DnfFilterOptimizer dnf = new DnfFilterOptimizer();
diff --git
a/server/src/main/java/org/apache/iotdb/db/qp/executor/IPlanExecutor.java
b/server/src/main/java/org/apache/iotdb/db/qp/executor/IPlanExecutor.java
index 6e7cfe3..f742af7 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/executor/IPlanExecutor.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/executor/IPlanExecutor.java
@@ -65,7 +65,7 @@ public interface IPlanExecutor {
* @param endTime end time in update command
* @param value - in type of string
*/
- void update(Path path, long startTime, long endTime, String value)
+ void update(PartialPath path, long startTime, long endTime, String value)
throws QueryProcessException;
/**
diff --git
a/server/src/main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java
b/server/src/main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java
index 9a70bf0..225def3 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java
@@ -834,7 +834,7 @@ public class PlanExecutor implements IPlanExecutor {
}
@Override
- public void update(Path path, long startTime, long endTime, String value) {
+ public void update(PartialPath path, long startTime, long endTime, String
value) {
throw new UnsupportedOperationException("update is not supported now");
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertTabletPlan.java
b/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertTabletPlan.java
index 922ed25..cc9a802 100644
---
a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertTabletPlan.java
+++
b/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertTabletPlan.java
@@ -23,7 +23,8 @@ import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
-import java.util.Set;
+import org.apache.iotdb.db.exception.metadata.IllegalPathException;
+import org.apache.iotdb.db.metadata.PartialPath;
import org.apache.iotdb.db.qp.logical.Operator.OperatorType;
import org.apache.iotdb.db.utils.QueryDataSetUtils;
import org.apache.iotdb.tsfile.exception.write.UnSupportedDataTypeException;
@@ -53,7 +54,7 @@ public class InsertTabletPlan extends InsertPlan {
// cached values
private Long maxTime = null;
private Long minTime = null;
- private List<Path> paths;
+ private List<PartialPath> paths;
private int start;
private int end;
@@ -62,19 +63,19 @@ public class InsertTabletPlan extends InsertPlan {
super(OperatorType.BATCHINSERT);
}
- public InsertTabletPlan(String deviceId, List<String> measurements) {
+ public InsertTabletPlan(PartialPath deviceId, List<String> measurements) {
super(OperatorType.BATCHINSERT);
this.deviceId = deviceId;
this.measurements = measurements.toArray(new String[0]);
}
- public InsertTabletPlan(String deviceId, String[] measurements) {
+ public InsertTabletPlan(PartialPath deviceId, String[] measurements) {
super(OperatorType.BATCHINSERT);
this.deviceId = deviceId;
this.measurements = measurements;
}
- public InsertTabletPlan(String deviceId, String[] measurements,
List<Integer> dataTypes) {
+ public InsertTabletPlan(PartialPath deviceId, String[] measurements,
List<Integer> dataTypes) {
super(OperatorType.BATCHINSERT);
this.deviceId = deviceId;
this.measurements = measurements;
@@ -98,13 +99,15 @@ public class InsertTabletPlan extends InsertPlan {
}
@Override
- public List<Path> getPaths() {
+ public List<PartialPath> getPaths() {
if (paths != null) {
return paths;
}
- List<Path> ret = new ArrayList<>();
+ List<PartialPath> ret = new ArrayList<>();
for (String m : measurements) {
- ret.add(new Path(deviceId, m));
+ PartialPath fullPath = deviceId.clone();
+ fullPath.concatPath(new String[]{m});
+ ret.add(fullPath);
}
paths = ret;
return ret;
@@ -115,7 +118,7 @@ public class InsertTabletPlan extends InsertPlan {
int type = PhysicalPlanType.BATCHINSERT.ordinal();
stream.writeByte((byte) type);
- putString(stream, deviceId);
+ putString(stream, deviceId.toString());
stream.writeInt(
measurements.length - (failedMeasurements == null ? 0 :
failedMeasurements.size()));
@@ -157,7 +160,7 @@ public class InsertTabletPlan extends InsertPlan {
int type = PhysicalPlanType.BATCHINSERT.ordinal();
buffer.put((byte) type);
- putString(buffer, deviceId);
+ putString(buffer, deviceId.toString());
buffer
.putInt(measurements.length - (failedMeasurements == null ? 0 :
failedMeasurements.size()));
@@ -310,8 +313,8 @@ public class InsertTabletPlan extends InsertPlan {
}
@Override
- public void deserialize(ByteBuffer buffer) {
- this.deviceId = readString(buffer);
+ public void deserialize(ByteBuffer buffer) throws IllegalPathException {
+ this.deviceId = new PartialPath(readString(buffer));
int measurementSize = buffer.getInt();
this.measurements = new String[measurementSize];
diff --git
a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/UpdatePlan.java
b/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/UpdatePlan.java
index 418cb06..544074b 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/UpdatePlan.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/UpdatePlan.java
@@ -23,6 +23,7 @@ import static
org.apache.iotdb.db.qp.constant.SQLConstant.LINE_FEED_SIGNAL;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
+import org.apache.iotdb.db.metadata.PartialPath;
import org.apache.iotdb.db.qp.logical.Operator;
import org.apache.iotdb.db.qp.physical.PhysicalPlan;
import org.apache.iotdb.tsfile.read.common.Path;
@@ -33,7 +34,7 @@ public class UpdatePlan extends PhysicalPlan {
private List<Pair<Long, Long>> intervals = new ArrayList<>();
private String value;
- private Path path;
+ private PartialPath path;
public UpdatePlan() {
super(false, Operator.OperatorType.UPDATE);
@@ -47,7 +48,7 @@ public class UpdatePlan extends PhysicalPlan {
* @param value -value
* @param path -path
*/
- public UpdatePlan(long startTime, long endTime, String value, Path path) {
+ public UpdatePlan(long startTime, long endTime, String value, PartialPath
path) {
super(false, Operator.OperatorType.UPDATE);
setValue(value);
setPath(path);
@@ -61,7 +62,7 @@ public class UpdatePlan extends PhysicalPlan {
* @param value -value
* @param path -path
*/
- public UpdatePlan(List<Pair<Long, Long>> list, String value, Path path) {
+ public UpdatePlan(List<Pair<Long, Long>> list, String value, PartialPath
path) {
super(false, Operator.OperatorType.UPDATE);
setValue(value);
setPath(path);
@@ -88,17 +89,17 @@ public class UpdatePlan extends PhysicalPlan {
this.value = value;
}
- public Path getPath() {
+ public PartialPath getPath() {
return path;
}
- public void setPath(Path path) {
+ public void setPath(PartialPath path) {
this.path = path;
}
@Override
- public List<Path> getPaths() {
- List<Path> ret = new ArrayList<>();
+ public List<PartialPath> getPaths() {
+ List<PartialPath> ret = new ArrayList<>();
if (path != null) {
ret.add(path);
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/ClearCachePlan.java
b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/ClearCachePlan.java
index e747208..750d7d0 100644
---
a/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/ClearCachePlan.java
+++
b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/ClearCachePlan.java
@@ -20,6 +20,7 @@ package org.apache.iotdb.db.qp.physical.sys;
import java.util.ArrayList;
import java.util.List;
+import org.apache.iotdb.db.metadata.PartialPath;
import org.apache.iotdb.db.qp.logical.Operator.OperatorType;
import org.apache.iotdb.db.qp.physical.PhysicalPlan;
import org.apache.iotdb.tsfile.read.common.Path;
@@ -31,7 +32,7 @@ public class ClearCachePlan extends PhysicalPlan {
}
@Override
- public List<Path> getPaths() {
+ public List<PartialPath> getPaths() {
return new ArrayList<>();
}
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/CreateSnapshotPlan.java
b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/CreateSnapshotPlan.java
index 93f8d5d..416f840 100644
---
a/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/CreateSnapshotPlan.java
+++
b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/CreateSnapshotPlan.java
@@ -21,6 +21,7 @@ package org.apache.iotdb.db.qp.physical.sys;
import java.util.ArrayList;
import java.util.List;
+import org.apache.iotdb.db.metadata.PartialPath;
import org.apache.iotdb.db.qp.logical.Operator.OperatorType;
import org.apache.iotdb.db.qp.physical.PhysicalPlan;
import org.apache.iotdb.tsfile.read.common.Path;
@@ -32,7 +33,7 @@ public class CreateSnapshotPlan extends PhysicalPlan {
}
@Override
- public List<Path> getPaths() {
+ public List<PartialPath> getPaths() {
return new ArrayList<>();
}
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/DataAuthPlan.java
b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/DataAuthPlan.java
index e6bec6f..34081da 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/DataAuthPlan.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/DataAuthPlan.java
@@ -23,6 +23,7 @@ import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
+import org.apache.iotdb.db.metadata.PartialPath;
import org.apache.iotdb.db.qp.logical.Operator.OperatorType;
import org.apache.iotdb.db.qp.physical.PhysicalPlan;
import org.apache.iotdb.tsfile.read.common.Path;
@@ -45,7 +46,7 @@ public class DataAuthPlan extends PhysicalPlan {
}
@Override
- public List<Path> getPaths() {
+ public List<PartialPath> getPaths() {
return null;
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/LoadConfigurationPlan.java
b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/LoadConfigurationPlan.java
index 0acadcc..e85b4f6 100644
---
a/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/LoadConfigurationPlan.java
+++
b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/LoadConfigurationPlan.java
@@ -27,6 +27,7 @@ import java.util.List;
import java.util.Map.Entry;
import java.util.Properties;
import org.apache.iotdb.db.exception.query.QueryProcessException;
+import org.apache.iotdb.db.metadata.PartialPath;
import org.apache.iotdb.db.qp.logical.Operator.OperatorType;
import org.apache.iotdb.db.qp.physical.PhysicalPlan;
import org.apache.iotdb.tsfile.read.common.Path;
@@ -111,7 +112,7 @@ public class LoadConfigurationPlan extends PhysicalPlan {
}
@Override
- public List<Path> getPaths() {
+ public List<PartialPath> getPaths() {
return null;
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/LoadDataPlan.java
b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/LoadDataPlan.java
index 2c27c9f..6f5f289 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/LoadDataPlan.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/LoadDataPlan.java
@@ -21,9 +21,9 @@ package org.apache.iotdb.db.qp.physical.sys;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
+import org.apache.iotdb.db.metadata.PartialPath;
import org.apache.iotdb.db.qp.logical.Operator;
import org.apache.iotdb.db.qp.physical.PhysicalPlan;
-import org.apache.iotdb.tsfile.read.common.Path;
public class LoadDataPlan extends PhysicalPlan {
@@ -40,10 +40,10 @@ public class LoadDataPlan extends PhysicalPlan {
}
@Override
- public List<Path> getPaths() {
- List<Path> ret = new ArrayList<>();
+ public List<PartialPath> getPaths() {
+ List<PartialPath> ret = new ArrayList<>();
if (measureType != null) {
- ret.add(new Path(measureType));
+ ret.add(new PartialPath(new String[]{measureType}));
}
return ret;
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/MergePlan.java
b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/MergePlan.java
index d443002..1478590 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/MergePlan.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/MergePlan.java
@@ -20,9 +20,9 @@ package org.apache.iotdb.db.qp.physical.sys;
import java.util.ArrayList;
import java.util.List;
+import org.apache.iotdb.db.metadata.PartialPath;
import org.apache.iotdb.db.qp.logical.Operator.OperatorType;
import org.apache.iotdb.db.qp.physical.PhysicalPlan;
-import org.apache.iotdb.tsfile.read.common.Path;
public class MergePlan extends PhysicalPlan {
@@ -35,7 +35,7 @@ public class MergePlan extends PhysicalPlan {
}
@Override
- public List<Path> getPaths() {
+ public List<PartialPath> getPaths() {
return new ArrayList<>();
}
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/OperateFilePlan.java
b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/OperateFilePlan.java
index 7f7ee15..56d6cb1 100644
---
a/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/OperateFilePlan.java
+++
b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/OperateFilePlan.java
@@ -20,6 +20,7 @@ package org.apache.iotdb.db.qp.physical.sys;
import java.io.File;
import java.util.List;
+import org.apache.iotdb.db.metadata.PartialPath;
import org.apache.iotdb.db.qp.logical.Operator.OperatorType;
import org.apache.iotdb.db.qp.physical.PhysicalPlan;
import org.apache.iotdb.tsfile.read.common.Path;
@@ -50,7 +51,7 @@ public class OperateFilePlan extends PhysicalPlan {
}
@Override
- public List<Path> getPaths() {
+ public List<PartialPath> getPaths() {
return null;
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/TracingPlan.java
b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/TracingPlan.java
index 26ed373..350c814 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/TracingPlan.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/TracingPlan.java
@@ -20,6 +20,7 @@ package org.apache.iotdb.db.qp.physical.sys;
import java.util.ArrayList;
import java.util.List;
+import org.apache.iotdb.db.metadata.PartialPath;
import org.apache.iotdb.db.qp.logical.Operator.OperatorType;
import org.apache.iotdb.db.qp.physical.PhysicalPlan;
import org.apache.iotdb.tsfile.read.common.Path;
@@ -34,7 +35,7 @@ public class TracingPlan extends PhysicalPlan {
}
@Override
- public List<Path> getPaths() {
+ public List<PartialPath> getPaths() {
return new ArrayList<>();
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/qp/strategy/optimizer/MergeSingleFilterOptimizer.java
b/server/src/main/java/org/apache/iotdb/db/qp/strategy/optimizer/MergeSingleFilterOptimizer.java
index d2e3046..03330e8 100644
---
a/server/src/main/java/org/apache/iotdb/db/qp/strategy/optimizer/MergeSingleFilterOptimizer.java
+++
b/server/src/main/java/org/apache/iotdb/db/qp/strategy/optimizer/MergeSingleFilterOptimizer.java
@@ -19,6 +19,7 @@
package org.apache.iotdb.db.qp.strategy.optimizer;
import org.apache.iotdb.db.exception.query.LogicalOptimizeException;
+import org.apache.iotdb.db.metadata.PartialPath;
import org.apache.iotdb.db.qp.logical.crud.BasicFunctionOperator;
import org.apache.iotdb.db.qp.logical.crud.FilterOperator;
import org.apache.iotdb.tsfile.read.common.Path;
@@ -55,14 +56,14 @@ public class MergeSingleFilterOptimizer implements
IFilterOptimizer {
* @return - if all recursive children of this node have same seriesPath,
set this node to single
* node, and return the same seriesPath, otherwise, throw exception;
*/
- private Path mergeSamePathFilter(FilterOperator filter) throws
LogicalOptimizeException {
+ private PartialPath mergeSamePathFilter(FilterOperator filter) throws
LogicalOptimizeException {
if (filter.isLeaf()) {
return filter.getSinglePath();
}
List<FilterOperator> children = filter.getChildren();
checkInnerFilterLen(children);
- Path childPath = mergeSamePathFilter(children.get(0));
- Path tempPath;
+ PartialPath childPath = mergeSamePathFilter(children.get(0));
+ PartialPath tempPath;
for (int i = 1; i < children.size(); i++) {
tempPath = mergeSamePathFilter(children.get(i));
// if one of children differs from others or is not single
node(seriesPath = null), filter's
@@ -80,7 +81,7 @@ public class MergeSingleFilterOptimizer implements
IFilterOptimizer {
// sort paths of BasicFunction by their single seriesPath. We don't sort
children on non-leaf
// layer.
if (!children.isEmpty() && allIsBasic(children)) {
- children.sort(Comparator.comparing(o ->
o.getSinglePath().getFullPath()));
+ children.sort(Comparator.comparing(o -> o.getSinglePath().toString()));
}
List<FilterOperator> ret = new ArrayList<>();
int firstNonSingleIndex = mergeSingleFilters(ret, filter);
@@ -92,8 +93,8 @@ public class MergeSingleFilterOptimizer implements
IFilterOptimizer {
private int mergeSingleFilters(List<FilterOperator> ret, FilterOperator
filter) {
List<FilterOperator> children = filter.getChildren();
List<FilterOperator> tempExtrNode = null;
- Path tempPath;
- Path childPath = null;
+ PartialPath tempPath;
+ PartialPath childPath = null;
int firstNonSingleIndex;
for (firstNonSingleIndex = 0; firstNonSingleIndex < children.size();
firstNonSingleIndex++) {
tempPath = children.get(firstNonSingleIndex).getSinglePath();
@@ -148,8 +149,8 @@ public class MergeSingleFilterOptimizer implements
IFilterOptimizer {
return firstNonSingleIndex;
}
- private Path addLastNullChild(List<FilterOperator> ret,
- FilterOperator filter, int i, Path childPath){
+ private PartialPath addLastNullChild(List<FilterOperator> ret,
+ FilterOperator filter, int i, PartialPath
childPath){
List<FilterOperator> children = filter.getChildren();
for (; i < children.size(); i++) {
ret.add(children.get(i));
diff --git
a/server/src/main/java/org/apache/iotdb/db/query/control/QueryResourceManager.java
b/server/src/main/java/org/apache/iotdb/db/query/control/QueryResourceManager.java
index d916861..202e7df 100644
---
a/server/src/main/java/org/apache/iotdb/db/query/control/QueryResourceManager.java
+++
b/server/src/main/java/org/apache/iotdb/db/query/control/QueryResourceManager.java
@@ -38,6 +38,7 @@ 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.query.QueryProcessException;
+import org.apache.iotdb.db.metadata.PartialPath;
import org.apache.iotdb.db.query.context.QueryContext;
import
org.apache.iotdb.db.query.externalsort.serialize.IExternalSortFileDeserializer;
import org.apache.iotdb.tsfile.read.common.Path;
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 e224a07..dfd5d8e 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
@@ -27,18 +27,23 @@ import java.util.Map;
import java.util.Set;
import org.apache.iotdb.db.conf.IoTDBDescriptor;
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.PartialPath;
import org.apache.iotdb.db.metadata.mnode.MNode;
-import org.apache.iotdb.db.qp.physical.crud.*;
+import org.apache.iotdb.db.qp.physical.crud.AggregationPlan;
+import org.apache.iotdb.db.qp.physical.crud.AlignByDevicePlan;
import org.apache.iotdb.db.qp.physical.crud.AlignByDevicePlan.MeasurementType;
+import org.apache.iotdb.db.qp.physical.crud.FillQueryPlan;
+import org.apache.iotdb.db.qp.physical.crud.GroupByTimePlan;
+import org.apache.iotdb.db.qp.physical.crud.RawDataQueryPlan;
import org.apache.iotdb.db.query.context.QueryContext;
import org.apache.iotdb.db.query.executor.IQueryRouter;
import org.apache.iotdb.db.service.IoTDB;
import
org.apache.iotdb.tsfile.exception.filter.QueryFilterOptimizationException;
import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
import org.apache.iotdb.tsfile.read.common.Field;
-import org.apache.iotdb.tsfile.read.common.Path;
import org.apache.iotdb.tsfile.read.common.RowRecord;
import org.apache.iotdb.tsfile.read.expression.IExpression;
import org.apache.iotdb.tsfile.read.query.dataset.QueryDataSet;
@@ -56,7 +61,7 @@ public class AlignByDeviceDataSet extends QueryDataSet {
private IExpression expression;
private List<String> measurements;
- private List<String> devices;
+ private List<PartialPath> devices;
private Map<String, IExpression> deviceToFilterMap;
private Map<String, MeasurementType> measurementTypeMap;
// record the real type of the corresponding measurement
@@ -68,9 +73,9 @@ public class AlignByDeviceDataSet extends QueryDataSet {
private RawDataQueryPlan rawDataQueryPlan;
private boolean curDataSetInitialized;
- private String currentDevice;
+ private PartialPath currentDevice;
private QueryDataSet currentDataSet;
- private Iterator<String> deviceIterator;
+ private Iterator<PartialPath> deviceIterator;
private List<String> executeColumns;
private int pathsNum = 0;
@@ -127,7 +132,7 @@ public class AlignByDeviceDataSet extends QueryDataSet {
// extract paths and aggregations queried from all measurements
// executeColumns is for calculating rowRecord
executeColumns = new ArrayList<>();
- List<Path> executePaths = new ArrayList<>();
+ List<PartialPath> executePaths = new ArrayList<>();
List<TSDataType> tsDataTypes = new ArrayList<>();
List<String> executeAggregations = new ArrayList<>();
for (String column : measurementDataTypeMap.keySet()) {
@@ -140,14 +145,16 @@ public class AlignByDeviceDataSet extends QueryDataSet {
}
if (measurementOfGivenDevice.contains(measurement)) {
executeColumns.add(column);
- executePaths.add(new Path(currentDevice, measurement));
+ PartialPath fullPath = currentDevice.clone();
+ fullPath.concatPath(new String[]{measurement});
+ executePaths.add(fullPath);
tsDataTypes.add(measurementDataTypeMap.get(column));
}
}
// get filter to execute for the current device
if (deviceToFilterMap != null) {
- this.expression = deviceToFilterMap.get(currentDevice);
+ this.expression = deviceToFilterMap.get(currentDevice.toString());
}
if
(IoTDBDescriptor.getInstance().getConfig().isEnablePerformanceTracing()) {
@@ -183,7 +190,7 @@ public class AlignByDeviceDataSet extends QueryDataSet {
default:
throw new IOException("unsupported DataSetType");
}
- } catch (QueryProcessException | QueryFilterOptimizationException |
StorageEngineException e) {
+ } catch (QueryProcessException | QueryFilterOptimizationException |
StorageEngineException | IllegalPathException e) {
throw new IOException(e);
}
@@ -195,7 +202,7 @@ public class AlignByDeviceDataSet extends QueryDataSet {
return false;
}
- protected Set<String> getDeviceMeasurements(String device) throws
IOException {
+ protected Set<String> getDeviceMeasurements(PartialPath device) throws
IOException {
try {
MNode deviceNode = IoTDB.metaManager.getNodeByPath(device);
return deviceNode.getChildren().keySet();
@@ -210,7 +217,7 @@ public class AlignByDeviceDataSet extends QueryDataSet {
RowRecord rowRecord = new RowRecord(originRowRecord.getTimestamp());
Field deviceField = new Field(TSDataType.TEXT);
- deviceField.setBinaryV(new Binary(currentDevice));
+ deviceField.setBinaryV(new Binary(currentDevice.toString()));
rowRecord.addField(deviceField);
List<Field> measurementFields = originRowRecord.getFields();
diff --git
a/server/src/main/java/org/apache/iotdb/db/query/dataset/RawQueryDataSetWithoutValueFilter.java
b/server/src/main/java/org/apache/iotdb/db/query/dataset/RawQueryDataSetWithoutValueFilter.java
index 6f8c756..0eba4c2 100644
---
a/server/src/main/java/org/apache/iotdb/db/query/dataset/RawQueryDataSetWithoutValueFilter.java
+++
b/server/src/main/java/org/apache/iotdb/db/query/dataset/RawQueryDataSetWithoutValueFilter.java
@@ -20,6 +20,7 @@
package org.apache.iotdb.db.query.dataset;
import org.apache.iotdb.db.concurrent.WrappedRunnable;
+import org.apache.iotdb.db.metadata.PartialPath;
import org.apache.iotdb.db.query.pool.QueryTaskPoolManager;
import org.apache.iotdb.db.query.reader.series.ManagedSeriesReader;
import org.apache.iotdb.db.tools.watermark.WatermarkEncoder;
diff --git
a/server/src/main/java/org/apache/iotdb/db/query/dataset/groupby/GroupByEngineDataSet.java
b/server/src/main/java/org/apache/iotdb/db/query/dataset/groupby/GroupByEngineDataSet.java
index df1a6cf..7f0b1e1 100644
---
a/server/src/main/java/org/apache/iotdb/db/query/dataset/groupby/GroupByEngineDataSet.java
+++
b/server/src/main/java/org/apache/iotdb/db/query/dataset/groupby/GroupByEngineDataSet.java
@@ -18,6 +18,8 @@
*/
package org.apache.iotdb.db.query.dataset.groupby;
+import java.util.stream.Collectors;
+import org.apache.iotdb.db.metadata.PartialPath;
import org.apache.iotdb.db.qp.physical.crud.GroupByTimePlan;
import org.apache.iotdb.db.query.context.QueryContext;
import org.apache.iotdb.db.utils.TestOnly;
@@ -50,7 +52,8 @@ public abstract class GroupByEngineDataSet extends
QueryDataSet {
* groupBy query.
*/
public GroupByEngineDataSet(QueryContext context, GroupByTimePlan
groupByTimePlan) {
- super(groupByTimePlan.getDeduplicatedPaths(),
groupByTimePlan.getDeduplicatedDataTypes());
+
super(groupByTimePlan.getDeduplicatedPaths().stream().map(PartialPath::toTSFilePath).collect(
+ Collectors.toList()), groupByTimePlan.getDeduplicatedDataTypes());
this.queryId = context.getQueryId();
this.interval = groupByTimePlan.getInterval();
this.slidingStep = groupByTimePlan.getSlidingStep();
diff --git
a/server/src/main/java/org/apache/iotdb/db/query/dataset/groupby/GroupByFillDataSet.java
b/server/src/main/java/org/apache/iotdb/db/query/dataset/groupby/GroupByFillDataSet.java
index f83237a..c91ed77 100644
---
a/server/src/main/java/org/apache/iotdb/db/query/dataset/groupby/GroupByFillDataSet.java
+++
b/server/src/main/java/org/apache/iotdb/db/query/dataset/groupby/GroupByFillDataSet.java
@@ -20,7 +20,9 @@ package org.apache.iotdb.db.query.dataset.groupby;
import org.apache.iotdb.db.conf.IoTDBDescriptor;
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.PartialPath;
import org.apache.iotdb.db.qp.physical.crud.GroupByTimeFillPlan;
import org.apache.iotdb.db.query.context.QueryContext;
import org.apache.iotdb.db.query.executor.LastQueryExecutor;
@@ -50,7 +52,7 @@ public class GroupByFillDataSet extends QueryDataSet {
public GroupByFillDataSet(List<Path> paths, List<TSDataType> dataTypes,
GroupByEngineDataSet groupByEngineDataSet,
Map<TSDataType, IFill> fillTypes, QueryContext context,
GroupByTimeFillPlan groupByFillPlan)
- throws StorageEngineException, IOException, QueryProcessException {
+ throws StorageEngineException, IOException, QueryProcessException,
IllegalPathException {
super(paths, dataTypes);
this.groupByEngineDataSet = groupByEngineDataSet;
this.fillTypes = fillTypes;
@@ -59,7 +61,7 @@ public class GroupByFillDataSet extends QueryDataSet {
}
private void initPreviousParis(QueryContext context, GroupByTimeFillPlan
groupByFillPlan)
- throws StorageEngineException, IOException, QueryProcessException {
+ throws StorageEngineException, IOException, QueryProcessException,
IllegalPathException {
previousValue = new Object[paths.size()];
for (int i = 0; i < paths.size(); i++) {
Path path = paths.get(i);
@@ -86,12 +88,12 @@ public class GroupByFillDataSet extends QueryDataSet {
}
private void initLastTimeArray(QueryContext context, GroupByTimeFillPlan
groupByFillPlan)
- throws IOException, StorageEngineException, QueryProcessException {
+ throws IOException, StorageEngineException, QueryProcessException,
IllegalPathException {
lastTimeArray = new long[paths.size()];
Arrays.fill(lastTimeArray, Long.MAX_VALUE);
for (int i = 0; i < paths.size(); i++) {
TimeValuePair lastTimeValuePair =
LastQueryExecutor.calculateLastPairForOneSeriesLocally(
- paths.get(i), dataTypes.get(i), context,
+ new PartialPath(paths.get(i).getFullPath()), dataTypes.get(i),
context,
groupByFillPlan.getAllMeasurementsInDevice(paths.get(i).getDevice()));
if (lastTimeValuePair.getValue() != null) {
lastTimeArray[i] = lastTimeValuePair.getTimestamp();
diff --git
a/server/src/main/java/org/apache/iotdb/db/query/dataset/groupby/GroupByTimeDataSet.java
b/server/src/main/java/org/apache/iotdb/db/query/dataset/groupby/GroupByTimeDataSet.java
index b655709..7d5e9ac 100644
---
a/server/src/main/java/org/apache/iotdb/db/query/dataset/groupby/GroupByTimeDataSet.java
+++
b/server/src/main/java/org/apache/iotdb/db/query/dataset/groupby/GroupByTimeDataSet.java
@@ -19,8 +19,10 @@
package org.apache.iotdb.db.query.dataset.groupby;
+import java.util.stream.Collectors;
import org.apache.iotdb.db.exception.StorageEngineException;
import org.apache.iotdb.db.exception.query.QueryProcessException;
+import org.apache.iotdb.db.metadata.PartialPath;
import org.apache.iotdb.db.qp.physical.crud.GroupByTimePlan;
import org.apache.iotdb.db.query.aggregation.AggregateResult;
import org.apache.iotdb.db.query.context.QueryContext;
@@ -52,9 +54,10 @@ public class GroupByTimeDataSet extends QueryDataSet {
private QueryContext context;
public GroupByTimeDataSet(QueryContext context, GroupByTimePlan plan,
GroupByEngineDataSet dataSet)
- throws QueryProcessException, StorageEngineException, IOException {
+ throws IOException {
this.queryId = context.getQueryId();
- this.paths = plan.getDeduplicatedPaths();
+ this.paths =
plan.getDeduplicatedPaths().stream().map(PartialPath::toTSFilePath).collect(
+ Collectors.toList());
this.dataTypes = plan.getDeduplicatedDataTypes();
this.groupByTimePlan = plan;
this.context = context;
diff --git
a/server/src/main/java/org/apache/iotdb/db/query/executor/AggregationExecutor.java
b/server/src/main/java/org/apache/iotdb/db/query/executor/AggregationExecutor.java
index e7f51cd..9b2db1d 100644
---
a/server/src/main/java/org/apache/iotdb/db/query/executor/AggregationExecutor.java
+++
b/server/src/main/java/org/apache/iotdb/db/query/executor/AggregationExecutor.java
@@ -19,10 +19,13 @@
package org.apache.iotdb.db.query.executor;
+import java.util.stream.Collectors;
import org.apache.iotdb.db.conf.IoTDBDescriptor;
import org.apache.iotdb.db.engine.querycontext.QueryDataSource;
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.PartialPath;
import org.apache.iotdb.db.qp.physical.crud.AggregationPlan;
import org.apache.iotdb.db.qp.physical.crud.RawDataQueryPlan;
import org.apache.iotdb.db.query.aggregation.AggregateResult;
@@ -65,7 +68,8 @@ public class AggregationExecutor {
private int aggregateFetchSize;
protected AggregationExecutor(AggregationPlan aggregationPlan) {
- this.selectedSeries = aggregationPlan.getDeduplicatedPaths();
+ this.selectedSeries =
aggregationPlan.getDeduplicatedPaths().stream().map(PartialPath::toTSFilePath).collect(
+ Collectors.toList());
this.dataTypes = aggregationPlan.getDeduplicatedDataTypes();
this.aggregations = aggregationPlan.getDeduplicatedAggregations();
this.expression = aggregationPlan.getExpression();
@@ -78,7 +82,7 @@ public class AggregationExecutor {
* @param context query context
*/
public QueryDataSet executeWithoutValueFilter(QueryContext context,
AggregationPlan aggregationPlan)
- throws StorageEngineException, IOException, QueryProcessException {
+ throws StorageEngineException, IOException, QueryProcessException,
IllegalPathException {
Filter timeFilter = null;
if (expression != null) {
@@ -112,7 +116,7 @@ public class AggregationExecutor {
Map.Entry<Path, List<Integer>> pathToAggrIndexes,
Set<String> measurements,
Filter timeFilter, QueryContext context)
- throws IOException, QueryProcessException, StorageEngineException {
+ throws IOException, QueryProcessException, StorageEngineException,
IllegalPathException {
List<AggregateResult> aggregateResultList = new ArrayList<>();
Path seriesPath = pathToAggrIndexes.getKey();
@@ -130,7 +134,7 @@ public class AggregationExecutor {
public static void aggregateOneSeries(Path seriesPath, Set<String>
measurements, QueryContext context, Filter timeFilter,
TSDataType tsDataType, List<AggregateResult> aggregateResultList,
TsFileFilter fileFilter)
- throws StorageEngineException, IOException, QueryProcessException {
+ throws StorageEngineException, IOException, QueryProcessException,
IllegalPathException {
// construct series reader without value filter
QueryDataSource queryDataSource = QueryResourceManager.getInstance()
@@ -256,7 +260,7 @@ public class AggregationExecutor {
* @param context query context.
*/
public QueryDataSet executeWithValueFilter(QueryContext context,
RawDataQueryPlan queryPlan)
- throws StorageEngineException, IOException, QueryProcessException {
+ throws StorageEngineException, IOException, QueryProcessException,
IllegalPathException {
TimeGenerator timestampGenerator = getTimeGenerator(context, queryPlan);
List<IReaderByTimestamp> readersOfSelectedSeries = new ArrayList<>();
@@ -282,7 +286,8 @@ public class AggregationExecutor {
}
protected IReaderByTimestamp getReaderByTime(Path path, RawDataQueryPlan
queryPlan, TSDataType dataType,
- QueryContext context) throws StorageEngineException,
QueryProcessException {
+ QueryContext context)
+ throws StorageEngineException, QueryProcessException,
IllegalPathException {
return new SeriesReaderByTimestamp(path,
queryPlan.getAllMeasurementsInDevice(path.getDevice()), dataType, context,
QueryResourceManager.getInstance().getQueryDataSource(path, context,
null), null);
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/query/executor/FillQueryExecutor.java
b/server/src/main/java/org/apache/iotdb/db/query/executor/FillQueryExecutor.java
index 13eafc7..518187e 100644
---
a/server/src/main/java/org/apache/iotdb/db/query/executor/FillQueryExecutor.java
+++
b/server/src/main/java/org/apache/iotdb/db/query/executor/FillQueryExecutor.java
@@ -22,6 +22,7 @@ package org.apache.iotdb.db.query.executor;
import java.util.Set;
import org.apache.iotdb.db.conf.IoTDBDescriptor;
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.qp.physical.crud.FillQueryPlan;
import org.apache.iotdb.db.query.context.QueryContext;
@@ -62,7 +63,7 @@ public class FillQueryExecutor {
* @param context query context
*/
public QueryDataSet execute(QueryContext context, FillQueryPlan
fillQueryPlan)
- throws StorageEngineException, QueryProcessException, IOException {
+ throws StorageEngineException, QueryProcessException, IOException,
IllegalPathException {
RowRecord record = new RowRecord(queryTime);
for (int i = 0; i < selectedSeries.size(); i++) {
diff --git
a/server/src/main/java/org/apache/iotdb/db/query/executor/IQueryRouter.java
b/server/src/main/java/org/apache/iotdb/db/query/executor/IQueryRouter.java
index b39bb6a..14a66e6 100644
--- a/server/src/main/java/org/apache/iotdb/db/query/executor/IQueryRouter.java
+++ b/server/src/main/java/org/apache/iotdb/db/query/executor/IQueryRouter.java
@@ -35,13 +35,13 @@ public interface IQueryRouter {
* Execute physical plan.
*/
QueryDataSet rawDataQuery(RawDataQueryPlan queryPlan, QueryContext context)
- throws StorageEngineException, QueryProcessException;
+ throws StorageEngineException, QueryProcessException,
IllegalPathException;
/**
* Execute aggregation query.
*/
QueryDataSet aggregate(AggregationPlan aggregationPlan, QueryContext context)
- throws QueryFilterOptimizationException, StorageEngineException,
IOException, QueryProcessException;
+ throws QueryFilterOptimizationException, StorageEngineException,
IOException, QueryProcessException, IllegalPathException;
/**
* Execute groupBy query.
@@ -54,7 +54,7 @@ public interface IQueryRouter {
* Execute fill query.
*/
QueryDataSet fill(FillQueryPlan fillQueryPlan, QueryContext context)
- throws StorageEngineException, QueryProcessException, IOException;
+ throws StorageEngineException, QueryProcessException, IOException,
IllegalPathException;
/**
* Execute group by fill query
@@ -67,5 +67,5 @@ public interface IQueryRouter {
* Execute last query
*/
QueryDataSet lastQuery(LastQueryPlan lastQueryPlan, QueryContext context)
- throws StorageEngineException, QueryProcessException, IOException;
+ throws StorageEngineException, QueryProcessException, IOException,
IllegalPathException;
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/query/executor/LastQueryExecutor.java
b/server/src/main/java/org/apache/iotdb/db/query/executor/LastQueryExecutor.java
index 7f03ce9..5ef925d 100644
---
a/server/src/main/java/org/apache/iotdb/db/query/executor/LastQueryExecutor.java
+++
b/server/src/main/java/org/apache/iotdb/db/query/executor/LastQueryExecutor.java
@@ -23,8 +23,10 @@ package org.apache.iotdb.db.query.executor;
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.PartialPath;
import org.apache.iotdb.db.metadata.mnode.MeasurementMNode;
import org.apache.iotdb.db.qp.physical.crud.LastQueryPlan;
import org.apache.iotdb.db.query.context.QueryContext;
@@ -53,7 +55,7 @@ import static
org.apache.iotdb.db.conf.IoTDBConstant.COLUMN_TIMESERIES;
import static org.apache.iotdb.db.conf.IoTDBConstant.COLUMN_VALUE;
public class LastQueryExecutor {
- private List<Path> selectedSeries;
+ private List<PartialPath> selectedSeries;
private List<TSDataType> dataTypes;
public LastQueryExecutor(LastQueryPlan lastQueryPlan) {
@@ -61,7 +63,7 @@ public class LastQueryExecutor {
this.dataTypes = lastQueryPlan.getDeduplicatedDataTypes();
}
- public LastQueryExecutor(List<Path> selectedSeries, List<TSDataType>
dataTypes) {
+ public LastQueryExecutor(List<PartialPath> selectedSeries, List<TSDataType>
dataTypes) {
this.selectedSeries = selectedSeries;
this.dataTypes = dataTypes;
}
@@ -72,7 +74,7 @@ public class LastQueryExecutor {
* @param context query context
*/
public QueryDataSet execute(QueryContext context, LastQueryPlan
lastQueryPlan)
- throws StorageEngineException, IOException, QueryProcessException {
+ throws StorageEngineException, IOException, QueryProcessException,
IllegalPathException {
ListDataSet dataSet = new ListDataSet(
Arrays.asList(new Path(COLUMN_TIMESERIES), new Path(COLUMN_VALUE)),
@@ -81,14 +83,14 @@ public class LastQueryExecutor {
for (int i = 0; i < selectedSeries.size(); i++) {
TimeValuePair lastTimeValuePair = calculateLastPairForOneSeries(
selectedSeries.get(i), dataTypes.get(i), context,
-
lastQueryPlan.getAllMeasurementsInDevice(selectedSeries.get(i).getDevice()));
+
lastQueryPlan.getAllMeasurementsInDevice(selectedSeries.get(i).getPathWithoutLastNode()));
if (lastTimeValuePair.getValue() != null) {
RowRecord resultRecord = new
RowRecord(lastTimeValuePair.getTimestamp());
Field pathField = new Field(TSDataType.TEXT);
if (selectedSeries.get(i).getAlias() != null) {
- pathField.setBinaryV(new
Binary(selectedSeries.get(i).getFullPathWithAlias()));
+ pathField.setBinaryV(new
Binary(selectedSeries.get(i).getPathWithoutLastNodeWithAlias()));
} else {
- pathField.setBinaryV(new
Binary(selectedSeries.get(i).getFullPath()));
+ pathField.setBinaryV(new Binary(selectedSeries.get(i).toString()));
}
resultRecord.addField(pathField);
@@ -104,8 +106,8 @@ public class LastQueryExecutor {
}
protected TimeValuePair calculateLastPairForOneSeries(
- Path seriesPath, TSDataType tsDataType, QueryContext context,
Set<String> deviceMeasurements)
- throws IOException, QueryProcessException, StorageEngineException {
+ PartialPath seriesPath, TSDataType tsDataType, QueryContext context,
Set<String> deviceMeasurements)
+ throws IOException, QueryProcessException, StorageEngineException,
IllegalPathException {
return calculateLastPairForOneSeriesLocally(seriesPath, tsDataType,
context,
deviceMeasurements);
}
@@ -117,15 +119,15 @@ public class LastQueryExecutor {
* @return TimeValuePair
*/
public static TimeValuePair calculateLastPairForOneSeriesLocally(
- Path seriesPath, TSDataType tsDataType, QueryContext context,
Set<String> deviceMeasurements)
- throws IOException, QueryProcessException, StorageEngineException {
+ PartialPath seriesPath, TSDataType tsDataType, QueryContext context,
Set<String> deviceMeasurements)
+ throws IOException, QueryProcessException, StorageEngineException,
IllegalPathException {
// Retrieve last value from MNode
MeasurementMNode node = null;
try {
- node = (MeasurementMNode)
IoTDB.metaManager.getNodeByPath(seriesPath.toString());
+ node = (MeasurementMNode) IoTDB.metaManager.getNodeByPath(seriesPath);
} catch (MetadataException e) {
- TimeValuePair timeValuePair =
IoTDB.metaManager.getLastCache(seriesPath.getFullPath());
+ TimeValuePair timeValuePair = IoTDB.metaManager.getLastCache(seriesPath);
if (timeValuePair != null) {
return timeValuePair;
}
@@ -136,7 +138,7 @@ public class LastQueryExecutor {
}
QueryDataSource dataSource =
- QueryResourceManager.getInstance().getQueryDataSource(seriesPath,
context, null);
+
QueryResourceManager.getInstance().getQueryDataSource(seriesPath.toTSFilePath(),
context, null);
List<TsFileResource> seqFileResources = dataSource.getSeqResources();
List<TsFileResource> unseqFileResources = dataSource.getUnseqResources();
@@ -146,7 +148,7 @@ public class LastQueryExecutor {
if (!seqFileResources.isEmpty()) {
for (int i = seqFileResources.size() - 1; i >= 0; i--) {
TimeseriesMetadata timeseriesMetadata =
FileLoaderUtils.loadTimeSeriesMetadata(
- seqFileResources.get(i), seriesPath, context, null,
deviceMeasurements);
+ seqFileResources.get(i), seriesPath.toTSFilePath(), context,
null, deviceMeasurements);
if (timeseriesMetadata != null) {
if (!timeseriesMetadata.isModified()) {
Statistics timeseriesMetadataStats =
timeseriesMetadata.getStatistics();
@@ -172,11 +174,11 @@ public class LastQueryExecutor {
long version = 0;
for (TsFileResource resource : unseqFileResources) {
- if (resource.getEndTime(seriesPath.getDevice()) <
resultPair.getTimestamp()) {
+ if (resource.getEndTime(seriesPath.getPathWithoutLastNode()) <
resultPair.getTimestamp()) {
continue;
}
TimeseriesMetadata timeseriesMetadata =
- FileLoaderUtils.loadTimeSeriesMetadata(resource, seriesPath,
context, null, deviceMeasurements);
+ FileLoaderUtils.loadTimeSeriesMetadata(resource,
seriesPath.toTSFilePath(), context, null, deviceMeasurements);
if (timeseriesMetadata != null) {
for (ChunkMetadata chunkMetaData :
timeseriesMetadata.loadChunkMetadataList()) {
if (chunkMetaData.getEndTime() > resultPair.getTimestamp()
@@ -193,7 +195,7 @@ public class LastQueryExecutor {
}
// Update cached last value with low priority
- IoTDB.metaManager.updateLastCache(seriesPath.getFullPath(),
+ IoTDB.metaManager.updateLastCache(seriesPath,
resultPair, false, Long.MIN_VALUE, node);
return resultPair;
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/query/executor/QueryRouter.java
b/server/src/main/java/org/apache/iotdb/db/query/executor/QueryRouter.java
index c14f62a..a3be7c4 100644
--- a/server/src/main/java/org/apache/iotdb/db/query/executor/QueryRouter.java
+++ b/server/src/main/java/org/apache/iotdb/db/query/executor/QueryRouter.java
@@ -63,7 +63,7 @@ public class QueryRouter implements IQueryRouter {
@Override
public QueryDataSet rawDataQuery(RawDataQueryPlan queryPlan, QueryContext
context)
- throws StorageEngineException, QueryProcessException {
+ throws StorageEngineException, QueryProcessException,
IllegalPathException {
IExpression expression = queryPlan.getExpression();
List<Path> deduplicatedPaths =
queryPlan.getDeduplicatedPaths().stream().map(PartialPath::toTSFilePath).collect(
Collectors.toList());
@@ -98,7 +98,7 @@ public class QueryRouter implements IQueryRouter {
@Override
public QueryDataSet aggregate(AggregationPlan aggregationPlan, QueryContext
context)
throws QueryFilterOptimizationException, StorageEngineException,
QueryProcessException,
- IOException {
+ IOException, IllegalPathException {
if (logger.isDebugEnabled()) {
logger.debug("paths:" + aggregationPlan.getPaths()
@@ -201,7 +201,7 @@ public class QueryRouter implements IQueryRouter {
@Override
public QueryDataSet fill(FillQueryPlan fillQueryPlan, QueryContext context)
- throws StorageEngineException, QueryProcessException, IOException {
+ throws StorageEngineException, QueryProcessException, IOException,
IllegalPathException {
List<Path> fillPaths =
fillQueryPlan.getDeduplicatedPaths().stream().map(PartialPath::toTSFilePath).collect(
Collectors.toList());
List<TSDataType> dataTypes = fillQueryPlan.getDeduplicatedDataTypes();
@@ -231,7 +231,7 @@ public class QueryRouter implements IQueryRouter {
@Override
public QueryDataSet lastQuery(LastQueryPlan lastQueryPlan, QueryContext
context)
- throws StorageEngineException, QueryProcessException, IOException {
+ throws StorageEngineException, QueryProcessException, IOException,
IllegalPathException {
LastQueryExecutor lastQueryExecutor = getLastQueryExecutor(lastQueryPlan);
return lastQueryExecutor.execute(context, lastQueryPlan);
}
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 5899643..1f0a1ae 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
@@ -24,9 +24,12 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
+import java.util.stream.Collectors;
import org.apache.iotdb.db.engine.querycontext.QueryDataSource;
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.PartialPath;
import org.apache.iotdb.db.qp.physical.crud.RawDataQueryPlan;
import org.apache.iotdb.db.query.context.QueryContext;
import org.apache.iotdb.db.query.control.QueryResourceManager;
@@ -51,7 +54,7 @@ import
org.apache.iotdb.tsfile.read.query.timegenerator.TimeGenerator;
*/
public class RawDataQueryExecutor {
- protected List<Path> deduplicatedPaths;
+ protected List<PartialPath> deduplicatedPaths;
protected List<TSDataType> deduplicatedDataTypes;
protected IExpression optimizedExpression;
@@ -65,11 +68,12 @@ public class RawDataQueryExecutor {
* without filter or with global time filter.
*/
public QueryDataSet executeWithoutValueFilter(QueryContext context,
RawDataQueryPlan queryPlan)
- throws StorageEngineException, QueryProcessException {
+ throws StorageEngineException, QueryProcessException,
IllegalPathException {
List<ManagedSeriesReader> readersOfSelectedSeries =
initManagedSeriesReader(context, queryPlan);
try {
- return new RawQueryDataSetWithoutValueFilter(deduplicatedPaths,
deduplicatedDataTypes,
+ return new
RawQueryDataSetWithoutValueFilter(deduplicatedPaths.stream().map(PartialPath::toTSFilePath).collect(
+ Collectors.toList()), deduplicatedDataTypes,
readersOfSelectedSeries);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
@@ -80,14 +84,15 @@ public class RawDataQueryExecutor {
}
public QueryDataSet executeNonAlign(QueryContext context, RawDataQueryPlan
queryPlan)
- throws StorageEngineException, QueryProcessException {
+ throws StorageEngineException, QueryProcessException,
IllegalPathException {
List<ManagedSeriesReader> readersOfSelectedSeries =
initManagedSeriesReader(context, queryPlan);
- return new NonAlignEngineDataSet(deduplicatedPaths, deduplicatedDataTypes,
+ return new
NonAlignEngineDataSet(deduplicatedPaths.stream().map(PartialPath::toTSFilePath).collect(
+ Collectors.toList()), deduplicatedDataTypes,
readersOfSelectedSeries);
}
protected List<ManagedSeriesReader> initManagedSeriesReader(QueryContext
context, RawDataQueryPlan queryPlan)
- throws StorageEngineException, QueryProcessException {
+ throws StorageEngineException, QueryProcessException,
IllegalPathException {
Filter timeFilter = null;
if (optimizedExpression != null) {
timeFilter = ((GlobalTimeExpression) optimizedExpression).getFilter();
@@ -95,14 +100,14 @@ public class RawDataQueryExecutor {
List<ManagedSeriesReader> readersOfSelectedSeries = new ArrayList<>();
for (int i = 0; i < deduplicatedPaths.size(); i++) {
- Path path = deduplicatedPaths.get(i);
+ PartialPath path = deduplicatedPaths.get(i);
TSDataType dataType = deduplicatedDataTypes.get(i);
QueryDataSource queryDataSource = QueryResourceManager.getInstance()
- .getQueryDataSource(path, context, timeFilter);
+ .getQueryDataSource(path.toTSFilePath(), context, timeFilter);
timeFilter = queryDataSource.updateFilterUsingTTL(timeFilter);
- ManagedSeriesReader reader = new SeriesRawDataBatchReader(path,
queryPlan.getAllMeasurementsInDevice(path.getDevice()), dataType, context,
+ ManagedSeriesReader reader = new
SeriesRawDataBatchReader(path.toTSFilePath(),
queryPlan.getAllMeasurementsInDevice(path.getPathWithoutLastNode()), dataType,
context,
queryDataSource, timeFilter, null, null);
readersOfSelectedSeries.add(reader);
}
@@ -116,11 +121,12 @@ public class RawDataQueryExecutor {
* @throws StorageEngineException StorageEngineException
*/
public QueryDataSet executeWithValueFilter(QueryContext context,
RawDataQueryPlan queryPlan)
- throws StorageEngineException, QueryProcessException {
+ throws StorageEngineException, QueryProcessException,
IllegalPathException {
TimeGenerator timestampGenerator = getTimeGenerator(
optimizedExpression, context, queryPlan);
- List<Boolean> cached = markFilterdPaths(optimizedExpression,
deduplicatedPaths, timestampGenerator.hasOrNode());
+ List<Boolean> cached = markFilterdPaths(optimizedExpression,
deduplicatedPaths.stream().map(PartialPath::toTSFilePath).collect(
+ Collectors.toList()), timestampGenerator.hasOrNode());
List<IReaderByTimestamp> readersOfSelectedSeries = new ArrayList<>();
for (int i = 0; i < deduplicatedPaths.size(); i++) {
@@ -128,20 +134,22 @@ public class RawDataQueryExecutor {
readersOfSelectedSeries.add(null);
continue;
}
- Path path = deduplicatedPaths.get(i);
- IReaderByTimestamp seriesReaderByTimestamp = getReaderByTimestamp(path,
queryPlan.getAllMeasurementsInDevice(path.getDevice()),
+ PartialPath path = deduplicatedPaths.get(i);
+ IReaderByTimestamp seriesReaderByTimestamp = getReaderByTimestamp(path,
queryPlan.getAllMeasurementsInDevice(path.getPathWithoutLastNode()),
deduplicatedDataTypes.get(i), context);
readersOfSelectedSeries.add(seriesReaderByTimestamp);
}
- return new RawQueryDataSetWithValueFilter(deduplicatedPaths,
deduplicatedDataTypes,
+ return new
RawQueryDataSetWithValueFilter(deduplicatedPaths.stream().map(PartialPath::toTSFilePath).collect(
+ Collectors.toList()), deduplicatedDataTypes,
timestampGenerator, readersOfSelectedSeries, cached);
}
- protected IReaderByTimestamp getReaderByTimestamp(Path path, Set<String>
allSensors, TSDataType dataType,
- QueryContext context) throws StorageEngineException,
QueryProcessException {
- return new SeriesReaderByTimestamp(path, allSensors,
+ protected IReaderByTimestamp getReaderByTimestamp(PartialPath path,
Set<String> allSensors, TSDataType dataType,
+ QueryContext context)
+ throws StorageEngineException, QueryProcessException,
IllegalPathException {
+ return new SeriesReaderByTimestamp(path.toTSFilePath(), allSensors,
dataType, context,
- QueryResourceManager.getInstance().getQueryDataSource(path, context,
null), null);
+
QueryResourceManager.getInstance().getQueryDataSource(path.toTSFilePath(),
context, null), null);
}
protected TimeGenerator getTimeGenerator(IExpression expression,
diff --git
a/server/src/main/java/org/apache/iotdb/db/query/executor/fill/IFill.java
b/server/src/main/java/org/apache/iotdb/db/query/executor/fill/IFill.java
index 43605c5..debde8d 100644
--- a/server/src/main/java/org/apache/iotdb/db/query/executor/fill/IFill.java
+++ b/server/src/main/java/org/apache/iotdb/db/query/executor/fill/IFill.java
@@ -22,6 +22,7 @@ package org.apache.iotdb.db.query.executor.fill;
import java.io.IOException;
import java.util.Set;
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.query.context.QueryContext;
import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
@@ -47,7 +48,7 @@ public abstract class IFill {
Set<String> deviceMeasurements, QueryContext context);
public abstract TimeValuePair getFillResult()
- throws IOException, QueryProcessException, StorageEngineException;
+ throws IOException, QueryProcessException, StorageEngineException,
IllegalPathException;
public TSDataType getDataType() {
return this.dataType;
diff --git
a/server/src/main/java/org/apache/iotdb/db/query/executor/fill/LinearFill.java
b/server/src/main/java/org/apache/iotdb/db/query/executor/fill/LinearFill.java
index 4dbac70..8800020 100644
---
a/server/src/main/java/org/apache/iotdb/db/query/executor/fill/LinearFill.java
+++
b/server/src/main/java/org/apache/iotdb/db/query/executor/fill/LinearFill.java
@@ -24,6 +24,7 @@ import java.util.List;
import java.util.Set;
import org.apache.iotdb.db.engine.querycontext.QueryDataSource;
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.exception.query.UnSupportedFillTypeException;
import org.apache.iotdb.db.query.aggregation.AggregateResult;
@@ -113,7 +114,7 @@ public class LinearFill extends IFill {
@Override
public TimeValuePair getFillResult()
- throws IOException, QueryProcessException, StorageEngineException {
+ throws IOException, QueryProcessException, StorageEngineException,
IllegalPathException {
TimeValuePair beforePair = calculatePrecedingPoint();
TimeValuePair afterPair = calculateSucceedingPoint();
@@ -134,7 +135,7 @@ public class LinearFill extends IFill {
}
protected TimeValuePair calculatePrecedingPoint()
- throws QueryProcessException, StorageEngineException, IOException {
+ throws QueryProcessException, StorageEngineException, IOException,
IllegalPathException {
QueryDataSource dataSource =
QueryResourceManager.getInstance().getQueryDataSource(seriesPath,
context, beforeFilter);
LastPointReader lastReader =
@@ -144,7 +145,7 @@ public class LinearFill extends IFill {
}
protected TimeValuePair calculateSucceedingPoint()
- throws IOException, StorageEngineException, QueryProcessException {
+ throws IOException, StorageEngineException, QueryProcessException,
IllegalPathException {
TimeValuePair result = new TimeValuePair(0, null);
List<AggregateResult> aggregateResultList = new ArrayList<>();
diff --git
a/server/src/main/java/org/apache/iotdb/db/query/executor/fill/PreviousFill.java
b/server/src/main/java/org/apache/iotdb/db/query/executor/fill/PreviousFill.java
index d43b731..f40d9ed 100644
---
a/server/src/main/java/org/apache/iotdb/db/query/executor/fill/PreviousFill.java
+++
b/server/src/main/java/org/apache/iotdb/db/query/executor/fill/PreviousFill.java
@@ -20,6 +20,7 @@ package org.apache.iotdb.db.query.executor.fill;
import org.apache.iotdb.db.engine.querycontext.QueryDataSource;
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.query.context.QueryContext;
import org.apache.iotdb.db.query.control.QueryResourceManager;
@@ -94,7 +95,7 @@ public class PreviousFill extends IFill {
@Override
public TimeValuePair getFillResult()
- throws IOException, QueryProcessException, StorageEngineException {
+ throws IOException, QueryProcessException, StorageEngineException,
IllegalPathException {
QueryDataSource dataSource =
QueryResourceManager.getInstance().getQueryDataSource(seriesPath,
context, timeFilter);
// update filter by TTL
diff --git
a/server/src/main/java/org/apache/iotdb/db/query/timegenerator/ServerTimeGenerator.java
b/server/src/main/java/org/apache/iotdb/db/query/timegenerator/ServerTimeGenerator.java
index ee1cf91..d969483 100644
---
a/server/src/main/java/org/apache/iotdb/db/query/timegenerator/ServerTimeGenerator.java
+++
b/server/src/main/java/org/apache/iotdb/db/query/timegenerator/ServerTimeGenerator.java
@@ -18,23 +18,22 @@
*/
package org.apache.iotdb.db.query.timegenerator;
+import java.io.IOException;
import org.apache.iotdb.db.engine.querycontext.QueryDataSource;
import org.apache.iotdb.db.exception.StorageEngineException;
+import org.apache.iotdb.db.metadata.PartialPath;
import org.apache.iotdb.db.qp.physical.crud.RawDataQueryPlan;
import org.apache.iotdb.db.query.context.QueryContext;
import org.apache.iotdb.db.query.control.QueryResourceManager;
import org.apache.iotdb.db.query.reader.series.SeriesRawDataBatchReader;
import org.apache.iotdb.db.service.IoTDB;
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;
import org.apache.iotdb.tsfile.read.expression.impl.SingleSeriesExpression;
import org.apache.iotdb.tsfile.read.filter.basic.Filter;
import org.apache.iotdb.tsfile.read.query.timegenerator.TimeGenerator;
import org.apache.iotdb.tsfile.read.reader.IBatchReader;
-import java.io.IOException;
-
/**
* A timestamp generator for query with filter. e.g. For query clause "select
s1, s2 from root where
* s3 < 0 and time > 100", this class can iterate back to every timestamp of
the query.
@@ -64,20 +63,20 @@ public class ServerTimeGenerator extends TimeGenerator {
@Override
protected IBatchReader generateNewBatchReader(SingleSeriesExpression
expression)
- throws IOException {
- Filter filter = expression.getFilter();
- Path path = expression.getSeriesPath();
- TSDataType dataType;
- QueryDataSource queryDataSource;
+ throws IOException{
try {
- dataType = IoTDB.metaManager.getSeriesType(path.getFullPath());
- queryDataSource =
QueryResourceManager.getInstance().getQueryDataSource(path, context, filter);
+ Filter filter = expression.getFilter();
+ PartialPath path = new
PartialPath(expression.getSeriesPath().getFullPath());
+ TSDataType dataType;
+ QueryDataSource queryDataSource;
+ dataType = IoTDB.metaManager.getSeriesType(path);
+ queryDataSource =
QueryResourceManager.getInstance().getQueryDataSource(path.toTSFilePath(),
context, filter);
// update filter by TTL
filter = queryDataSource.updateFilterUsingTTL(filter);
+ return new SeriesRawDataBatchReader(path.toTSFilePath(),
queryPlan.getAllMeasurementsInDevice(path.getPathWithoutLastNode()), dataType,
context, queryDataSource, null, filter, null);
} catch (Exception e) {
throw new IOException(e);
}
- return new SeriesRawDataBatchReader(path,
queryPlan.getAllMeasurementsInDevice(path.getDevice()), dataType, context,
queryDataSource, null, filter, null);
}
}
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 38d133c..41a6bcb 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
@@ -49,10 +49,12 @@ import org.apache.iotdb.db.cost.statistic.Operation;
import org.apache.iotdb.db.exception.BatchInsertionException;
import org.apache.iotdb.db.exception.QueryInBatchStatementException;
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.metadata.StorageGroupNotSetException;
import org.apache.iotdb.db.exception.query.QueryProcessException;
import org.apache.iotdb.db.exception.runtime.SQLParserException;
+import org.apache.iotdb.db.metadata.PartialPath;
import org.apache.iotdb.db.metrics.server.SqlArgument;
import org.apache.iotdb.db.qp.Planner;
import org.apache.iotdb.db.qp.constant.SQLConstant;
@@ -346,12 +348,13 @@ public class TSServiceImpl implements TSIService.Iface,
ServerContext {
break;
case "COLUMN":
List<TSDataType> dataTypes =
-
getSeriesTypesByString(Collections.singletonList(req.getColumnPath()), null);
+ getSeriesTypesByString(Collections.singletonList(new
PartialPath(req.getColumnPath())), null);
resp.setDataType(dataTypes.get(0).toString());
status = RpcUtils.getStatus(TSStatusCode.SUCCESS_STATUS);
break;
case "ALL_COLUMNS":
- resp.setColumnsList(getPaths(req.getColumnPath()));
+ resp.setColumnsList(getPaths(new
PartialPath(req.getColumnPath())).stream().map(PartialPath::toString).collect(
+ Collectors.toList()));
status = RpcUtils.getStatus(TSStatusCode.SUCCESS_STATUS);
break;
default:
@@ -378,7 +381,7 @@ public class TSServiceImpl implements TSIService.Iface,
ServerContext {
return IoTDB.metaManager.getMetadataInString();
}
- protected List<String> getPaths(String path) throws MetadataException {
+ protected List<PartialPath> getPaths(PartialPath path) throws
MetadataException {
return IoTDB.metaManager.getAllTimeseriesName(path);
}
@@ -761,22 +764,22 @@ public class TSServiceImpl implements TSIService.Iface,
ServerContext {
// wide means not align by device
private void getWideQueryHeaders(
QueryPlan plan, List<String> respColumns, List<String> columnTypes)
- throws TException, QueryProcessException, MetadataException {
+ throws TException, MetadataException {
// Restore column header of aggregate to func(column_name), only
// support single aggregate function for now
- List<Path> paths = plan.getPaths();
+ List<PartialPath> paths = plan.getPaths();
List<TSDataType> seriesTypes;
switch (plan.getOperatorType()) {
case QUERY:
case FILL:
- for (Path path : paths) {
+ for (PartialPath path : paths) {
if (path.getAlias() != null) {
- respColumns.add(path.getFullPathWithAlias());
+ respColumns.add(path.getPathWithoutLastNodeWithAlias());
} else {
- respColumns.add(path.getFullPath());
+ respColumns.add(path.toString());
}
}
- seriesTypes = getSeriesTypesByString(respColumns, null);
+ seriesTypes = getSeriesTypesByString(paths, null);
break;
case AGGREGATION:
case GROUPBYTIME:
@@ -789,9 +792,9 @@ public class TSServiceImpl implements TSIService.Iface,
ServerContext {
}
for (int i = 0; i < paths.size(); i++) {
if (paths.get(i).getAlias() != null) {
- respColumns.add(aggregations.get(i) + "(" +
paths.get(i).getFullPathWithAlias() + ")");
+ respColumns.add(aggregations.get(i) + "(" +
paths.get(i).getPathWithoutLastNodeWithAlias() + ")");
} else {
- respColumns.add(aggregations.get(i) + "(" +
paths.get(i).getFullPath() + ")");
+ respColumns.add(aggregations.get(i) + "(" +
paths.get(i).toString() + ")");
}
}
seriesTypes = getSeriesTypesByPath(paths, aggregations);
@@ -1051,7 +1054,7 @@ public class TSServiceImpl implements TSIService.Iface,
ServerContext {
return sessionIdUsernameMap.get(sessionId) != null;
}
- private boolean checkAuthorization(List<Path> paths, PhysicalPlan plan,
String username)
+ private boolean checkAuthorization(List<PartialPath> paths, PhysicalPlan
plan, String username)
throws AuthException {
String targetUser = null;
if (plan instanceof AuthorPlan) {
@@ -1129,7 +1132,7 @@ public class TSServiceImpl implements TSIService.Iface,
ServerContext {
InsertRowPlan plan = new InsertRowPlan();
for (int i = 0; i < req.deviceIds.size(); i++) {
try {
- plan.setDeviceId(req.getDeviceIds().get(i));
+ plan.setDeviceId(new PartialPath(req.getDeviceIds().get(i)));
plan.setTime(req.getTimestamps().get(i));
plan.setMeasurements(req.getMeasurementsList().get(i).toArray(new
String[0]));
plan.setDataTypes(new TSDataType[plan.getMeasurements().length]);
@@ -1167,7 +1170,7 @@ public class TSServiceImpl implements TSIService.Iface,
ServerContext {
InsertRowPlan plan = new InsertRowPlan();
for (int i = 0; i < req.deviceIds.size(); i++) {
try {
- plan.setDeviceId(req.getDeviceIds().get(i));
+ plan.setDeviceId(new PartialPath(req.getDeviceIds().get(i)));
plan.setTime(req.getTimestamps().get(i));
plan.setMeasurements(req.getMeasurementsList().get(i).toArray(new
String[0]));
plan.setDataTypes(new TSDataType[plan.getMeasurements().length]);
@@ -1237,7 +1240,7 @@ public class TSServiceImpl implements TSIService.Iface,
ServerContext {
}
InsertRowPlan plan = new InsertRowPlan();
- plan.setDeviceId(req.getDeviceId());
+ plan.setDeviceId(new PartialPath(req.getDeviceId()));
plan.setTime(req.getTimestamp());
plan.setMeasurements(req.getMeasurements().toArray(new String[0]));
plan.setDataTypes(new TSDataType[plan.getMeasurements().length]);
@@ -1268,7 +1271,7 @@ public class TSServiceImpl implements TSIService.Iface,
ServerContext {
}
InsertRowPlan plan = new InsertRowPlan();
- plan.setDeviceId(req.getDeviceId());
+ plan.setDeviceId(new PartialPath(req.getDeviceId()));
plan.setTime(req.getTimestamp());
plan.setMeasurements(req.getMeasurements().toArray(new String[0]));
plan.setDataTypes(new TSDataType[plan.getMeasurements().length]);
@@ -1287,26 +1290,31 @@ public class TSServiceImpl implements TSIService.Iface,
ServerContext {
}
@Override
- public TSStatus deleteData(TSDeleteDataReq req) {
- if (!checkLogin(req.getSessionId())) {
- logger.info(INFO_NOT_LOGIN, IoTDBConstant.GLOBAL_DB_NAME);
- return RpcUtils.getStatus(TSStatusCode.NOT_LOGIN_ERROR);
- }
+ public TSStatus deleteData(TSDeleteDataReq req) throws TException {
+ try {
+ if (!checkLogin(req.getSessionId())) {
+ logger.info(INFO_NOT_LOGIN, IoTDBConstant.GLOBAL_DB_NAME);
+ return RpcUtils.getStatus(TSStatusCode.NOT_LOGIN_ERROR);
+ }
- DeletePlan plan = new DeletePlan();
- plan.setDeleteStartTime(req.getStartTime());
- plan.setDeleteEndTime(req.getEndTime());
- List<Path> paths = new ArrayList<>();
- for (String path : req.getPaths()) {
- paths.add(new Path(path));
- }
- plan.addPaths(paths);
+ DeletePlan plan = new DeletePlan();
+ plan.setDeleteStartTime(req.getStartTime());
+ plan.setDeleteEndTime(req.getEndTime());
+ List<PartialPath> paths = new ArrayList<>();
+ for (String path : req.getPaths()) {
+ paths.add(new PartialPath(path));
+ }
+ plan.addPaths(paths);
- TSStatus status = checkAuthority(plan, req.getSessionId());
- if (status != null) {
- return new TSStatus(status);
+ TSStatus status = checkAuthority(plan, req.getSessionId());
+ if (status != null) {
+ return new TSStatus(status);
+ }
+ return new TSStatus(executeNonQueryPlan(plan));
+ } catch (Exception e) {
+ logger.error("meet error when delete data", e);
}
- return new TSStatus(executeNonQueryPlan(plan));
+ return RpcUtils.getStatus(TSStatusCode.EXECUTE_STATEMENT_ERROR);
}
@Override
@@ -1318,7 +1326,7 @@ public class TSServiceImpl implements TSIService.Iface,
ServerContext {
return RpcUtils.getStatus(TSStatusCode.NOT_LOGIN_ERROR);
}
- InsertTabletPlan insertTabletPlan = new InsertTabletPlan(req.deviceId,
req.measurements);
+ InsertTabletPlan insertTabletPlan = new InsertTabletPlan(new
PartialPath(req.deviceId), req.measurements);
insertTabletPlan.setTimes(QueryDataSetUtils.readTimesFromBuffer(req.timestamps,
req.size));
insertTabletPlan.setColumns(
QueryDataSetUtils.readValuesFromBuffer(
@@ -1352,7 +1360,7 @@ public class TSServiceImpl implements TSIService.Iface,
ServerContext {
List<TSStatus> statusList = new ArrayList<>();
for (int i = 0; i < req.deviceIds.size(); i++) {
- InsertTabletPlan insertTabletPlan = new
InsertTabletPlan(req.deviceIds.get(i),
+ InsertTabletPlan insertTabletPlan = new InsertTabletPlan(new
PartialPath(req.deviceIds.get(i)),
req.measurementsList.get(i));
insertTabletPlan.setTimes(
QueryDataSetUtils.readTimesFromBuffer(req.timestampsList.get(i),
req.sizeList.get(i)));
@@ -1383,136 +1391,161 @@ public class TSServiceImpl implements
TSIService.Iface, ServerContext {
@Override
public TSStatus setStorageGroup(long sessionId, String storageGroup) {
- if (!checkLogin(sessionId)) {
- logger.info(INFO_NOT_LOGIN, IoTDBConstant.GLOBAL_DB_NAME);
- return RpcUtils.getStatus(TSStatusCode.NOT_LOGIN_ERROR);
- }
+ try {
+ if (!checkLogin(sessionId)) {
+ logger.info(INFO_NOT_LOGIN, IoTDBConstant.GLOBAL_DB_NAME);
+ return RpcUtils.getStatus(TSStatusCode.NOT_LOGIN_ERROR);
+ }
- TSStatus status = checkPathValidity(storageGroup);
- if (status != null) {
- return status;
- }
+ TSStatus status = checkPathValidity(storageGroup);
+ if (status != null) {
+ return status;
+ }
- SetStorageGroupPlan plan = new SetStorageGroupPlan(new Path(storageGroup));
- status = checkAuthority(plan, sessionId);
- if (status != null) {
- return new TSStatus(status);
+ SetStorageGroupPlan plan = new SetStorageGroupPlan(new
PartialPath(storageGroup));
+ status = checkAuthority(plan, sessionId);
+ if (status != null) {
+ return new TSStatus(status);
+ }
+ return new TSStatus(executeNonQueryPlan(plan));
+ } catch (Exception e) {
+ logger.error("meet error when set storage group", e);
}
- return new TSStatus(executeNonQueryPlan(plan));
+ return RpcUtils.getStatus(TSStatusCode.EXECUTE_STATEMENT_ERROR);
}
@Override
public TSStatus deleteStorageGroups(long sessionId, List<String>
storageGroups) {
- if (!checkLogin(sessionId)) {
- logger.info(INFO_NOT_LOGIN, IoTDBConstant.GLOBAL_DB_NAME);
- return RpcUtils.getStatus(TSStatusCode.NOT_LOGIN_ERROR);
- }
- List<Path> storageGroupList = new ArrayList<>();
- for (String storageGroup : storageGroups) {
- storageGroupList.add(new Path(storageGroup));
- }
- DeleteStorageGroupPlan plan = new DeleteStorageGroupPlan(storageGroupList);
- TSStatus status = checkAuthority(plan, sessionId);
- if (status != null) {
- return new TSStatus(status);
+ try {
+ if (!checkLogin(sessionId)) {
+ logger.info(INFO_NOT_LOGIN, IoTDBConstant.GLOBAL_DB_NAME);
+ return RpcUtils.getStatus(TSStatusCode.NOT_LOGIN_ERROR);
+ }
+ List<PartialPath> storageGroupList = new ArrayList<>();
+ for (String storageGroup : storageGroups) {
+ storageGroupList.add(new PartialPath(storageGroup));
+ }
+ DeleteStorageGroupPlan plan = new
DeleteStorageGroupPlan(storageGroupList);
+ TSStatus status = checkAuthority(plan, sessionId);
+ if (status != null) {
+ return new TSStatus(status);
+ }
+ return new TSStatus(executeNonQueryPlan(plan));
+ } catch (Exception e) {
+ logger.error("meet error when delete storage groups", e);
}
- return new TSStatus(executeNonQueryPlan(plan));
+ return RpcUtils.getStatus(TSStatusCode.EXECUTE_STATEMENT_ERROR);
}
@Override
public TSStatus createTimeseries(TSCreateTimeseriesReq req) {
- if (!checkLogin(req.getSessionId())) {
- logger.info(INFO_NOT_LOGIN, IoTDBConstant.GLOBAL_DB_NAME);
- return RpcUtils.getStatus(TSStatusCode.NOT_LOGIN_ERROR);
- }
+ try {
+ if (!checkLogin(req.getSessionId())) {
+ logger.info(INFO_NOT_LOGIN, IoTDBConstant.GLOBAL_DB_NAME);
+ return RpcUtils.getStatus(TSStatusCode.NOT_LOGIN_ERROR);
+ }
- auditLogger.debug("Session-{} create timeseries {}", currSessionId.get(),
req.getPath());
- TSStatus status = checkPathValidity(req.path);
- if (status != null) {
- return status;
- }
+ auditLogger.debug("Session-{} create timeseries {}",
currSessionId.get(), req.getPath());
+ TSStatus status = checkPathValidity(req.path);
+ if (status != null) {
+ return status;
+ }
- CreateTimeSeriesPlan plan = new CreateTimeSeriesPlan(new Path(req.path),
- TSDataType.values()[req.dataType], TSEncoding.values()[req.encoding],
- CompressionType.values()[req.compressor], req.props, req.tags,
req.attributes,
- req.measurementAlias);
- status = checkAuthority(plan, req.getSessionId());
- if (status != null) {
- return status;
+ CreateTimeSeriesPlan plan = new CreateTimeSeriesPlan(new
PartialPath(req.path),
+ TSDataType.values()[req.dataType], TSEncoding.values()[req.encoding],
+ CompressionType.values()[req.compressor], req.props, req.tags,
req.attributes,
+ req.measurementAlias);
+ status = checkAuthority(plan, req.getSessionId());
+ if (status != null) {
+ return status;
+ }
+ return executeNonQueryPlan(plan);
+ } catch (Exception e) {
+ logger.error("meet error when create timeseries", e);
}
- return executeNonQueryPlan(plan);
+ return RpcUtils.getStatus(TSStatusCode.EXECUTE_STATEMENT_ERROR);
}
@Override
public TSStatus createMultiTimeseries(TSCreateMultiTimeseriesReq req) {
- if (!checkLogin(req.getSessionId())) {
- logger.info(INFO_NOT_LOGIN, IoTDBConstant.GLOBAL_DB_NAME);
- return RpcUtils.getStatus(TSStatusCode.NOT_LOGIN_ERROR);
- }
- auditLogger.debug("Session-{} create {} timeseries, the first is {}",
currSessionId.get(),
- req.getPaths().size(), req.getPaths().get(0));
- List<TSStatus> statusList = new ArrayList<>(req.paths.size());
- for (int i = 0; i < req.paths.size(); i++) {
- CreateTimeSeriesPlan plan = new CreateTimeSeriesPlan(new
Path(req.getPaths().get(i)),
- TSDataType.values()[req.dataTypes.get(i)],
TSEncoding.values()[req.encodings.get(i)],
- CompressionType.values()[req.compressors.get(i)],
- req.propsList == null ? null : req.propsList.get(i),
- req.tagsList == null ? null : req.tagsList.get(i),
- req.attributesList == null ? null : req.attributesList.get(i),
- req.measurementAliasList == null ? null :
req.measurementAliasList.get(i));
-
- TSStatus status = checkPathValidity(req.paths.get(i));
- if (status != null) {
- // path naming is not valid
- statusList.add(status);
- continue;
+ try {
+ if (!checkLogin(req.getSessionId())) {
+ logger.info(INFO_NOT_LOGIN, IoTDBConstant.GLOBAL_DB_NAME);
+ return RpcUtils.getStatus(TSStatusCode.NOT_LOGIN_ERROR);
}
+ auditLogger.debug("Session-{} create {} timeseries, the first is {}",
currSessionId.get(),
+ req.getPaths().size(), req.getPaths().get(0));
+ List<TSStatus> statusList = new ArrayList<>(req.paths.size());
+ for (int i = 0; i < req.paths.size(); i++) {
+ CreateTimeSeriesPlan plan = new CreateTimeSeriesPlan(new
PartialPath(req.getPaths().get(i)),
+ TSDataType.values()[req.dataTypes.get(i)],
TSEncoding.values()[req.encodings.get(i)],
+ CompressionType.values()[req.compressors.get(i)],
+ req.propsList == null ? null : req.propsList.get(i),
+ req.tagsList == null ? null : req.tagsList.get(i),
+ req.attributesList == null ? null : req.attributesList.get(i),
+ req.measurementAliasList == null ? null :
req.measurementAliasList.get(i));
+
+ TSStatus status = checkPathValidity(req.paths.get(i));
+ if (status != null) {
+ // path naming is not valid
+ statusList.add(status);
+ continue;
+ }
- status = checkAuthority(plan, req.getSessionId());
- if (status != null) {
- // not authorized
- statusList.add(status);
- continue;
- }
+ status = checkAuthority(plan, req.getSessionId());
+ if (status != null) {
+ // not authorized
+ statusList.add(status);
+ continue;
+ }
- statusList.add(executeNonQueryPlan(plan));
- }
+ statusList.add(executeNonQueryPlan(plan));
+ }
- boolean isAllSuccessful = true;
- for (TSStatus tsStatus : statusList) {
- if (tsStatus.code != TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
- isAllSuccessful = false;
- break;
+ boolean isAllSuccessful = true;
+ for (TSStatus tsStatus : statusList) {
+ if (tsStatus.code != TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
+ isAllSuccessful = false;
+ break;
+ }
}
- }
- if (isAllSuccessful) {
- if (logger.isDebugEnabled()) {
- logger.debug("Create multiple timeseries successfully");
+ if (isAllSuccessful) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Create multiple timeseries successfully");
+ }
+ return RpcUtils.getStatus(TSStatusCode.SUCCESS_STATUS);
+ } else {
+ logger.debug("Create multiple timeseries failed!");
+ return RpcUtils.getStatus(statusList);
}
- return RpcUtils.getStatus(TSStatusCode.SUCCESS_STATUS);
- } else {
- logger.debug("Create multiple timeseries failed!");
- return RpcUtils.getStatus(statusList);
+ } catch (Exception e) {
+ logger.error("meet error when create multi timeseries", e);
}
+ return RpcUtils.getStatus(TSStatusCode.EXECUTE_STATEMENT_ERROR);
}
@Override
public TSStatus deleteTimeseries(long sessionId, List<String> paths) {
- if (!checkLogin(sessionId)) {
- logger.info(INFO_NOT_LOGIN, IoTDBConstant.GLOBAL_DB_NAME);
- return RpcUtils.getStatus(TSStatusCode.NOT_LOGIN_ERROR);
- }
- List<Path> pathList = new ArrayList<>();
- for (String path : paths) {
- pathList.add(new Path(path));
- }
- DeleteTimeSeriesPlan plan = new DeleteTimeSeriesPlan(pathList);
- TSStatus status = checkAuthority(plan, sessionId);
- if (status != null) {
- return status;
+ try {
+ if (!checkLogin(sessionId)) {
+ logger.info(INFO_NOT_LOGIN, IoTDBConstant.GLOBAL_DB_NAME);
+ return RpcUtils.getStatus(TSStatusCode.NOT_LOGIN_ERROR);
+ }
+ List<PartialPath> pathList = new ArrayList<>();
+ for (String path : paths) {
+ pathList.add(new PartialPath(path));
+ }
+ DeleteTimeSeriesPlan plan = new DeleteTimeSeriesPlan(pathList);
+ TSStatus status = checkAuthority(plan, sessionId);
+ if (status != null) {
+ return status;
+ }
+ return executeNonQueryPlan(plan);
+ } catch (Exception e) {
+ logger.error("meet error when delete timeseries", e);
}
- return executeNonQueryPlan(plan);
+ return RpcUtils.getStatus(TSStatusCode.EXECUTE_STATEMENT_ERROR);
}
@Override
@@ -1523,7 +1556,7 @@ public class TSServiceImpl implements TSIService.Iface,
ServerContext {
}
private TSStatus checkAuthority(PhysicalPlan plan, long sessionId) {
- List<Path> paths = plan.getPaths();
+ List<PartialPath> paths = plan.getPaths();
try {
if (!checkAuthorization(paths, plan,
sessionIdUsernameMap.get(sessionId))) {
return RpcUtils.getStatus(
@@ -1572,12 +1605,12 @@ public class TSServiceImpl implements TSIService.Iface,
ServerContext {
return QueryResourceManager.getInstance().assignQueryId(isDataQuery);
}
- protected List<TSDataType> getSeriesTypesByPath(List<Path> paths,
List<String> aggregations)
+ protected List<TSDataType> getSeriesTypesByPath(List<PartialPath> paths,
List<String> aggregations)
throws MetadataException {
return SchemaUtils.getSeriesTypesByPath(paths, aggregations);
}
- protected List<TSDataType> getSeriesTypesByString(List<String> paths, String
aggregation)
+ protected List<TSDataType> getSeriesTypesByString(List<PartialPath> paths,
String aggregation)
throws MetadataException {
return SchemaUtils.getSeriesTypesByString(paths, aggregation);
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/sync/receiver/load/FileLoader.java
b/server/src/main/java/org/apache/iotdb/db/sync/receiver/load/FileLoader.java
index 29d3922..48b3811 100644
---
a/server/src/main/java/org/apache/iotdb/db/sync/receiver/load/FileLoader.java
+++
b/server/src/main/java/org/apache/iotdb/db/sync/receiver/load/FileLoader.java
@@ -114,7 +114,11 @@ public class FileLoader implements IFileLoader {
public void handleLoadTask(LoadTask task) throws IOException {
switch (task.type) {
case ADD:
- loadNewTsfile(task.file);
+ try {
+ loadNewTsfile(task.file);
+ } catch (IllegalPathException e) {
+ throw new IOException(e.getMessage());
+ }
break;
case DELETE:
loadDeletedFile(task.file);
@@ -124,7 +128,7 @@ public class FileLoader implements IFileLoader {
}
}
- private void loadNewTsfile(File newTsFile) throws IOException {
+ private void loadNewTsfile(File newTsFile) throws IOException,
IllegalPathException {
if (curType != LoadType.ADD) {
loadLog.startLoadTsFiles();
curType = LoadType.ADD;
@@ -156,7 +160,7 @@ public class FileLoader implements IFileLoader {
if (!StorageEngine.getInstance().deleteTsfileForSync(deletedTsFile)) {
LOGGER.info("The file {} to be deleted doesn't exist.",
deletedTsFile.getAbsolutePath());
}
- } catch (StorageEngineException e) {
+ } catch (StorageEngineException | IllegalPathException e) {
LOGGER.error("Can not load deleted tsfile {}",
deletedTsFile.getAbsolutePath(), e);
throw new IOException(e);
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/tools/IoTDBDataDirViewer.java
b/server/src/main/java/org/apache/iotdb/db/tools/IoTDBDataDirViewer.java
index 85ad43b..d32ac4e 100644
--- a/server/src/main/java/org/apache/iotdb/db/tools/IoTDBDataDirViewer.java
+++ b/server/src/main/java/org/apache/iotdb/db/tools/IoTDBDataDirViewer.java
@@ -29,12 +29,13 @@ import java.util.SortedSet;
import java.util.TreeSet;
import org.apache.iotdb.db.engine.fileSystem.SystemFileFactory;
import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
+import org.apache.iotdb.db.exception.metadata.IllegalPathException;
import org.apache.iotdb.db.qp.constant.DatetimeUtils;
import org.apache.iotdb.tsfile.fileSystem.FSFactoryProducer;
public class IoTDBDataDirViewer {
- public static void main(String[] args) throws IOException {
+ public static void main(String[] args) throws IOException,
IllegalPathException {
String[] data_dir;
String outFile = "IoTDB_data_dir_overview.txt";
if (args.length == 0) {
@@ -80,7 +81,7 @@ public class IoTDBDataDirViewer {
}
private static void printFilesInSeqOrUnseqDir(File seqOrUnseqDir,
PrintWriter pw)
- throws IOException {
+ throws IOException, IllegalPathException {
File[] storageGroupDirs = seqOrUnseqDir.listFiles();
if (storageGroupDirs == null) {
throw new IOException(
@@ -96,7 +97,7 @@ public class IoTDBDataDirViewer {
}
private static void printFilesInStorageGroupDir(File storageGroup,
PrintWriter pw)
- throws IOException {
+ throws IOException, IllegalPathException {
File[] files = storageGroup.listFiles();
if (files == null) {
throw new IOException(
@@ -112,7 +113,7 @@ public class IoTDBDataDirViewer {
}
private static void printFilesInTimeInterval(File timeInterval, PrintWriter
pw)
- throws IOException {
+ throws IOException, IllegalPathException {
File[] files = timeInterval.listFiles();
if (files == null) {
throw new IOException(
@@ -131,7 +132,8 @@ public class IoTDBDataDirViewer {
}
}
- private static void printResource(String filename, PrintWriter pw) throws
IOException {
+ private static void printResource(String filename, PrintWriter pw)
+ throws IOException, IllegalPathException {
filename = filename.substring(0, filename.length() - 9);
TsFileResource resource = new
TsFileResource(SystemFileFactory.INSTANCE.getFile(filename));
resource.deserialize();
diff --git
a/server/src/main/java/org/apache/iotdb/db/tools/TsFileResourcePrinter.java
b/server/src/main/java/org/apache/iotdb/db/tools/TsFileResourcePrinter.java
index 427229e..fde0c14 100644
--- a/server/src/main/java/org/apache/iotdb/db/tools/TsFileResourcePrinter.java
+++ b/server/src/main/java/org/apache/iotdb/db/tools/TsFileResourcePrinter.java
@@ -25,6 +25,7 @@ import java.util.Arrays;
import java.util.Comparator;
import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
+import org.apache.iotdb.db.exception.metadata.IllegalPathException;
import org.apache.iotdb.db.qp.constant.DatetimeUtils;
import org.apache.iotdb.db.engine.fileSystem.SystemFileFactory;
import org.apache.iotdb.tsfile.fileSystem.FSFactoryProducer;
@@ -36,7 +37,7 @@ import org.apache.iotdb.tsfile.fileSystem.FSFactoryProducer;
public class TsFileResourcePrinter {
@SuppressWarnings("squid:S106")
- public static void main(String[] args) throws IOException {
+ public static void main(String[] args) throws IOException,
IllegalPathException {
String folder = "test";
if (args.length >= 1) {
@@ -61,7 +62,7 @@ public class TsFileResourcePrinter {
}
@SuppressWarnings("squid:S106")
- public static void printResource(String filename) throws IOException {
+ public static void printResource(String filename) throws IOException,
IllegalPathException {
filename = filename.substring(0, filename.length() - 9);
TsFileResource resource = new
TsFileResource(SystemFileFactory.INSTANCE.getFile(filename));
System.out.println(String.format("Analyzing %s ...", filename));
diff --git
a/server/src/main/java/org/apache/iotdb/db/utils/FileLoaderUtils.java
b/server/src/main/java/org/apache/iotdb/db/utils/FileLoaderUtils.java
index 7f02747..cc51d32 100644
--- a/server/src/main/java/org/apache/iotdb/db/utils/FileLoaderUtils.java
+++ b/server/src/main/java/org/apache/iotdb/db/utils/FileLoaderUtils.java
@@ -25,6 +25,7 @@ import java.util.Set;
import org.apache.iotdb.db.engine.cache.TimeSeriesMetadataCache;
import org.apache.iotdb.db.engine.modification.Modification;
import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
+import org.apache.iotdb.db.exception.metadata.IllegalPathException;
import org.apache.iotdb.db.query.context.QueryContext;
import org.apache.iotdb.db.query.control.FileReaderManager;
import org.apache.iotdb.db.query.reader.chunk.MemChunkLoader;
@@ -49,7 +50,8 @@ public class FileLoaderUtils {
}
- public static void checkTsFileResource(TsFileResource tsFileResource) throws
IOException {
+ public static void checkTsFileResource(TsFileResource tsFileResource)
+ throws IOException, IllegalPathException {
if (!tsFileResource.resourceFileExists()) {
// .resource file does not exist, read file metadata and recover tsfile
resource
try (TsFileSequenceReader reader = new TsFileSequenceReader(
diff --git a/server/src/main/java/org/apache/iotdb/db/utils/FilePathUtils.java
b/server/src/main/java/org/apache/iotdb/db/utils/FilePathUtils.java
index f3fa0b5..f284f8f 100644
--- a/server/src/main/java/org/apache/iotdb/db/utils/FilePathUtils.java
+++ b/server/src/main/java/org/apache/iotdb/db/utils/FilePathUtils.java
@@ -25,6 +25,7 @@ import java.util.TreeMap;
import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
import org.apache.iotdb.db.metadata.MetaUtils;
+import org.apache.iotdb.db.metadata.PartialPath;
import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
import org.apache.iotdb.tsfile.read.common.Field;
import org.apache.iotdb.tsfile.read.common.Path;
@@ -63,17 +64,17 @@ public class FilePathUtils {
* @param pathIndex
* @return
*/
- public static Map<String, Long> getPathByLevel(List<Path> rawPaths, int
level, Map<Integer, String> pathIndex) {
+ public static Map<String, Long> getPathByLevel(List<PartialPath> rawPaths,
int level, Map<Integer, String> pathIndex) {
// pathGroupByLevel -> count
Map<String, Long> finalPaths = new TreeMap<>();
int i = 0;
- for (Path value : rawPaths) {
- String[] tmpPath = MetaUtils.getNodeNames(value.getFullPath());
+ for (PartialPath value : rawPaths) {
+ String[] tmpPath = value.getNodes();
String key;
if (tmpPath.length <= level) {
- key = value.getFullPath();
+ key = value.toString();
} else {
StringBuilder path = new StringBuilder();
for (int k = 0; k <= level; k++) {
diff --git a/server/src/main/java/org/apache/iotdb/db/utils/UpgradeUtils.java
b/server/src/main/java/org/apache/iotdb/db/utils/UpgradeUtils.java
index 994f20e..3656b85 100644
--- a/server/src/main/java/org/apache/iotdb/db/utils/UpgradeUtils.java
+++ b/server/src/main/java/org/apache/iotdb/db/utils/UpgradeUtils.java
@@ -30,6 +30,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
import org.apache.iotdb.db.engine.upgrade.UpgradeCheckStatus;
import org.apache.iotdb.db.engine.upgrade.UpgradeLog;
+import org.apache.iotdb.db.exception.metadata.IllegalPathException;
import org.apache.iotdb.tsfile.common.conf.TSFileConfig;
import org.apache.iotdb.tsfile.fileSystem.FSFactoryProducer;
import org.apache.iotdb.tsfile.read.TsFileSequenceReader;
@@ -80,12 +81,12 @@ public class UpgradeUtils {
* Since one old TsFile may be upgraded to multiple upgraded files,
* this method is for getting the name of one of the upgraded file.
*
- * @param old TsFile resource to be upgraded
+ * @param upgradeResource TsFile resource to be upgraded
* @return name of upgraded file
*
*/
public static String getOneUpgradedFileName(TsFileResource upgradeResource)
- throws IOException {
+ throws IOException, IllegalPathException {
upgradeResource.deserialize();
long firstPartitionId = upgradeResource.getTimePartition();
File oldTsFile = upgradeResource.getTsFile();
@@ -158,7 +159,7 @@ public class UpgradeUtils {
}
}
}
- } catch (IOException e) {
+ } catch (IOException | IllegalPathException e) {
logger.error("meet error when recover upgrade process, file path:{}",
UpgradeLog.getUpgradeLogPath(), e);
} finally {
diff --git
a/server/src/main/java/org/apache/iotdb/db/writelog/recover/LogReplayer.java
b/server/src/main/java/org/apache/iotdb/db/writelog/recover/LogReplayer.java
index a3c0e2b..8310423 100644
--- a/server/src/main/java/org/apache/iotdb/db/writelog/recover/LogReplayer.java
+++ b/server/src/main/java/org/apache/iotdb/db/writelog/recover/LogReplayer.java
@@ -19,6 +19,10 @@
package org.apache.iotdb.db.writelog.recover;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import org.apache.iotdb.db.engine.memtable.IMemTable;
import org.apache.iotdb.db.engine.modification.Deletion;
import org.apache.iotdb.db.engine.modification.ModificationFile;
@@ -27,6 +31,7 @@ import org.apache.iotdb.db.engine.version.VersionController;
import org.apache.iotdb.db.exception.WriteProcessException;
import org.apache.iotdb.db.exception.metadata.MetadataException;
import org.apache.iotdb.db.exception.query.QueryProcessException;
+import org.apache.iotdb.db.metadata.PartialPath;
import org.apache.iotdb.db.qp.physical.PhysicalPlan;
import org.apache.iotdb.db.qp.physical.crud.DeletePlan;
import org.apache.iotdb.db.qp.physical.crud.InsertPlan;
@@ -38,16 +43,10 @@ import org.apache.iotdb.db.writelog.io.ILogReader;
import org.apache.iotdb.db.writelog.manager.MultiFileLogNodeManager;
import org.apache.iotdb.db.writelog.node.WriteLogNode;
import org.apache.iotdb.tsfile.fileSystem.FSFactoryProducer;
-import org.apache.iotdb.tsfile.read.common.Path;
import org.apache.iotdb.tsfile.write.schema.MeasurementSchema;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
/**
* LogReplayer finds the logNode of the TsFile given by insertFilePath and
logNodePrefix, reads the
* WALs from the logNode and redoes them into a given MemTable and
ModificationFile.
@@ -119,10 +118,10 @@ public class LogReplayer {
}
private void replayDelete(DeletePlan deletePlan) throws IOException {
- List<Path> paths = deletePlan.getPaths();
- for (Path path : paths) {
+ List<PartialPath> paths = deletePlan.getPaths();
+ for (PartialPath path : paths) {
recoverMemTable
- .delete(path.getDevice(), path.getMeasurement(),
deletePlan.getDeleteStartTime(),
+ .delete(path.getPathWithoutLastNode(), path.getLastNode(),
deletePlan.getDeleteStartTime(),
deletePlan.getDeleteEndTime());
modFile
.write(
@@ -142,18 +141,18 @@ public class LogReplayer {
maxTime = ((InsertTabletPlan) plan).getMaxTime();
}
// the last chunk group may contain the same data with the logs, ignore
such logs in seq file
- long lastEndTime = currentTsFileResource.getEndTime(plan.getDeviceId());
+ long lastEndTime =
currentTsFileResource.getEndTime(plan.getDeviceId().toString());
if (lastEndTime != Long.MIN_VALUE && lastEndTime >= minTime &&
sequence) {
return;
}
Long startTime = tempStartTimeMap.get(plan.getDeviceId());
if (startTime == null || startTime > minTime) {
- tempStartTimeMap.put(plan.getDeviceId(), minTime);
+ tempStartTimeMap.put(plan.getDeviceId().toString(), minTime);
}
Long endTime = tempEndTimeMap.get(plan.getDeviceId());
if (endTime == null || endTime < maxTime) {
- tempEndTimeMap.put(plan.getDeviceId(), maxTime);
+ tempEndTimeMap.put(plan.getDeviceId().toString(), maxTime);
}
}
MeasurementSchema[] schemas;
diff --git
a/server/src/main/java/org/apache/iotdb/db/writelog/recover/TsFileRecoverPerformer.java
b/server/src/main/java/org/apache/iotdb/db/writelog/recover/TsFileRecoverPerformer.java
index 35e3e7e..274e1d1 100644
---
a/server/src/main/java/org/apache/iotdb/db/writelog/recover/TsFileRecoverPerformer.java
+++
b/server/src/main/java/org/apache/iotdb/db/writelog/recover/TsFileRecoverPerformer.java
@@ -41,6 +41,7 @@ import org.apache.iotdb.db.engine.memtable.PrimitiveMemTable;
import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
import org.apache.iotdb.db.engine.version.VersionController;
import org.apache.iotdb.db.exception.StorageGroupProcessorException;
+import org.apache.iotdb.db.exception.metadata.IllegalPathException;
import org.apache.iotdb.db.utils.FileLoaderUtils;
import org.apache.iotdb.db.writelog.manager.MultiFileLogNodeManager;
import org.apache.iotdb.tsfile.exception.NotCompatibleTsFileException;
@@ -256,7 +257,7 @@ public class TsFileRecoverPerformer {
private void recoverResourceFromFile(TsFileResource tsFileResource) throws
IOException {
try {
tsFileResource.deserialize();
- } catch (IOException e) {
+ } catch (IOException | IllegalPathException e) {
logger.warn("Cannot deserialize TsFileResource {}, construct it using "
+ "TsFileSequenceReader", tsFileResource.getTsFile(), e);
recoverResourceFromReader(tsFileResource);
diff --git
a/server/src/test/java/org/apache/iotdb/db/engine/cache/ChunkMetadataCacheTest.java
b/server/src/test/java/org/apache/iotdb/db/engine/cache/ChunkMetadataCacheTest.java
index a4b5825..0cef837 100644
---
a/server/src/test/java/org/apache/iotdb/db/engine/cache/ChunkMetadataCacheTest.java
+++
b/server/src/test/java/org/apache/iotdb/db/engine/cache/ChunkMetadataCacheTest.java
@@ -31,7 +31,9 @@ import
org.apache.iotdb.db.engine.storagegroup.StorageGroupProcessor;
import org.apache.iotdb.db.engine.storagegroup.TsFileProcessor;
import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
import org.apache.iotdb.db.exception.WriteProcessException;
+import org.apache.iotdb.db.exception.metadata.IllegalPathException;
import org.apache.iotdb.db.exception.query.QueryProcessException;
+import org.apache.iotdb.db.metadata.PartialPath;
import org.apache.iotdb.db.metadata.mnode.MNode;
import org.apache.iotdb.db.metadata.mnode.MeasurementMNode;
import org.apache.iotdb.db.qp.physical.crud.InsertPlan;
@@ -81,7 +83,8 @@ public class ChunkMetadataCacheTest {
EnvironmentUtils.cleanDir(systemDir);
}
- private void insertOneRecord(long time, int num) throws
WriteProcessException {
+ private void insertOneRecord(long time, int num)
+ throws WriteProcessException, IllegalPathException {
TSRecord record = new TSRecord(time, storageGroup);
record.addTuple(DataPoint.getDataPoint(TSDataType.INT32, measurementId0,
String.valueOf(num)));
record.addTuple(DataPoint.getDataPoint(TSDataType.INT64, measurementId1,
String.valueOf(num)));
@@ -99,7 +102,7 @@ public class ChunkMetadataCacheTest {
storageGroupProcessor.insert(insertRowPlan);
}
- protected void insertData() throws IOException, WriteProcessException {
+ protected void insertData() throws IOException, WriteProcessException,
IllegalPathException {
for (int j = 1; j <= 100; j++) {
insertOneRecord(j, j);
}
@@ -129,10 +132,10 @@ public class ChunkMetadataCacheTest {
}
@Test
- public void test1() throws IOException, QueryProcessException {
+ public void test1() throws IOException, QueryProcessException,
IllegalPathException {
IoTDBDescriptor.getInstance().getConfig().setMetaDataCacheEnable(false);
QueryDataSource queryDataSource = storageGroupProcessor
- .query(storageGroup, measurementId5, context, null, null);
+ .query(new PartialPath(storageGroup), measurementId5, context, null,
null);
List<TsFileResource> seqResources = queryDataSource.getSeqResources();
List<TsFileResource> unseqResources = queryDataSource.getUnseqResources();
@@ -150,10 +153,10 @@ public class ChunkMetadataCacheTest {
}
@Test
- public void test2() throws IOException, QueryProcessException {
+ public void test2() throws IOException, QueryProcessException,
IllegalPathException {
IoTDBDescriptor.getInstance().getConfig().setMetaDataCacheEnable(true);
QueryDataSource queryDataSource = storageGroupProcessor
- .query(storageGroup, measurementId5, context, null, null);
+ .query(new PartialPath(storageGroup), measurementId5, context, null,
null);
List<TsFileResource> seqResources = queryDataSource.getSeqResources();
List<TsFileResource> unseqResources = queryDataSource.getUnseqResources();
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 6a17faa..f8ab652 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
@@ -33,6 +33,8 @@ import java.util.List;
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.metadata.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;
@@ -206,15 +208,16 @@ public class IoTDBEngineTimeGeneratorIT {
* root.vehicle.d1.s0 >= 5, and d1.s0 has no data
*/
@Test
- public void testEmptySeriesWithValueFilter() throws IOException,
StorageEngineException {
+ public void testEmptySeriesWithValueFilter()
+ throws IOException, StorageEngineException, IllegalPathException {
//System.out.println("Test >>> root.vehicle.d1.s0 >= 5");
- Path pd1s0 = new Path(TestConstant.d1s0);
+ PartialPath pd1s0 = new PartialPath(TestConstant.d1s0);
ValueFilter.ValueGtEq valueGtEq = ValueFilter.gtEq(5);
- IExpression singleSeriesExpression = new SingleSeriesExpression(pd1s0,
valueGtEq);
+ IExpression singleSeriesExpression = new
SingleSeriesExpression(pd1s0.toTSFilePath(), valueGtEq);
RawDataQueryPlan queryPlan = new RawDataQueryPlan();
- List<Path> paths = new ArrayList<>();
+ List<PartialPath> paths = new ArrayList<>();
paths.add(pd1s0);
queryPlan.setDeduplicatedPaths(paths);
@@ -233,26 +236,26 @@ public class IoTDBEngineTimeGeneratorIT {
*/
@Test
public void testMultiSeriesWithValueFilterAndTimeFilter()
- throws IOException, StorageEngineException {
+ throws IOException, StorageEngineException, IllegalPathException {
System.out
.println("Test >>> root.vehicle.d0.s0 >= 5 && root.vehicle.d0.s2 >=
11.5 || time > 900");
- Path pd0s0 = new Path(TestConstant.d0s0);
- Path pd0s2 = new Path(TestConstant.d0s2);
+ PartialPath pd0s0 = new PartialPath(TestConstant.d0s0);
+ PartialPath pd0s2 = new PartialPath(TestConstant.d0s2);
ValueFilter.ValueGtEq valueGtEq5 = ValueFilter.gtEq(5);
ValueFilter.ValueGtEq valueGtEq11 = ValueFilter.gtEq(11.5f);
TimeFilter.TimeGt timeGt = TimeFilter.gt(900L);
- IExpression singleSeriesExpression1 = new SingleSeriesExpression(pd0s0,
+ IExpression singleSeriesExpression1 = new
SingleSeriesExpression(pd0s0.toTSFilePath(),
FilterFactory.or(valueGtEq5, timeGt));
- IExpression singleSeriesExpression2 = new SingleSeriesExpression(pd0s2,
+ IExpression singleSeriesExpression2 = new
SingleSeriesExpression(pd0s2.toTSFilePath(),
FilterFactory.or(valueGtEq11, timeGt));
IExpression andExpression = BinaryExpression
.and(singleSeriesExpression1, singleSeriesExpression2);
RawDataQueryPlan queryPlan = new RawDataQueryPlan();
- List<Path> paths = new ArrayList<>();
+ List<PartialPath> paths = new ArrayList<>();
paths.add(pd0s0);
paths.add(pd0s2);
queryPlan.setDeduplicatedPaths(paths);
diff --git
a/server/src/test/java/org/apache/iotdb/db/metadata/MManagerAdvancedTest.java
b/server/src/test/java/org/apache/iotdb/db/metadata/MManagerAdvancedTest.java
index 93fc3d0..6bd22df 100644
---
a/server/src/test/java/org/apache/iotdb/db/metadata/MManagerAdvancedTest.java
+++
b/server/src/test/java/org/apache/iotdb/db/metadata/MManagerAdvancedTest.java
@@ -48,34 +48,34 @@ public class MManagerAdvancedTest {
EnvironmentUtils.envSetUp();
mmanager = IoTDB.metaManager;
- mmanager.setStorageGroup("root.vehicle.d0");
- mmanager.setStorageGroup("root.vehicle.d1");
- mmanager.setStorageGroup("root.vehicle.d2");
+ mmanager.setStorageGroup(new PartialPath("root.vehicle.d0"));
+ mmanager.setStorageGroup(new PartialPath("root.vehicle.d1"));
+ mmanager.setStorageGroup(new PartialPath("root.vehicle.d2"));
- mmanager.createTimeseries("root.vehicle.d0.s0", TSDataType.INT32,
TSEncoding.RLE,
+ mmanager.createTimeseries(new PartialPath("root.vehicle.d0.s0"),
TSDataType.INT32, TSEncoding.RLE,
TSFileDescriptor.getInstance().getConfig().getCompressor(),
Collections.emptyMap());
- mmanager.createTimeseries("root.vehicle.d0.s1", TSDataType.INT64,
TSEncoding.RLE,
+ mmanager.createTimeseries(new PartialPath("root.vehicle.d0.s1"),
TSDataType.INT64, TSEncoding.RLE,
TSFileDescriptor.getInstance().getConfig().getCompressor(),
Collections.emptyMap());
- mmanager.createTimeseries("root.vehicle.d0.s2", TSDataType.FLOAT,
TSEncoding.RLE,
+ mmanager.createTimeseries(new PartialPath("root.vehicle.d0.s2"),
TSDataType.FLOAT, TSEncoding.RLE,
TSFileDescriptor.getInstance().getConfig().getCompressor(),
Collections.emptyMap());
- mmanager.createTimeseries("root.vehicle.d0.s3", TSDataType.DOUBLE,
TSEncoding.RLE,
+ mmanager.createTimeseries(new PartialPath("root.vehicle.d0.s3"),
TSDataType.DOUBLE, TSEncoding.RLE,
TSFileDescriptor.getInstance().getConfig().getCompressor(),
Collections.emptyMap());
- mmanager.createTimeseries("root.vehicle.d0.s4", TSDataType.BOOLEAN,
TSEncoding.PLAIN,
+ mmanager.createTimeseries(new PartialPath("root.vehicle.d0.s4"),
TSDataType.BOOLEAN, TSEncoding.PLAIN,
TSFileDescriptor.getInstance().getConfig().getCompressor(),
Collections.emptyMap());
- mmanager.createTimeseries("root.vehicle.d0.s5", TSDataType.TEXT,
TSEncoding.PLAIN,
+ mmanager.createTimeseries(new PartialPath("root.vehicle.d0.s5"),
TSDataType.TEXT, TSEncoding.PLAIN,
TSFileDescriptor.getInstance().getConfig().getCompressor(),
Collections.emptyMap());
- mmanager.createTimeseries("root.vehicle.d1.s0", TSDataType.INT32,
TSEncoding.RLE,
+ mmanager.createTimeseries(new PartialPath("root.vehicle.d1.s0"),
TSDataType.INT32, TSEncoding.RLE,
TSFileDescriptor.getInstance().getConfig().getCompressor(),
Collections.emptyMap());
- mmanager.createTimeseries("root.vehicle.d1.s1", TSDataType.INT64,
TSEncoding.RLE,
+ mmanager.createTimeseries(new PartialPath("root.vehicle.d1.s1"),
TSDataType.INT64, TSEncoding.RLE,
TSFileDescriptor.getInstance().getConfig().getCompressor(),
Collections.emptyMap());
- mmanager.createTimeseries("root.vehicle.d1.s2", TSDataType.FLOAT,
TSEncoding.RLE,
+ mmanager.createTimeseries(new PartialPath("root.vehicle.d1.s2"),
TSDataType.FLOAT, TSEncoding.RLE,
TSFileDescriptor.getInstance().getConfig().getCompressor(),
Collections.emptyMap());
- mmanager.createTimeseries("root.vehicle.d1.s3", TSDataType.DOUBLE,
TSEncoding.RLE,
+ mmanager.createTimeseries(new PartialPath("root.vehicle.d1.s3"),
TSDataType.DOUBLE, TSEncoding.RLE,
TSFileDescriptor.getInstance().getConfig().getCompressor(),
Collections.emptyMap());
- mmanager.createTimeseries("root.vehicle.d1.s4", TSDataType.BOOLEAN,
TSEncoding.PLAIN,
+ mmanager.createTimeseries(new PartialPath("root.vehicle.d1.s4"),
TSDataType.BOOLEAN, TSEncoding.PLAIN,
TSFileDescriptor.getInstance().getConfig().getCompressor(),
Collections.emptyMap());
- mmanager.createTimeseries("root.vehicle.d1.s5", TSDataType.TEXT,
TSEncoding.PLAIN,
+ mmanager.createTimeseries(new PartialPath("root.vehicle.d1.s5"),
TSDataType.TEXT, TSEncoding.PLAIN,
TSFileDescriptor.getInstance().getConfig().getCompressor(),
Collections.emptyMap());
}
@@ -90,26 +90,26 @@ public class MManagerAdvancedTest {
try {
// test file name
- List<String> fileNames = mmanager.getAllStorageGroupNames();
+ List<PartialPath> fileNames = mmanager.getAllStorageGroupNames();
assertEquals(3, fileNames.size());
- if (fileNames.get(0).equals("root.vehicle.d0")) {
- assertEquals("root.vehicle.d1", fileNames.get(1));
+ if (fileNames.get(0).equals(new PartialPath("root.vehicle.d0"))) {
+ assertEquals(new PartialPath("root.vehicle.d1"), fileNames.get(1));
} else {
- assertEquals("root.vehicle.d0", fileNames.get(1));
+ assertEquals(new PartialPath("root.vehicle.d0"), fileNames.get(1));
}
// test filename by seriesPath
- assertEquals("root.vehicle.d0",
mmanager.getStorageGroupName("root.vehicle.d0.s1"));
- List<String> pathList =
mmanager.getAllTimeseriesName("root.vehicle.d1.*");
+ assertEquals(new PartialPath("root.vehicle.d0"),
mmanager.getStorageGroupName(new PartialPath("root.vehicle.d0.s1")));
+ List<PartialPath> pathList = mmanager.getAllTimeseriesName(new
PartialPath("root.vehicle.d1.*"));
assertEquals(6, pathList.size());
- pathList = mmanager.getAllTimeseriesName("root.vehicle.d0");
+ pathList = mmanager.getAllTimeseriesName(new
PartialPath("root.vehicle.d0"));
assertEquals(6, pathList.size());
- pathList = mmanager.getAllTimeseriesName("root.vehicle.d*");
+ pathList = mmanager.getAllTimeseriesName(new
PartialPath("root.vehicle.d*"));
assertEquals(12, pathList.size());
- pathList = mmanager.getAllTimeseriesName("root.ve*.*");
+ pathList = mmanager.getAllTimeseriesName(new PartialPath("root.ve*.*"));
assertEquals(12, pathList.size());
- pathList = mmanager.getAllTimeseriesName("root.vehicle*.d*.s1");
+ pathList = mmanager.getAllTimeseriesName(new
PartialPath("root.vehicle*.d*.s1"));
assertEquals(2, pathList.size());
- pathList = mmanager.getAllTimeseriesName("root.vehicle.d2");
+ pathList = mmanager.getAllTimeseriesName(new
PartialPath("root.vehicle.d2"));
assertEquals(0, pathList.size());
} catch (MetadataException e) {
e.printStackTrace();
@@ -119,20 +119,20 @@ public class MManagerAdvancedTest {
@Test
public void testCache() throws MetadataException {
- mmanager.createTimeseries("root.vehicle.d2.s0", TSDataType.DOUBLE,
TSEncoding.RLE,
+ mmanager.createTimeseries(new PartialPath("root.vehicle.d2.s0"),
TSDataType.DOUBLE, TSEncoding.RLE,
TSFileDescriptor.getInstance().getConfig().getCompressor(),
Collections.emptyMap());
- mmanager.createTimeseries("root.vehicle.d2.s1", TSDataType.BOOLEAN,
TSEncoding.PLAIN,
+ mmanager.createTimeseries(new PartialPath("root.vehicle.d2.s1"),
TSDataType.BOOLEAN, TSEncoding.PLAIN,
TSFileDescriptor.getInstance().getConfig().getCompressor(),
Collections.emptyMap());
- mmanager.createTimeseries("root.vehicle.d2.s2.g0", TSDataType.TEXT,
TSEncoding.PLAIN,
+ mmanager.createTimeseries(new PartialPath("root.vehicle.d2.s2.g0"),
TSDataType.TEXT, TSEncoding.PLAIN,
TSFileDescriptor.getInstance().getConfig().getCompressor(),
Collections.emptyMap());
- mmanager.createTimeseries("root.vehicle.d2.s3", TSDataType.TEXT,
TSEncoding.PLAIN,
+ mmanager.createTimeseries(new PartialPath("root.vehicle.d2.s3"),
TSDataType.TEXT, TSEncoding.PLAIN,
TSFileDescriptor.getInstance().getConfig().getCompressor(),
Collections.emptyMap());
- MNode node = mmanager.getNodeByPath("root.vehicle.d0");
+ MNode node = mmanager.getNodeByPath(new PartialPath("root.vehicle.d0"));
Assert.assertEquals(TSDataType.INT32, ((MeasurementMNode)
node.getChild("s0")).getSchema().getType());
try {
- mmanager.getNodeByPath("root.vehicle.d100");
+ mmanager.getNodeByPath(new PartialPath("root.vehicle.d100"));
fail();
} catch (MetadataException e) {
// ignore
@@ -141,13 +141,13 @@ public class MManagerAdvancedTest {
@Test
public void testCachedLastTimeValue() throws MetadataException {
- mmanager.createTimeseries("root.vehicle.d2.s0", TSDataType.DOUBLE,
TSEncoding.RLE,
+ mmanager.createTimeseries(new PartialPath("root.vehicle.d2.s0"),
TSDataType.DOUBLE, TSEncoding.RLE,
TSFileDescriptor.getInstance().getConfig().getCompressor(),
Collections.emptyMap());
TimeValuePair tv1 = new TimeValuePair(1000,
TsPrimitiveType.getByType(TSDataType.DOUBLE, 1.0));
TimeValuePair tv2 = new TimeValuePair(2000,
TsPrimitiveType.getByType(TSDataType.DOUBLE, 3.0));
TimeValuePair tv3 = new TimeValuePair(1500,
TsPrimitiveType.getByType(TSDataType.DOUBLE, 2.5));
- MNode node = mmanager.getNodeByPath("root.vehicle.d2.s0");
+ MNode node = mmanager.getNodeByPath(new PartialPath("root.vehicle.d2.s0"));
((MeasurementMNode)node).updateCachedLast(tv1, true, Long.MIN_VALUE);
((MeasurementMNode)node).updateCachedLast(tv2, true, Long.MIN_VALUE);
Assert.assertEquals(tv2.getTimestamp(),
((MeasurementMNode)node).getCachedLast().getTimestamp());
diff --git
a/server/src/test/java/org/apache/iotdb/db/writelog/WriteLogNodeTest.java
b/server/src/test/java/org/apache/iotdb/db/writelog/WriteLogNodeTest.java
index 590a116..5a202da 100644
--- a/server/src/test/java/org/apache/iotdb/db/writelog/WriteLogNodeTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/writelog/WriteLogNodeTest.java
@@ -28,6 +28,8 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.iotdb.db.conf.IoTDBConfig;
import org.apache.iotdb.db.conf.IoTDBDescriptor;
+import org.apache.iotdb.db.exception.metadata.IllegalPathException;
+import org.apache.iotdb.db.metadata.PartialPath;
import org.apache.iotdb.db.qp.physical.crud.DeletePlan;
import org.apache.iotdb.db.qp.physical.crud.InsertRowPlan;
import org.apache.iotdb.db.qp.physical.crud.InsertTabletPlan;
@@ -62,18 +64,18 @@ public class WriteLogNodeTest {
}
@Test
- public void testWriteLogAndSync() throws IOException {
+ public void testWriteLogAndSync() throws IOException, IllegalPathException {
// this test uses a dummy insert log node to insert a few logs and flushes
them
// then reads the logs from file
String identifier = "root.logTestDevice";
WriteLogNode logNode = new ExclusiveWriteLogNode(identifier);
- InsertRowPlan bwInsertPlan = new InsertRowPlan(identifier, 100,
+ InsertRowPlan bwInsertPlan = new InsertRowPlan(new
PartialPath(identifier), 100,
new String[]{"s1", "s2", "s3", "s4"},
new TSDataType[]{TSDataType.DOUBLE, TSDataType.INT64, TSDataType.TEXT,
TSDataType.BOOLEAN},
new String[]{"1.0", "15", "str", "false"});
- DeletePlan deletePlan = new DeletePlan(Long.MIN_VALUE, 50, new
Path(identifier + ".s1"));
+ DeletePlan deletePlan = new DeletePlan(Long.MIN_VALUE, 50, new
PartialPath(identifier + ".s1"));
long[] times = new long[]{110L, 111L, 112L, 113L};
List<Integer> dataTypes = new ArrayList<>();
@@ -125,18 +127,18 @@ public class WriteLogNodeTest {
}
@Test
- public void testNotifyFlush() throws IOException {
+ public void testNotifyFlush() throws IOException, IllegalPathException {
// this test writes a few logs and sync them
// then calls notifyStartFlush() and notifyEndFlush() to delete old file
String identifier = "root.logTestDevice";
WriteLogNode logNode = new ExclusiveWriteLogNode(identifier);
- InsertRowPlan bwInsertPlan = new InsertRowPlan(identifier, 100,
+ InsertRowPlan bwInsertPlan = new InsertRowPlan(new
PartialPath(identifier), 100,
new String[]{"s1", "s2", "s3", "s4"},
new TSDataType[]{TSDataType.DOUBLE, TSDataType.INT64, TSDataType.TEXT,
TSDataType.BOOLEAN},
new String[]{"1.0", "15", "str", "false"});
- DeletePlan deletePlan = new DeletePlan(Long.MIN_VALUE, 50, new
Path(identifier + ".s1"));
+ DeletePlan deletePlan = new DeletePlan(Long.MIN_VALUE, 50, new
PartialPath(identifier + ".s1"));
logNode.write(bwInsertPlan);
logNode.notifyStartFlush();