imbajin opened a new issue, #3396: URL: https://github.com/apache/hugegraph/issues/3396
### Bug Type Logic / incorrect query results. ### Environment Development source reviewed in PR #3395, Java 17. Reproduced with the production Store iterators in a standalone JVM; no running Store cluster or native RocksDB instance was used. ### Expected and actual behavior `BackendColumn.equals()` compares byte-array contents, but the class has no matching `hashCode()`. Real RocksDB scans allocate a new `BackendColumn` on each `next()` call. The in-memory union/intersection maps therefore do not reliably combine content-equal rows from independent scans. With 100 keys, each appearing twice as separately allocated, byte-equal columns: | Iterator | Expected rows | Observed rows | | --- | --- | --- | | Intersection, size = 2 | 100 | 0 | | Union, below its sort threshold | 100 | 200 | A separate probe also finds two equal newly allocated columns occupying two entries in a `HashSet`. ### Reproduction 1. Generate 100 keys as four-byte integer arrays; use the same value bytes for each occurrence of a key. Generate two occurrences per key, calling `BackendColumn.of()` with new arrays for every occurrence. 2. Populate an `IntersectionWrapper` from one pass, with a collision-free key extractor for this dataset, and call `proc()`. 3. Create a fresh second pass of those rows. Read `IntersectionFilterIterator(..., wrapper, 2)` to exhaustion; repeat using `UnionFilterIterator` with the existing BackendColumn serializer and name comparator. 4. Compare the result counts with the table above. Reusing the same Java object for repeated rows hides the defect. ### Relevant implementation - [BackendColumn equality and public byte arrays](https://github.com/apache/hugegraph/blob/5f70abee9e620950301477d1c9702a0a9b75ad1a/hugegraph-store/hg-store-rocksdb/src/main/java/org/apache/hugegraph/rocksdb/access/RocksDBSession.java#L1047-L1083) - [Real scan allocation](https://github.com/apache/hugegraph/blob/5f70abee9e620950301477d1c9702a0a9b75ad1a/hugegraph-store/hg-store-rocksdb/src/main/java/org/apache/hugegraph/rocksdb/access/RocksDBScanIterator.java#L168-L186) - [Intersection map counting](https://github.com/apache/hugegraph/blob/5f70abee9e620950301477d1c9702a0a9b75ad1a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/business/itrv2/IntersectionFilterIterator.java#L107-L137) - [Union map counting](https://github.com/apache/hugegraph/blob/5f70abee9e620950301477d1c9702a0a9b75ad1a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/business/itrv2/UnionFilterIterator.java#L88-L103) ### Focused follow-up Fix the stable map-key/equality contract and add regressions with a fresh object per scanned row. Explicitly preserve the intended identity rule: current BackendColumn equality compares name and value, while alternate union and sorted paths group by name. Adding a content hash alone must not be treated as proof that those grouping rules are equivalent. This predates PR #3395 and is tracked separately so its iterator probe/cleanup fixes need not grow in scope. [Original review discussion](https://github.com/apache/hugegraph/pull/3395#discussion_r4353907817). Issue search performed for BackendColumn/hashCode and UnionFilterIterator; no matching existing issue was found. -- 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]
