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

Optimize the devicePath generation efficiency of PlanNode when deserializing #12749

Merged
merged 3 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ public static CreateAlignedTimeSeriesStatement createStatement(TSCreateAlignedTi
final long startTime = System.nanoTime();
// construct create aligned timeseries statement
CreateAlignedTimeSeriesStatement statement = new CreateAlignedTimeSeriesStatement();
statement.setDevicePath(new PartialPath(req.prefixPath));
statement.setDevicePath(DEVICE_PATH_CACHE.getPartialPath(req.prefixPath));
List<TSDataType> dataTypes = new ArrayList<>();
for (Integer dataType : req.dataTypes) {
dataTypes.add(TSDataType.deserialize(dataType.byteValue()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.apache.iotdb.commons.exception.IllegalPathException;
import org.apache.iotdb.commons.path.PartialPath;
import org.apache.iotdb.db.queryengine.plan.analyze.IAnalysis;
import org.apache.iotdb.db.queryengine.plan.analyze.cache.schema.DataNodeDevicePathCache;
import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanNode;
import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanNodeId;
import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanNodeType;
Expand Down Expand Up @@ -211,7 +212,7 @@ public static CreateAlignedTimeSeriesNode deserialize(ByteBuffer byteBuffer) {
byte[] bytes = new byte[length];
byteBuffer.get(bytes);
try {
devicePath = new PartialPath(new String(bytes));
devicePath = DataNodeDevicePathCache.getInstance().getPartialPath(new String(bytes));
OneSizeFitsQuorum marked this conversation as resolved.
Show resolved Hide resolved
} catch (IllegalPathException e) {
throw new IllegalArgumentException("Can not deserialize CreateAlignedTimeSeriesNode", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,9 @@ public static InsertRowNode deserialize(ByteBuffer byteBuffer) {
void subDeserialize(ByteBuffer byteBuffer) {
time = byteBuffer.getLong();
try {
devicePath = new PartialPath(ReadWriteIOUtils.readString(byteBuffer));
devicePath =
DataNodeDevicePathCache.getInstance()
.getPartialPath(ReadWriteIOUtils.readString(byteBuffer));
} catch (IllegalPathException e) {
throw new IllegalArgumentException(DESERIALIZE_ERROR, e);
}
Expand Down Expand Up @@ -741,7 +743,9 @@ protected static InsertRowNode subDeserializeFromWAL(ByteBuffer buffer) {
InsertRowNode insertNode = new InsertRowNode(new PlanNodeId(""));
insertNode.setTime(buffer.getLong());
try {
insertNode.setDevicePath(new PartialPath(ReadWriteIOUtils.readString(buffer)));
insertNode.setDevicePath(
DataNodeDevicePathCache.getInstance()
.getPartialPath(ReadWriteIOUtils.readString(buffer)));
} catch (IllegalPathException e) {
throw new IllegalArgumentException(DESERIALIZE_ERROR, e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.apache.iotdb.commons.utils.StatusUtils;
import org.apache.iotdb.commons.utils.TimePartitionUtils;
import org.apache.iotdb.db.queryengine.plan.analyze.IAnalysis;
import org.apache.iotdb.db.queryengine.plan.analyze.cache.schema.DataNodeDevicePathCache;
import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanNode;
import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanNodeId;
import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanNodeType;
Expand Down Expand Up @@ -228,7 +229,9 @@ public static InsertRowsOfOneDeviceNode deserialize(ByteBuffer byteBuffer) {
List<Integer> insertRowNodeIndex = new ArrayList<>();

try {
devicePath = new PartialPath(ReadWriteIOUtils.readString(byteBuffer));
devicePath =
DataNodeDevicePathCache.getInstance()
.getPartialPath((ReadWriteIOUtils.readString(byteBuffer)));
} catch (IllegalPathException e) {
throw new IllegalArgumentException("Cannot deserialize InsertRowsOfOneDeviceNode", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,9 @@ public static InsertTabletNode deserialize(ByteBuffer byteBuffer) {

public void subDeserialize(ByteBuffer buffer) {
try {
devicePath = new PartialPath(ReadWriteIOUtils.readString(buffer));
devicePath =
DataNodeDevicePathCache.getInstance()
.getPartialPath((ReadWriteIOUtils.readString(buffer)));
} catch (IllegalPathException e) {
throw new IllegalArgumentException("Cannot deserialize InsertTabletNode", e);
}
Expand Down Expand Up @@ -929,7 +931,9 @@ public static InsertTabletNode deserializeFromWAL(ByteBuffer buffer) {
private void subDeserializeFromWAL(ByteBuffer buffer) {
searchIndex = buffer.getLong();
try {
devicePath = new PartialPath(ReadWriteIOUtils.readString(buffer));
devicePath =
DataNodeDevicePathCache.getInstance()
.getPartialPath((ReadWriteIOUtils.readString(buffer)));
} catch (IllegalPathException e) {
throw new IllegalArgumentException("Cannot deserialize InsertTabletNode", e);
}
Expand Down
Loading