bitflicker64 opened a new pull request, #3464:
URL: https://github.com/apache/hugegraph/pull/3464

   ## Purpose of the PR
   
   Found while scanning `hugegraph-store` for small, test-backed fixes. No 
issue was filed; each fix comes with a unit test that fails on master.
   
   - `StreamFinalAggregationIterator.hasNext()` always read on from the source. 
A second `hasNext()` before `next()` replaced the pending group with the 
following one, so that group was lost from the aggregation result.
   - `MapUnionIterator` and `MapJoinIterator` built their result iterator only 
inside `hasNext()`, so calling `next()` first threw `NullPointerException`.
   - `MultiKv.compareTo` tested `o == null` where it meant `o.keys == null`, so 
two rows with null keys compared as -1 in both directions, which breaks the 
`Comparable` contract used by `OrderByStage` and `SortShuffle`.
   - `HgPair.hashCode()` threw `NullPointerException` for a null key, while 
`equals()` handles null.
   - `KvBatchUtil` reported an empty prefix list in `PREFIX` mode as an invalid 
start-list.
   
   ## Main Changes
   
   - `StreamFinalAggregationIterator.hasNext()`: return `true` while a group is 
pending.
   - `MapUnionIterator.next()` / `MapJoinIterator.next()`: build the result 
iterator if `hasNext()` has not done it yet.
   - `MultiKv.compareTo`: compare `o.keys` with null.
   - `HgPair.hashCode()`: use `Objects.hashCode(key)`; hash values for non-null 
keys are unchanged.
   - `KvBatchUtil`: name the prefix list in that error message.
   - One new test per fix in classes already registered in the store suites: 
`HgPairTest` (`CommonSuiteTest`), `MultiStreamIteratorTest` and 
`KvPageScannerTest` (`ClientSuiteTest`), `SortShuffleTest` and 
`UnionFilterIteratorTest` (`CoreSuiteTest`). No suite file changes.
   
   No public or protected signature, stored or gRPC format, config key or lock 
changes.
   
   ## 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:
       - Ran on Linux x86_64, OpenJDK 17.0.20.1, Maven 3.8.7, 2026-11-07.
       - Before the fix (tests added, production code as on master), running 
the five test classes with `-Dtest=...` in their profiles: `HgPairTest` 
NullPointerException (`"this.key" is null`), `SortShuffleTest` `expected:<0> 
but was:<-1>`, `MultiStreamIteratorTest` `expected:<[a]> but was:<[b]>`, 
`UnionFilterIteratorTest` NullPointerException (`"this.iterator" is null`) for 
both iterators, `KvPageScannerTest` message `The [start]-list ...` instead of 
`The [prefix]-list ...`.
       - With the fix, full suites at `9a4a134ba`:
         `mvn -ntp -B test -pl hugegraph-store/hg-store-test -am -P 
store-common-test -Deditorconfig.skip=true -Dmaven.javadoc.skip=true`: 
`CommonSuiteTest` 15 tests, 0 failures.
         `mvn -ntp -B test -pl hugegraph-store/hg-store-test -am -P 
store-client-test -Deditorconfig.skip=true -Dmaven.javadoc.skip=true`: 
`ClientSuiteTest` 105 tests, 0 failures.
         `mvn -ntp -B test -pl hugegraph-store/hg-store-test -am -P 
store-core-test -Deditorconfig.skip=true -Dmaven.javadoc.skip=true`: 
`CoreSuiteTest` 116 tests, 0 failures; 221 tests in the profile, 0 failures, 1 
skipped.
       - `-Deditorconfig.skip=true` is there because master fails the 
editorconfig check on `helm/hugegraph/docs/rag.md` (missing final newline), a 
file this PR does not touch.
   
   ## Does this PR potentially affect the following parts?
   
   - [ ]  Dependencies ([add/update 
license](https://hugegraph.apache.org/docs/contribution-guidelines/contribute/#321-check-licenses)
 info & 
[regenerate_known_dependencies.sh](../install-dist/scripts/dependency/regenerate_known_dependencies.sh))
   - [ ]  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]

Reply via email to