upadhyay-prashant opened a new pull request, #3717: URL: https://github.com/apache/tinkerpop/pull/3717
## Summary `CountStrategy` rewrites `count().is(P)` to `limit(n).count().is(P)`. When `P` accepts `n`, the capped value is emitted in place of the real count, so anything that observes it gets a wrong result: - `g.V().where(outE().count().is(gt(1)).is(lt(3)))` keeps vertices with more than 2 edges - `g.V().outE().count().is(gt(2))` returns `3` instead of `6` - `g.V().map(outE().count().is(gt(1)))` returns `2` instead of `3` The limit is now only added when: 1. `P` rejects the cap (e.g. `lt`, `lte`, `within`), so any count that passes is exact; or 2. the count is used purely as a filter (`where`/`filter`, `not`, `and`/`or`, `sideEffect`, `repeat().until()/emit()`) with no following step and no labels. Otherwise the traversal is left unchanged. The existing `not()` / filter-removal rewrites are untouched. ## Testing - `CountStrategyTest`: added 20 cases covering shapes that must not be limited and shapes that must stay optimized; updated 5 expectations that encoded the incorrect rewrite. 428 tests pass. - `CountStrategy.feature`: added 4 scenarios. 3 failed before the fix and all pass after. - TinkerGraph feature suites (`TinkerMemoryGraphFeatureTest`, `TinkerMemoryGraphComputerFeatureTest`, `TinkerShuffleGraphFeatureTest`): 5,742 tests, 0 failures. - Regenerated `translations.json` and the Go/Python/.NET/JS translation files (additions only). GLV feature tests were not run locally. ## Notes - Root-level and value-consuming usages such as `count().is(gt(n))` no longer get the early `limit()`. That is required for correctness. - This bug likely also exists on `3.7-dev`/`3.8-dev`; this PR targets `master`. -- 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]
