Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IOTDB-3184] Feature/delete timeseries #5911

Closed
wants to merge 4 commits into from
Closed

[IOTDB-3184] Feature/delete timeseries #5911

wants to merge 4 commits into from

Conversation

cmlmakahts
Copy link
Contributor

@cmlmakahts cmlmakahts commented May 15, 2022

Prepare statement

set storage group to root.sg;
create timeseries root.sg.d.s1 with datatype=INT32,encoding=RLE,compression=snappy;
create timeseries root.sg.d.s2 with datatype=INT32,encoding=RLE,compression=snappy;
create timeseries root.sg.d.s3 with datatype=INT32,encoding=RLE,compression=snappy;
insert into root.sg.d(time,s1,s2,s3) values(1,1,2,3);
insert into root.sg.d(time,s1,s2,s3) values(2,1,2,3);
set storage group to root.sg1;
create timeseries root.sg1.d.s1 with datatype=INT32,encoding=RLE,compression=snappy;
create timeseries root.sg1.d.s2 with datatype=INT32,encoding=RLE,compression=snappy;
create timeseries root.sg1.d.s3 with datatype=INT32,encoding=RLE,compression=snappy;
insert into root.sg1.d(time,s1,s2,s3) values(1,1,2,3);
insert into root.sg1.d(time,s1,s2,s3) values(2,1,2,3);
set storage group to root.sg2;
create timeseries root.sg2.d.s1 with datatype=INT32,encoding=RLE,compression=snappy;
create timeseries root.sg2.d.s2 with datatype=INT32,encoding=RLE,compression=snappy;
create timeseries root.sg2.d.s3 with datatype=INT32,encoding=RLE,compression=snappy;
insert into root.sg2.d(time,s1,s2,s3) values(1,1,2,3);
insert into root.sg2.d(time,s1,s2,s3) values(2,1,2,3);

test1: delete single timeseries

image

test2: delete with "*"

Comment on lines +93 to +113
public List<WritePlanNode> splitByPartition(Analysis analysis) {
for (PartialPath deletedPath : deletedPaths) {
String device = deletedPath.getDevice();
TRegionReplicaSet schemaRegionReplicaSet =
analysis.getSchemaPartitionInfo().getSchemaRegionReplicaSet(device);
DeleteTimeSeriesSchemaNode deleteTimeSeriesSchemaNode =
new DeleteTimeSeriesSchemaNode(this.getPlanNodeId(), deletedPath);
deleteTimeSeriesSchemaNode.setRegionReplicaSet(schemaRegionReplicaSet);
schemaRegionSpiltMap.putIfAbsent(deletedPath, deleteTimeSeriesSchemaNode);
List<TRegionReplicaSet> dataRegionReplicaSets =
analysis.getDataPartitionInfo().getDataRegionReplicaSet(device, null);
DeleteTimeSeriesDataNode deleteTimeSeriesDataNode =
new DeleteTimeSeriesDataNode(this.getPlanNodeId(), deletedPath);
for (TRegionReplicaSet dataRegionReplicaSet : dataRegionReplicaSets) {
deleteTimeSeriesDataNode.setRegionReplicaSet(dataRegionReplicaSet);
dataRegionSplitMap
.computeIfAbsent(deletedPath, k -> new ArrayList<>())
.add(deleteTimeSeriesDataNode);
}
}
return Collections.singletonList(this);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to implement this as a logical PlanNode tree construction in logicalPlanner, rather than invade into the FragmentInstanceDispatcher.

@cmlmakahts cmlmakahts closed this May 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants