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


##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/TraversalUtil.java:
##########
@@ -453,6 +459,22 @@ private static boolean canExtractHasContainers(HugeGraph 
graph,
         return true;
     }
 
+    private static boolean isOnlyNonEqInLabelPredicate(HasContainer has) {
+        if (!has.getKey().equals(T.label.getAccessor())) {
+            return false;
+        }
+
+        List<P<Object>> predicates = new ArrayList<>();
+        collectPredicates(predicates, ImmutableList.of(has.getPredicate()));
+        for (P<Object> predicate : predicates) {
+            BiPredicate<?, ?> bp = predicate.getBiPredicate();
+            if (bp == Compare.eq || bp == Contains.within) {

Review Comment:
   Fixed in 7d906bc10. canExtractHasContainers() now retains a pure-label 
holder unless every leaf predicate is EQ/WITHIN, so mixed OR/AND predicates 
containing NEQ, WITHOUT, or other leaves remain TinkerPop filters. Added vertex 
and edge regressions for mixed OR and AND predicates. The focused RocksDB core 
run passed with 7 tests and 0 failures/errors.



##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/TraversalUtil.java:
##########
@@ -445,6 +445,12 @@ private static boolean 
extractHasContainers(HugeVertexStep<?> newStep,
 
     private static boolean canExtractHasContainers(HugeGraph graph,
                                                    HasContainerHolder holder) {
+        List<HasContainer> hasContainers = holder.getHasContainers();
+        // Keep pure label non-EQ/IN predicates on GraphStep for TinkerPop 
filtering.
+        if (hasContainers.size() == 1 &&

Review Comment:
   Fixed in 7d906bc10. Pure-label holders are now classified independently of 
container count; if any contained label predicate is not entirely EQ/WITHIN, 
the whole holder remains for TinkerPop filtering. Added vertex and edge 
coverage for sequential EQ+NEQ and NEQ+NEQ label filters. The focused RocksDB 
core run passed with 7 tests and 0 failures/errors.



##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/ConditionQuery.java:
##########
@@ -256,24 +256,27 @@ public boolean containsLabelOrUserpropRelation() {
         return false;
     }
 
+    /**
+     * Returns the legacy condition value of the specified key.
+     *
+     * This method keeps the historical behavior for existing callers:
+     * <ul>
+     * <li>returns {@code null} if no top-level EQ/IN relation exists</li>
+     * <li>returns {@code null} if top-level EQ/IN relations resolve to 
empty</li>

Review Comment:
   Fixed in 7d906bc10. The legacy condition() Javadoc now states that a sole IN 
relation returns its raw list, including an empty list, before multi-relation 
resolution. Added QueryTest#testConditionWithEmptyInValues to pin the empty-IN 
behavior. QueryTest and TraversalUtilOptimizeTest passed with 23 tests and 0 
failures/errors.



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