ZhYQ1 commented on code in PR #430:
URL: https://github.com/apache/hugegraph-ai/pull/430#discussion_r4637697395
##########
hugegraph-llm/src/hugegraph_llm/nodes/hugegraph_node/graph_query_node.py:
##########
@@ -30,26 +30,33 @@
# TODO: test with profile()/explain() to speed up the query
VID_QUERY_NEIGHBOR_TPL = """\
g.V({keywords})
-.repeat(
- bothE({edge_labels}).limit({edge_limit}).otherV().dedup()
-).times({max_deep}).emit()
-.simplePath()
-.path()
-.by(project('label', 'id', 'props')
- .by(label())
- .by(id())
- .by(valueMap().by(unfold()))
+.local(
+ __.repeat(
+ bothE({edge_labels}).limit({edge_limit}).otherV().dedup()
+ ).times({max_deep}).emit()
+ .simplePath()
+ .path()
+ .by(project('label', 'id', 'props')
+ .by(label())
+ .by(id())
+ .by(valueMap().by(unfold()))
+ )
+ .by(project('label', 'inV', 'outV', 'props')
+ .by(label())
+ .by(inV().id())
+ .by(outV().id())
+ .by(valueMap().by(unfold()))
+ )
+ .limit({max_items})
)
-.by(project('label', 'inV', 'outV', 'props')
- .by(label())
- .by(inV().id())
- .by(outV().id())
- .by(valueMap().by(unfold()))
-)
-.limit({max_items})
.toList()
"""
+# Number of matched vids grouped per single gremlin ``exec`` for the neighbour
+# traversal. One round-trip per group instead of one per matched vid; the batch
+# stays small to keep each query's work bounded.
+NEIGHBOR_QUERY_BATCH_SIZE = 10
Review Comment:
@bitflicker64 Done — rebased the two `llm` commits onto `ontogeny` and
force-pushed `perf/gremlin-neighbor-batching`. The PR diff now contains only
those 2 commits and `graph_query_node.py` + its test
(`test_graph_query_node.py`).
--
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]