vaidikgarg-bit opened a new issue, #3415:
URL: https://github.com/apache/hugegraph/issues/3415

   ### Bug Type (问题类型)
   
   logic (逻辑设计问题)
   
   ### Environment (环境信息)
   
   - Server Version: `master` at `9a8f066e6` (1.8.0-SNAPSHOT)
   - Backend: HStore (Store query service, `AggregativeQueryObserver`)
   - JDK 17
   
   ### Expected & Actual behavior (期望与实际表现)
   
   A Store query with `dedup_option` set to `DEDUP` or `LIMIT_DEDUP` (or 
`PRECISE_DEDUP` with a limit) should return every distinct row once, regardless 
of how the results are split into batches. Instead, rows go missing at each 
batch boundary.
   
   `AggregativeQueryObserver.readBatchData` probes the iterator more than once 
per row:
   
   - the read loop calls `itr.hasNext()` before it checks `count >= batchSize`, 
so at a full batch it breaks after a probe without calling `next()`;
   - after the loop it calls `itr.hasNext()` again to set `finish`.
   
   `UnionFilterIterator` and `IntersectionFilterIterator` keep a pending 
element across repeated probes (#3395 added `FilterIteratorContractTest` for 
that). The three dedup iterators `BusinessHandlerImpl` builds for these options 
do not:
   
   - `MapLimitIterator` (LIMIT_DEDUP, and PRECISE_DEDUP with a limit)
   - `InAccurateUnionFilterIterator` (DEDUP)
   - `InAccurateIntersectionIterator` (multi-param index intersection)
   
   Each `hasNext()` starts with `current = null` and pulls the next unseen row 
from the source. The row found by the previous probe is already in the dedup 
set or bitmap, so it is never returned.
   
   Reproduction: add the three iterators to 
`FilterIteratorContractTest.assertSingleRecordBatches` (batch size 1, three 
distinct keys). On `master` each returns 2 records instead of 3.
   
   The same tests show the iterators also miss the rest of that contract:
   - after `close()` they still probe the closed source;
   - `MapLimitIterator.next()` returns `null` instead of throwing 
`NoSuchElementException` when nothing is left.
   
   Only a gRPC client that sets `dedup_option` reaches these paths today, since 
`StoreQueryParam` fixes it to `NONE`.
   
   I found this while reading the query path around #3408 and would like to 
work on it: keep the pending element across probes, clear it in `next()`, and 
make `close()` stop further probing, with the three iterators added to 
`FilterIteratorContractTest`.
   


-- 
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]

Reply via email to