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


##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/TraversalUtil.java:
##########
@@ -645,14 +658,107 @@ 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 ||
+               step instanceof NoOpBarrierStep ||
+               step instanceof RangeGlobalStep ||
+               step instanceof IdentityStep) {

Review Comment:
   Fixed in ccaab209. `hasUnsafeLabelInTraversal()` now scans the remaining 
traversal before either extraction path runs and recursively checks both local 
and global child traversals, while the extraction loop keeps its existing 
whitelist. The HugeVertexStep unit now preserves the preceding property filter, 
and memory-backend Vertex/Edge regressions cover both `aggregate("x")` and 
`coin(1.0)`. I also added a global-child regression discovered during the final 
review. Local verification passed: `TraversalUtilOptimizeTest` (30 tests), the 
focused Vertex/Edge regressions (2 tests), and the full 38-module `mvn clean 
compile`.



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