Untitled conversation
- User
[Improve] Align HugeCountStrategy with upstream TINKERPOP-2911 ConnectiveStep fixes
Feature Description (功能描述)
Background
PR #2993 introduced
HugeCountStrategyto fix the negative-bound optimization issues behind #2930, #2931, and #2932.That fix was implemented by forking an older version of TinkerPop's
CountStrategyand adding HugeGraph-specific guards for negative bounds.However, the current local fork does not yet include the upstream follow-up fix for
ConnectiveStep/and()/or()handling fromTINKERPOP-2911.As a result, HugeGraph is now aligned for the negative-bound cases fixed in #2993, but it may still inherit older
CountStrategybehavior for some connective-filter patterns.Follow-up Scope
Port the upstream
TINKERPOP-2911changes forConnectiveStepintoHugeCountStrategy, and add regression coverage for connective traversal shapes.Suggested regression cases include:
__.and(__.out().count().is(0), __.in().count().is(0))__.or(__.out().count().is(0), __.in().count().is(0))__.where(__.or(__.out("none").out().count().is(0), __.has("none")))__.where(__.or(__.out("none").out().count().is(0), __.has("none").count().is(0)))
Expected Result
HugeCountStrategyshould behave consistently with the upstreamCountStrategyfixes aroundConnectiveStep- connective
and()/or()traversal shapes should no longer rely on older inherited behavior from the forked strategy - regression tests should cover the above traversal forms and protect against future drift
I’d be happy to follow up on this as a separate improvement issue and work on a later refinement PR.
Interface
No new interfaces are introduced.
- Assistant
Let me look at the referenced PR #2993 context and the TinkerPop version in use, plus any existing tests for this strategy.
- Assistant
Both APIs exist. Now apply the port to
HugeCountStrategy: - Assistant
Update the class doc to reflect the alignment:
- Assistant
Now let me verify the fork's unchanged
elsebranch matches upstream (to confirm I only need this delta): - Assistant
The pom.xml change is a preexisting environment modification — I'll leave it. Now add the regression tests:
- Assistant
Fix the awkward double-negative assertion:
- Assistant
Now compile both modules:
- Assistant
Re-run the full test class with the fix in place:
- Assistant
All green. Final review of the complete diff:
- Assistant
The port is complete and verified. Summary of what was done:
Changes
HugeCountStrategy.java(hugegraph-core)Ported the upstream TINKERPOP-2911
ConnectiveStepfix, taken verbatim from TinkerPop 3.5.6 (identical in 3.7.3, the final upstream shape):ConnectiveStepparent branch (new) — acount().is(0)child ofand()/or()is now wrapped innot(): the remaining child steps are cloned into a , all steps removed, and the added back. Previously these children fell into the -walk branch, which corrupted children with multi-step prefixes (e.g. became instead of ).
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.