Skip to content

fix(core): align count strategy connective steps#3037

Open
contrueCT wants to merge 1 commit into
apache:masterfrom
contrueCT:task/issue-2995-count-strategy
Open

fix(core): align count strategy connective steps#3037
contrueCT wants to merge 1 commit into
apache:masterfrom
contrueCT:task/issue-2995-count-strategy

Conversation

@contrueCT
Copy link
Copy Markdown
Contributor

Purpose of the PR

PR #2993 introduced HugeCountStrategy to guard HugeGraph against unsafe negative-bound count().is(P) optimizations.

This follow-up ports the upstream TINKERPOP-2911 ConnectiveStep handling into HugeGraph's local strategy, so and() / or() child traversals are rewritten consistently with upstream CountStrategy.

Main Changes

  • Handle ConnectiveStep separately when converting count().is(0) into not(...)
  • Wrap the whole child traversal in not(...) using a cloned traversal, instead of only rewriting the tail step
  • Reuse the same helper for FilterStep conversion
  • Keep the existing negative-bound safeguards from PR fix(server): guard count strategy on negative bounds #2993 unchanged
  • Add regression coverage for connective and() / or() traversal shapes, including multi-step where(or(...)) cases

Verifying these changes

  • Trivial rework / code cleanup without any test coverage. (No Need)
  • Already covered by existing tests, such as (please modify tests here).
  • Need tests and can be verified as follows:
    • xxx

Does this PR potentially affect the following parts?

Documentation Status

  • Doc - TODO
  • Doc - Done
  • Doc - No Need

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. tests Add or improve test cases labels May 24, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 24, 2026

Codecov Report

❌ Patch coverage is 57.14286% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 29.70%. Comparing base (e108076) to head (e428115).
⚠️ Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
...ugegraph/traversal/optimize/HugeCountStrategy.java 57.14% 4 Missing and 2 partials ⚠️

❗ There is a different number of reports uploaded between BASE (e108076) and HEAD (e428115). Click for more details.

HEAD has 2 uploads less than BASE
Flag BASE (e108076) HEAD (e428115)
3 1
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3037      +/-   ##
============================================
- Coverage     35.85%   29.70%   -6.16%     
+ Complexity      338      264      -74     
============================================
  Files           802      803       +1     
  Lines         67995    68060      +65     
  Branches       8902     8908       +6     
============================================
- Hits          24381    20216    -4165     
- Misses        41008    45526    +4518     
+ Partials       2606     2318     -288     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files. tests Add or improve test cases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Improve] Align HugeCountStrategy with upstream TINKERPOP-2911 ConnectiveStep fixes

1 participant