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

fix(api): correct the vertex id in the edge-existence api #2380

Merged
merged 25 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
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 @@ -22,6 +22,7 @@
import java.util.Iterator;

import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.api.graph.VertexAPI;
import org.apache.hugegraph.backend.id.Id;
import org.apache.hugegraph.core.GraphManager;
import org.apache.hugegraph.structure.HugeVertex;
Expand Down Expand Up @@ -72,8 +73,8 @@
E.checkArgumentNotNull(source, "The source can't be null");
E.checkArgumentNotNull(target, "The target can't be null");

Id sourceId = HugeVertex.getIdValue(source);
Id targetId = HugeVertex.getIdValue(target);
Id sourceId = VertexAPI.checkAndParseVertexId(source);
Id targetId = VertexAPI.checkAndParseVertexId(target);

Check warning on line 77 in hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/EdgeExistenceAPI.java

View check run for this annotation

Codecov / codecov/patch

hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/EdgeExistenceAPI.java#L76-L77

Added lines #L76 - L77 were not covered by tests
HugeGraph hugegraph = graph(manager, graph);
EdgeExistenceTraverser traverser = new EdgeExistenceTraverser(hugegraph);
Iterator<Edge> edges = traverser.queryEdgeExistence(sourceId, targetId, edgeLabel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,15 @@
return queryByNeighbors(sourceId, targetId, limit);
}

Id edgeLabelId = getEdgeLabelId(label);
EdgeLabel edgeLabel = graph().edgeLabel(edgeLabelId);
EdgeLabel edgeLabel = graph().edgeLabel(label);

Check warning on line 45 in hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/EdgeExistenceTraverser.java

View check run for this annotation

Codecov / codecov/patch

hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/EdgeExistenceTraverser.java#L45

Added line #L45 was not covered by tests
ConditionQuery conditionQuery = new ConditionQuery(HugeType.EDGE);
conditionQuery.eq(HugeKeys.OWNER_VERTEX, sourceId);
conditionQuery.eq(HugeKeys.OTHER_VERTEX, targetId);
conditionQuery.eq(HugeKeys.LABEL, edgeLabelId);
conditionQuery.eq(HugeKeys.LABEL, edgeLabel.id());

Check warning on line 49 in hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/EdgeExistenceTraverser.java

View check run for this annotation

Codecov / codecov/patch

hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/EdgeExistenceTraverser.java#L49

Added line #L49 was not covered by tests
conditionQuery.eq(HugeKeys.DIRECTION, Directions.OUT);
conditionQuery.limit(limit);

if (edgeLabel.existSortKeys()) {
if (edgeLabel.existSortKeys() && !sortValues.isEmpty()) {
conditionQuery.eq(HugeKeys.SORT_VALUES, sortValues);
} else {
conditionQuery.eq(HugeKeys.SORT_VALUES, "");
Expand Down
Loading