imbajin commented on code in PR #2994:
URL: https://github.com/apache/hugegraph/pull/2994#discussion_r3394715605


##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphIndexTransaction.java:
##########
@@ -415,8 +415,11 @@ private IdHolderList queryByLabel(ConditionQuery query) {
         HugeType queryType = query.resultType();
         IndexLabel il = IndexLabel.label(queryType);
         validateIndexLabel(il);
-        Id label = query.condition(HugeKeys.LABEL);
-        assert label != null;
+        // Query-by-label builds a label index entry and requires one
+        // deterministically resolved label instead of best-effort fallback.
+        Id label = query.conditionValue(HugeKeys.LABEL);

Review Comment:
   ‼️ **Do not route non-EQ label predicates into `queryByLabel()`**
   
   Evidence: `queryByUserprop()` selects `queryByLabel()` whenever the only 
sysprop is LABEL, but `queryByLabel()` now immediately requires 
`conditionValue(HugeKeys.LABEL)`, which only resolves EQ/IN label relations. A 
pure label predicate such as `g.V().has(T.label, P.neq("author"))` is converted 
by `TraversalUtil` into `Condition.neq(HugeKeys.LABEL, ...)`, so it reaches 
this branch and then fails the single-label check.
   
   Impact: label-only non-EQ traversals regress, while the new 
`testQueryByNonEqLabelAndIndexedProperty()` does not catch it because the extra 
`city` predicate sends that query through the user-prop path. Please gate the 
label-index fast path on an EQ/IN-resolvable label, for example 
`containsConditionValues(HugeKeys.LABEL)` or 
`uniqueConditionValue(HugeKeys.LABEL) != null`, and add pure label-only `neq` 
coverage for vertices and edges.



-- 
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]

Reply via email to