Skip to content
TheChatArchiveThe Chat Archive
composer-2.5· unknownHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

Untitled conversation

  1. User

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

    Feature Description (功能描述)

    Background

    PR #2993 introduced HugeCountStrategy to fix the negative-bound optimization issues behind #2930, #2931, and #2932.

    That fix was implemented by forking an older version of TinkerPop's CountStrategy and 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 from TINKERPOP-2911.

    As a result, HugeGraph is now aligned for the negative-bound cases fixed in #2993, but it may still inherit older CountStrategy behavior for some connective-filter patterns.

    Follow-up Scope

    Port the upstream TINKERPOP-2911 changes for ConnectiveStep into HugeCountStrategy, 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

    • HugeCountStrategy should behave consistently with the upstream CountStrategy fixes around ConnectiveStep
    • 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.

  2. Assistant

    I'll align HugeCountStrategy with upstream TINKERPOP-2911 ConnectiveStep fixes. First I'm locating the current implementation and the upstream changes to port.

  3. Assistant

    Porting TINKERPOP-2911 ConnectiveStep handling into HugeCountStrategy and adding regression tests.

  4. Assistant

    The where/or tests fail because HugeGraph validates edge labels at schema time. I'll adjust them to use a defined but unused edge label.

  5. Assistant

    All four new tests passed. Checking lints and reviewing the final implementation.

  6. Assistant

    Aligned HugeCountStrategy with upstream TinkerPop TINKERPOP-2911 ConnectiveStep handling.

    Changes

    HugeCountStrategy.java

    Ported the upstream fix from TinkerPop 3.5.6 (apache/tinkerpop#2016):

    1. ConnectiveStep handling — When count().is(0) appears under and() / or(), the strategy now wraps the entire child traversal in not() instead of walking backward and partially hoisting filter steps (the old behavior that broke patterns like out("none").out().count().is(0)).

    2. transformToNotStep() helper — Extracted shared logic that clones the inner traversal (traversal.clone()) before wrapping, matching upstream semantics.

    3. FilterStep handling — Non-connective where(...) filters now use the same helper, consistent with upstream.

    HugeGraph-specific guards from #2993 are unchanged:

    • Negative compare bounds still disable not() / dismissCountIs optimization (TINKERPOP-2893)
    • Negative highRange is still cleared to avoid invalid backend ranges

    CountStrategyCoreTest.java

    Added regression coverage for the suggested connective shapes:

    TestTraversal
    testAndCountIsZeroConnectiveBranches__.and(__.out().count().is(0), __.in().count().is(0))
    testOrCountIsZeroConnectiveBranches__.or(__.out().count().is(0), __.in().count().is(0))
    testWhereOrCountIsZeroWithMissingEdgeLabel__.where(__.or(__.out("none").out().count().is(0), __.has("none")))
    testWhereOrCountIsZeroWithMissingEdgeLabelAndProperty__.where(__.or(__.out("none").out().count().is(0), __.has("none").count().is(0)))

    The where/or tests use a helper (initConnectiveCountSchema) that defines the none edge label and property in schema (HugeGraph requires this) but creates no none edges or property values — matching the upstream intent of “label/property exists in schema but has no data.”

    All four new tests pass in the core test suite.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.