ZhYQ1 opened a new pull request, #430:
URL: https://github.com/apache/hugegraph-ai/pull/430
Closes #429
## Summary
The id-to-match subgraph branch queried neighbours with one
`gremlin().exec()` per matched vid, so a large id set cost one server
round-trip per id. Group the ids into batches of `NEIGHBOR_QUERY_BATCH_SIZE`
(10) and issue one exec per batch, concatenating each batch's `["data"]` in
`matched_vids` order.
## Changes
- `nodes/hugegraph_node/graph_query_node.py` — batch the per-vid neighbour
traversal; the full-vertex `VERTEX_QUERY_TPL` exec and the property-match
branch are unchanged.
- `tests/nodes/test_graph_query_node.py` — covers batch count (5 vids → 2
execs, 25 vids → `1 + ceil(25/10)`), single vid, empty set, id split across
batches, and cross-batch path ordering.
## Query count
For N matched vids: `1 + N` execs → `1 + ceil(N / 10)` execs (e.g. N=25: 26
→ 4).
## Test plan
From `hugegraph-llm`:
ruff check src/hugegraph_llm/nodes/hugegraph_node/graph_query_node.py
src/tests/nodes/test_graph_query_node.py
ruff format --check
src/hugegraph_llm/nodes/hugegraph_node/graph_query_node.py
src/tests/nodes/test_graph_query_node.py
PYTHONPATH=src pytest src/tests/nodes -q
Result: new tests pass, 9 passed in `src/tests/nodes`, ruff clean.
## Notes
- Baseline: `perf/query-links-batch @215f248`.
- Same file as #383 / #385 / #412 — rebase order only, no semantic overlap.
- Not a duplicate of #421 (build-time matched-vertex dedup); this is
query-time batching.
- Known limitation: `VID_QUERY_NEIGHBOR_TPL` ends with one global
`.limit(max_items)`, so in a batch the cap is shared across the group instead
of per vid. Ordering is preserved, but results can be a subset of the old
per-vid union when the cap is hit. This mirrors the property-match branch,
which already applies one global limit across all keywords.
--
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]