Skip to content

Commit

Permalink
[bug fix] fix metadata for PathExpand
Browse files Browse the repository at this point in the history
  • Loading branch information
BingqingLyu committed Mar 27, 2024
1 parent dae0727 commit 9b8e168
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@
import com.alibaba.graphscope.common.config.PegasusConfig;
import com.alibaba.graphscope.common.ir.meta.schema.CommonOptTable;
import com.alibaba.graphscope.common.ir.rel.*;
import com.alibaba.graphscope.common.ir.rel.GraphLogicalAggregate;
import com.alibaba.graphscope.common.ir.rel.GraphLogicalDedupBy;
import com.alibaba.graphscope.common.ir.rel.GraphLogicalProject;
import com.alibaba.graphscope.common.ir.rel.GraphLogicalSort;
import com.alibaba.graphscope.common.ir.rel.GraphShuttle;
import com.alibaba.graphscope.common.ir.rel.graph.*;
import com.alibaba.graphscope.common.ir.rel.graph.match.GraphLogicalMultiMatch;
import com.alibaba.graphscope.common.ir.rel.graph.match.GraphLogicalSingleMatch;
Expand Down Expand Up @@ -53,6 +48,7 @@
import org.apache.calcite.rel.logical.LogicalJoin;
import org.apache.calcite.rel.logical.LogicalUnion;
import org.apache.calcite.rel.rules.MultiJoin;
import org.apache.calcite.rel.type.RelDataType;
import org.apache.calcite.rel.type.RelDataTypeField;
import org.apache.calcite.rex.*;
import org.apache.calcite.sql.SqlKind;
Expand Down Expand Up @@ -218,6 +214,7 @@ public RelNode visit(GraphLogicalPathExpand pxd) {
GraphAlgebraPhysical.PathExpand.ExpandBase.Builder expandBaseBuilder =
GraphAlgebraPhysical.PathExpand.ExpandBase.newBuilder();
RelNode fused = pxd.getFused();
RelDataType rowType;
if (fused != null) {
// the case that expand base is fused
if (fused instanceof GraphPhysicalGetV) {
Expand All @@ -229,6 +226,7 @@ public RelNode visit(GraphLogicalPathExpand pxd) {
GraphPhysicalExpand fusedExpand = (GraphPhysicalExpand) fusedGetV.getInput();
GraphAlgebraPhysical.EdgeExpand.Builder expand = buildEdgeExpand(fusedExpand);
expandBaseBuilder.setEdgeExpand(expand);
rowType = fusedExpand.getRowType();
} else {
throw new UnsupportedOperationException(
"unsupported fused plan in path expand base: "
Expand All @@ -239,6 +237,7 @@ public RelNode visit(GraphLogicalPathExpand pxd) {
GraphPhysicalExpand fusedExpand = (GraphPhysicalExpand) fused;
GraphAlgebraPhysical.EdgeExpand.Builder expand = buildEdgeExpand(fusedExpand);
expandBaseBuilder.setEdgeExpand(expand);
rowType = fusedExpand.getFusedExpand().getRowType();
} else {
throw new UnsupportedOperationException(
"unsupported fused plan in path expand base");
Expand All @@ -250,6 +249,7 @@ public RelNode visit(GraphLogicalPathExpand pxd) {
GraphAlgebraPhysical.GetV.Builder getV = buildGetV((GraphLogicalGetV) pxd.getGetV());
expandBaseBuilder.setEdgeExpand(expand);
expandBaseBuilder.setGetV(getV);
rowType = pxd.getExpand().getRowType();
}
pathExpandBuilder.setBase(expandBaseBuilder);
pathExpandBuilder.setPathOpt(Utils.protoPathOpt(pxd.getPathOpt()));
Expand All @@ -264,6 +264,7 @@ public RelNode visit(GraphLogicalPathExpand pxd) {
}
oprBuilder.setOpr(
GraphAlgebraPhysical.PhysicalOpr.Operator.newBuilder().setPath(pathExpandBuilder));
oprBuilder.addAllMetaData(Utils.physicalProtoRowType(rowType, isColumnId));
if (isPartitioned) {
addRepartitionToAnother(pxd.getStartAlias().getAliasId());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,27 @@
"pathOpt": "SIMPLE",
"resultOpt": "ALL_V"
}
}
},
"metaData": [{
"type": {
"graphType": {
"elementOpt": "EDGE",
"graphDataType": [{
"label": {
"srcLabel": 0,
"dstLabel": 0
},
"props": [{
"propId": {
"name": "weight"
},
"type": "DOUBLE"
}]
}]
}
},
"alias": -1
}]
}, {
"opr": {
"sink": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,27 @@
"pathOpt": "SIMPLE",
"resultOpt": "ALL_V"
}
}
},
"metaData": [{
"type": {
"graphType": {
"elementOpt": "EDGE",
"graphDataType": [{
"label": {
"srcLabel": 0,
"dstLabel": 0
},
"props": [{
"propId": {
"name": "weight"
},
"type": "DOUBLE"
}]
}]
}
},
"alias": -1
}]
}, {
"opr": {
"sink": {
Expand Down

0 comments on commit 9b8e168

Please sign in to comment.