Skip to content

Commit

Permalink
Pipe: Fixed the bug that alter logical view statement uses a common p…
Browse files Browse the repository at this point in the history
…artial path (#14713)
  • Loading branch information
Caideyipi authored Jan 18, 2025
1 parent a011b01 commit 75dda9f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet;
import org.apache.iotdb.commons.exception.IllegalPathException;
import org.apache.iotdb.commons.path.MeasurementPath;
import org.apache.iotdb.commons.path.PartialPath;
import org.apache.iotdb.db.queryengine.plan.analyze.IAnalysis;
import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanNode;
import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanNodeId;
Expand All @@ -45,7 +44,7 @@
import java.util.Objects;

public class AlterTimeSeriesNode extends WritePlanNode {
private PartialPath path;
private MeasurementPath path;
private AlterType alterType;

/**
Expand All @@ -68,7 +67,7 @@ public class AlterTimeSeriesNode extends WritePlanNode {

public AlterTimeSeriesNode(
PlanNodeId id,
PartialPath path,
MeasurementPath path,
AlterType alterType,
Map<String, String> alterMap,
String alias,
Expand All @@ -85,11 +84,11 @@ public AlterTimeSeriesNode(
this.isAlterView = isAlterView;
}

public PartialPath getPath() {
public MeasurementPath getPath() {
return path;
}

public void setPath(PartialPath path) {
public void setPath(MeasurementPath path) {
this.path = path;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import org.apache.iotdb.common.rpc.thrift.TSStatus;
import org.apache.iotdb.commons.auth.entity.PrivilegeType;
import org.apache.iotdb.commons.path.MeasurementPath;
import org.apache.iotdb.commons.path.PartialPath;
import org.apache.iotdb.db.auth.AuthorityChecker;
import org.apache.iotdb.db.queryengine.plan.statement.Statement;
Expand All @@ -41,7 +42,7 @@
* <p>ALTER TIMESERIES path RENAME | SET | DROP | ADD TAGS | ADD ATTRIBUTES | UPSERT
*/
public class AlterTimeSeriesStatement extends Statement {
private PartialPath path;
private MeasurementPath path;
private AlterTimeSeriesStatement.AlterType alterType;

/**
Expand Down Expand Up @@ -81,11 +82,11 @@ public List<PartialPath> getPaths() {
return Collections.singletonList(path);
}

public PartialPath getPath() {
public MeasurementPath getPath() {
return path;
}

public void setPath(PartialPath path) {
public void setPath(MeasurementPath path) {
this.path = path;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,8 @@ public List<Object> visitDatabaseMNode(

@Override
public List<Object> visitMeasurementMNode(
final AbstractMeasurementMNode<?, ? extends IMNode<?>> node, final PartialPath path) {
final AbstractMeasurementMNode<?, ? extends IMNode<?>> node, PartialPath path) {
path = new MeasurementPath(path.getNodes());
if (node.isLogicalView()) {
final List<Object> statementList = new ArrayList<>();
final CreateLogicalViewStatement stmt = new CreateLogicalViewStatement();
Expand All @@ -373,7 +374,7 @@ public List<Object> visitMeasurementMNode(
final AlterTimeSeriesStatement alterTimeSeriesStatement =
new AlterTimeSeriesStatement(true);
alterTimeSeriesStatement.setAlterType(AlterTimeSeriesStatement.AlterType.UPSERT);
alterTimeSeriesStatement.setPath(path);
alterTimeSeriesStatement.setPath((MeasurementPath) path);
try {
final Pair<Map<String, String>, Map<String, String>> tagsAndAttribute =
getTagsAndAttributes(node.getOffset());
Expand All @@ -393,7 +394,7 @@ public List<Object> visitMeasurementMNode(
return null;
} else {
final CreateTimeSeriesStatement stmt = new CreateTimeSeriesStatement();
stmt.setPath(new MeasurementPath(path.getNodes()));
stmt.setPath((MeasurementPath) path);
stmt.setAlias(node.getAlias());
stmt.setCompressor(node.getAsMeasurementMNode().getSchema().getCompressor());
stmt.setDataType(node.getDataType());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public void testAlterTimeSeriesNode() throws IllegalPathException {
AlterTimeSeriesNode alterTimeSeriesNode =
new AlterTimeSeriesNode(
planNodeId,
new PartialPath("root.sg.d1.s1"),
new MeasurementPath("root.sg.d1.s1"),
AlterTimeSeriesStatement.AlterType.RENAME,
map,
"alias",
Expand Down

0 comments on commit 75dda9f

Please sign in to comment.