ShryukGrandhi opened a new pull request, #3451:
URL: https://github.com/apache/hugegraph/pull/3451
## Purpose of the PR
- Fixes #3443
In `BusinessHandlerImpl.scanIndex(...)`, the `transElement` branch wraps
`scanIndexToBaseElement` in `MapLimitIterator` for `LIMIT_DEDUP`.
`MapLimitIterator` dedups on the elements themselves, but `BaseVertex` and
`BaseElement` don't define `equals`/`hashCode`, so two vertex objects with the
same id both get through. `DEDUP` and `PRECISE_DEDUP` on the same branch
already dedup by id.
The path isn't reachable yet (`index2Element` throws and
`loadPropertyFromIndex` is always false), but once it is, any index that writes
several entries per element (search, collection secondary, joint secondary)
would return the same vertex more than once.
## Main Changes
- `MapLimitIterator` gets a second constructor that takes a key extractor;
the existing constructor uses `Function.identity()`, so the `BackendColumn`
callers behave as before.
- The `LIMIT_DEDUP` case on the `transElement` path passes `BaseElement::id`.
- `BaseVertex` equality is left alone, since changing it would affect every
collection that holds vertices.
## Verifying these changes
- [ ] Trivial rework / code cleanup without any test coverage. (No Need)
- [ ] Already covered by existing tests, such as *(please modify tests
here)*.
- [x] Need tests and can be verified as follows:
- New `MapLimitIteratorTest` (added to `CoreSuiteTest`) feeds two fresh
`BaseVertex` objects per id through `MapLimitIterator`. Before the change it
emitted 20 elements for 10 ids; now it emits 10.
- `FilterIteratorColumnEqualityTest`, `FilterIteratorContractTest`,
`ProjectionStageTest`, `UnionFilterIteratorTest` and
`FilterIteratorCleanupTest` still pass.
## Does this PR potentially affect the following parts?
- [ ] Dependencies
- [ ] Modify configurations
- [ ] The public API
- [ ] Other affects (typed here)
- [x] Nope
## Documentation Status
- [ ] `Doc - TODO`: required documentation is pending; complete it before
merging.
- [ ] `Doc - Done`: documentation is included here or linked below.
- [x] `Doc - No Need`: no user-visible documentation is affected.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]