bitflicker64 commented on code in PR #430:
URL: https://github.com/apache/hugegraph-ai/pull/430#discussion_r4636128799
##########
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:
Important: the head is based on #391's head `d97afa1`, not on `ontogeny`, so
this PR carries #391's 68 commits and 383 extra files and merging it lands them
without that PR's review. Rebase the two `llm` commits onto `ontogeny` so the
diff holds only `graph_query_node.py` and its test.
--
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]