imbajin commented on code in PR #2859:
URL:
https://github.com/apache/incubator-hugegraph/pull/2859#discussion_r2313280179
##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java:
##########
@@ -775,40 +784,103 @@ protected Iterator<Vertex> queryVerticesByIds(Object[]
vertexIds, boolean adjace
return this.queryVerticesByIds(vertexIds, adjacentVertex,
checkMustExist, HugeType.VERTEX);
}
+ @Watched(prefix = "graph")
Review Comment:
Missing test coverage for the single-ID optimization. Consider adding tests
for:
1. **Performance verification**: Ensure single-ID queries are faster than
multi-ID queries
2. **Correctness tests**:
- Single ID found in local transaction (added/updated)
- Single ID removed from local transaction
- Single ID not found anywhere
- Single null ID handling
3. **Edge cases**: Single ID with expired vertex
Example test structure:
```java
@Test
public void testSingleVertexQueryOptimization() {
// Test single vertex query performance and correctness
Id vertexId = IdGenerator.of("test-vertex");
// Test local transaction lookup
HugeVertex localVertex = constructVertex(vertexId);
tx.addVertex(localVertex);
Iterator<Vertex> result = tx.queryVertices(vertexId);
assertThat(result).hasNext();
assertThat(result.next()).isEqualTo(localVertex);
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]