Skip to content

Commit ee64377

Browse files
committed
fix
1 parent 433fda3 commit ee64377

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/ConditionQuery.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ public Condition.Relation copyRelationAndUpdateQuery(Object key) {
553553
}
554554
}
555555
}
556-
E.checkArgument(copyRes != null, "Copying Condition.Relation failed. key:%s", key);
556+
E.checkArgument(copyRes != null, "Failed to copy Condition.Relation: %s", key);
557557
return copyRes;
558558
}
559559

hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1460,7 +1460,7 @@ private Query optimizeQuery(ConditionQuery query) {
14601460
List<Id> filterVertexList = vertexIdList.stream().filter(vertexId -> {
14611461
Vertex vertex = this.graph().vertex(vertexId);
14621462
VertexLabel vertexLabel = graph().vertexLabel(vertex.label());
1463-
return edgeLabel.linkWithLabel(vertexLabel.id(), dir.type());
1463+
return edgeLabel.linkWithVertexLabel(vertexLabel.id(), dir);
14641464
}).collect(Collectors.toList());
14651465
if (CollectionUtils.isEmpty(filterVertexList)) {
14661466
// Return empty query to skip storage query
@@ -1477,7 +1477,7 @@ private Query optimizeQuery(ConditionQuery query) {
14771477
Vertex vertex = QueryResults.one(iter);
14781478
if (vertex != null) {
14791479
VertexLabel vertexLabel = graph().vertexLabel(vertex.label());
1480-
if (!edgeLabel.linkWithLabel(vertexLabel.id(), dir.type())) {
1480+
if (!edgeLabel.linkWithVertexLabel(vertexLabel.id(), dir)) {
14811481
// Return empty query to skip storage query
14821482
return new Query(query.resultType());
14831483
}

hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/EdgeLabel.java

+8-5
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.apache.hugegraph.backend.id.Id;
2828
import org.apache.hugegraph.schema.builder.SchemaBuilder;
2929
import org.apache.hugegraph.type.HugeType;
30+
import org.apache.hugegraph.type.define.Directions;
3031
import org.apache.hugegraph.type.define.Frequency;
3132
import org.apache.hugegraph.util.E;
3233

@@ -99,11 +100,13 @@ public boolean linkWithLabel(Id id) {
99100
return this.sourceLabel.equals(id) || this.targetLabel.equals(id);
100101
}
101102

102-
public boolean linkWithLabel(Id id, HugeType type) {
103-
if (type.equals(HugeType.EDGE_IN)) {
104-
return this.targetLabel.equals(id);
105-
} else if (type.equals(HugeType.EDGE_OUT)) {
106-
return this.sourceLabel.equals(id);
103+
public boolean linkWithVertexLabel(Id label, Directions dir) {
104+
if (dir.equals(Directions.IN)) {
105+
return this.targetLabel.equals(label);
106+
} else if (dir.equals(Directions.OUT)) {
107+
return this.sourceLabel.equals(label);
108+
} else if (dir.equals(Directions.BOTH)) {
109+
return this.targetLabel.equals(label) || this.sourceLabel.equals(label);
107110
}
108111
return false;
109112
}

0 commit comments

Comments
 (0)