Skip to content

Commit

Permalink
fix(interactive): throw unsupported exception for multi-edge patterns…
Browse files Browse the repository at this point in the history
… in GOpt (#3805)

<!--
Thanks for your contribution! please review
https://github.com/alibaba/GraphScope/blob/main/CONTRIBUTING.md before
opening an issue.
-->

## What do these changes do?

<!-- Please give a short brief about these changes. -->

As titled. We throw out unsupported exception for multi-edge patterns in
GOpt (to avoid unexpected result for multi-edge pattern), and we will
support such patterns later.

## Related issue number

<!-- Are there any issues opened that will be resolved by merging this
change? -->

Fixes #3774

---------

Co-authored-by: Longbin Lai <[email protected]>
  • Loading branch information
BingqingLyu and longbinlai authored May 22, 2024
1 parent 0893b5f commit c3be742
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,15 @@ private PatternEdge visitAndAddEdge(
dst = left;
}
PatternEdge edge = visitEdge(expand, src, dst);
inputPattern.addEdge(src, dst, edge);
boolean added = inputPattern.addEdge(src, dst, edge);
if (!added) {
throw new UnsupportedOperationException(
"edge "
+ edge
+ " already exists in the pattern, and pattern with"
+ " multi-edges are not supported yet");
}

vertexOrEdgeDetails.put(
edge, new DataValue(expand.getAliasName(), getFilters(expand)));
return edge;
Expand Down Expand Up @@ -352,7 +360,14 @@ private PatternEdge visitAndAddPxdEdge(
expandEdge.getId(),
expandEdge.isBoth(),
newDetails);
inputPattern.addEdge(src, dst, expandEdge);
boolean added = inputPattern.addEdge(src, dst, expandEdge);
if (!added) {
throw new UnsupportedOperationException(
"edge "
+ expandEdge
+ " already exists in the pattern, and pattern with"
+ " multi-edges are not supported yet");
}
vertexOrEdgeDetails.put(
expandEdge,
new DataValue(pxd.getAliasName(), getFilters(expand)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1421,6 +1421,10 @@
method = "g_V_valueMap_matchXa_selectXnameX_bX",
test = "org.apache.tinkerpop.gremlin.process.traversal.step.map.MatchTest",
reason = "unsupported")
@Graph.OptOut(
method = "g_V_matchXa_created_b__b_0created_aX",
test = "org.apache.tinkerpop.gremlin.process.traversal.step.map.MatchTest",
reason = "multi-edge pattern unsupported")

// steps nested in match is unsupported yet, will be supported latter, i.e values('name')
@Graph.OptOut(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1453,6 +1453,10 @@
// "g_V_matchXa_knows_b__b_created_c__a_created_cX_dedupXa_b_cX_selectXaX_byXnameX",
//// test = "org.apache.tinkerpop.gremlin.process.traversal.step.map.MatchTest",
//// reason = "unsupported")
@Graph.OptOut(
method = "g_V_matchXa_created_b__b_0created_aX",
test = "org.apache.tinkerpop.gremlin.process.traversal.step.map.MatchTest",
reason = "multi-edge pattern unsupported")

// need grateful graph
@Graph.OptOut(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1309,7 +1309,10 @@
// @Graph.OptOut(method="g_VX1X_asXaX_out_hasXageX_whereXgtXaXX_byXageX_name" ,
// test="org.apache.tinkerpop.gremlin.process.traversal.step.filter.WhereTest", reason = "existence
// of property is unsupported")

@Graph.OptOut(
method = "g_V_matchXa_created_b__b_0created_aX",
test = "org.apache.tinkerpop.gremlin.process.traversal.step.map.MatchTest",
reason = "multi-edge pattern unsupported")
// complex steps nested in match is unsupported yet, i.e. where(eq)/count/order/match
@Graph.OptOut(
method =
Expand Down

0 comments on commit c3be742

Please sign in to comment.