imbajin commented on code in PR #2994:
URL: https://github.com/apache/hugegraph/pull/2994#discussion_r3905717054
##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/TraversalUtil.java:
##########
@@ -645,14 +656,70 @@ private static boolean
extractHasContainers(HugeVertexStep<?> newStep,
private static boolean canExtractHasContainers(HugeGraph graph,
HasContainerHolder holder) {
- for (HasContainer has : holder.getHasContainers()) {
+ // Keep unsafe labels and their sibling properties for local filtering.
+ if (hasUnsafeLabelPredicate(holder)) {
+ return false;
+ }
+ List<HasContainer> hasContainers = holder.getHasContainers();
+ for (HasContainer has : hasContainers) {
if (!canExtractHasContainer(graph, has)) {
return false;
}
}
return true;
}
+ private static boolean hasUnsafeLabelInChain(Step<?, ?> step,
+ boolean
followPositiveLabelOr) {
+ // Partial pushdown can lose candidates before local label filtering.
+ // FIXME: Restore selective pushdown when every candidate schema label
+ // has compatible index coverage for extracted property predicates.
+ while (step instanceof HasStep ||
Review Comment:
‼️ The guard stops at an unflattened `OrStep` and therefore misses unsafe
label predicates in its child traversals. For `g.V().has("city",
"Beijing").or(__.has(T.label, P.neq("author")), __.has("status", "active"))`,
if `city` is indexed only for `person` while a `fan` vertex also has
`city=Beijing`, the `fan` satisfies the first branch but is omitted: the
preceding `city` HasStep is pushed into `HugeGraphStep`,
`collectMatchedIndexes()` plans only the indexed label, and the nested
negative-label filter runs after the candidate set has already been truncated.
Please recurse through logical child traversals (or conservatively keep
preceding property filters local) whenever an unsafe label can remain after the
graph step, and add a cross-label regression for this mixed-key OrStep case.
--
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]