ISSUE DESCRIPTION [Improve] Align HugeCountStrategy with upstream TINKERPOP-2911…
- User
ISSUE DESCRIPTION
[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.
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call ) using or commands. However you don't need to use or before submitting your changes. In fact, only submits currently unstaged changes because it uses to get the changes that need to be submitted. - Assistant
I'll start by exploring the repository structure and locating HugeCountStrategy along with related CountStrategy/ConnectiveStep code.
- Assistant
Let me read the HugeCountStrategy and the test file, and also look for any references to TINKERPOP-2911 or ConnectiveStep.
- Assistant
Let me read the rest of the file and the test file. I also need to find the upstream TINKERPOP-2911 changes. Since I can't search the internet, I need to reason from what CountStrategy in TinkerPop ty...
- Assistant
Let me continue reading the rest of the file - specifically the ConnectiveStep related parts.
- Assistant
Looking at the code, I can see there's already some ConnectiveStep handling at lines 194-195. Let me check the TinkerPop version and try to decompile CountStrategy from the jar, or look at git histo...
- Assistant
Let me look at the PR #2993 commit and also try to get the upstream CountStrategy from more recent TinkerPop versions. TINKERPOP-2911 would be in a later version than 3.5.1.
- Assistant
Let me decompile the CountStrategy from TinkerPop 3.5.1 and also look for later versions. I might need to download a newer TinkerPop jar to see the TINKERPOP-2911 fix.
- Assistant
Looking at the current code and suggested regression cases, I'll decompile CountStrategy next to compare the ConnectiveStep handling against TINKERPOP-2911.
- Assistant
I got the sources for 3.7.3. Let me extract and read CountStrategy.java from newer versions, and also try to find when TINKERPOP-2911 was fixed.
- Assistant
The TINKERPOP-2911 change is clear: ConnectiveStep children should wrap in
not()rather than skipping that path. I'll read the full upstream strategy and current tests next. - Assistant
The file content looked mixed with Match tests — I'll re-read CountStrategyCoreTest fully to confirm what's actually there.
- Assistant
The CountStrategyCoreTest appears mixed with Match/TextRange tests — I'll check the original #2993 tests and whether unit tests for strategy rewrites already exist elsewhere.
- Assistant
I'll pull the upstream TINKERPOP-2911 tests next so we know the expected ConnectiveStep rewrite behavior.
- Assistant
Let me also get the and/or cases from the test:
- Assistant
Next I'll check how BaseCoreTest works and whether we can unit-test strategy rewrites without a full graph.
- Assistant
I'll port the ConnectiveStep handling into HugeCountStrategy and verify the rewrite with a quick temporary script.
- Assistant
Replacing the ConnectiveStep handling section and adding the helper method.
- Assistant
Now replace the useNotStep / FilterStep / ConnectiveStep block.
- Assistant
I need to navigate to that line first.
- Assistant
Now I can replace.
- Assistant
Now I need to add the transformToNotStep method before doStrategy.
- Assistant
Good. Now I'll compile and write a temporary verification script, and check how to build just the core module.
- Assistant
Compilation succeeded. Now I'll write a temporary test to verify the series of rewrites.
- Assistant
The classpath resolution failed. Let me get the proper classpath.
- Assistant
Let me just build a classpath manually using the jar and the target/classes, plus all jars from maven dependency tree offline, or simply use wild cards.
- Assistant
There's some annotation processor issue. Let me disable annotation processing.
- Assistant
Need more dependencies. Let me pull a broader classpath.
- Assistant
All rewrite cases pass. Next I'll add regression tests to CountStrategyCoreTest, and check BaseCoreTest briefly so lower-level rewrite checks still fit.
- Assistant
I'll add rewrite-structure and semantic graph regression tests after the existing count-strategy cases.
- Assistant
I'll update imports and insert new tests after testWhereCountGteNegativeDoesNotBuildInvalidRange.
- Assistant
Now insert helper method and tests after testWhereCountGteNegativeDoesNotBuildInvalidRange.
- Assistant
Strange - need to open the file again
- Assistant
I'll insert the new tests between line 202 and 204.
- Assistant
I'll fix the test helpers so they receive
Traversal.Adminvia.asAdmin(). - Assistant
Also need to fix assertOptimized parameter types — GraphTraversal.asAdmin() returns GraphTraversal.Admin which is Traversal.Admin. Good.
- Assistant
Cleaning up temp files and compiling the test module to verify everything builds.
- Assistant
There's an unexpected change in pom.xml — I didn't intentionally change that. Let me check.
- Assistant
These pom.xml changes look unrelated — I'll restore them so they don't go out with this fix.
- Assistant
Verifying the final state of both files, then submitting.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.