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

   ## Purpose of the PR
   
   Found while scanning `hugegraph-struct` for small, test-backed fixes. No 
issue was filed; each fix comes with a unit test that fails on master.
   
   - `AnalyzerFactory.register` stored a name as given, while `analyzer()` 
lowercases the name before the lookup. An analyzer registered as `"MyAnalyzer"` 
(for example through `HugeGraphPlugin.registerAnalyzer`) could never be found: 
`Not exists analyzer: myanalyzer`.
   - `BinaryElementSerializer.edgeLabel(null, id, ...)` compared the label and 
sub-label ids with `!=`. They are separate `LongId` objects, so every edge 
decoded without a schema was marked `SUB` with itself as father. This path runs 
in the Store's `SortShuffleSerializer`. The father id equals the label id by 
value, so no edge id or encoded byte changes; only `edgeLabelType()`, 
`hasFather()` and `fatherId()` now report a normal label.
   - `DataType.valueToNumber` let `"NaN"`, `"Infinity"` and `"-Infinity"` 
through for non-number types, then threw `ClassCastException` (`TEXT`) or 
`AssertionError` (`BOOLEAN`). For numeric input on those types it already 
returned null. The only production caller checks `isNumber()` first, so this 
affects direct callers only.
   - `EdgeLabel.targetLabelName()` and `targetLabel(Id)` reported errors naming 
`sourceLabelName()` and "source label".
   
   ## Main Changes
   
   - `AnalyzerFactory.register`: lowercase the name, matching `analyzer()`. Two 
registrations that differ only in case now fail on the second call with `Exists 
analyzer`; before, the second one registered but could never be looked up.
   - `BinaryElementSerializer.edgeLabel`: compare the ids with `equals`.
   - `DataType.valueToNumber`: return null for every non-number type. Results 
for number types are unchanged.
   - `EdgeLabel`: fix the two copy-pasted messages.
   - Add `DataTypeTest` and `BinaryElementSerializerEdgeLabelTest`, and one 
test each in `AnalyzerFactoryTest` and `EdgeLabelMapTest`.
   
   ## 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:
       - On master code, one new test per fix fails: 
`testRegisteredMixedCaseNameIsFound` (`Not exists analyzer`), 
`testEdgeLabelWithoutSchemaKeepsNormalLabel`, 
`testValueToNumberReturnsNullForNonNumberTypes` (`ClassCastException`) and 
`testTargetLabelErrorsNameTheTargetSide` (message names `sourceLabelName()`). 
The other new tests guard behaviour that must not change: a real sub-label 
still gets `SUB` and its father, and number types still convert.
       - Ran on Linux x86_64, OpenJDK 17.0.20.1, Maven 3.8.7, 2026-11-07, at 
`2869208e2`:
         `mvn -ntp -B test -pl hugegraph-struct -am -Deditorconfig.skip=true`
         Result: BUILD SUCCESS, 142 tests, 0 failures, 0 errors, 0 skipped. 
Master runs 136 tests in this module. Surefire: `AnalyzerFactoryTest` 3, 
`BinaryElementSerializerEdgeLabelTest` 2, `EdgeLabelMapTest` 7, `DataTypeTest` 
2, all passed.
       - Downstream compile (Store core, HStore, dist, PD core): `mvn -ntp -B 
-q compile -pl 
hugegraph-store/hg-store-core,hugegraph-server/hugegraph-hstore,hugegraph-server/hugegraph-dist,hugegraph-pd/hg-pd-core
 -am -Deditorconfig.skip=true -Dmaven.javadoc.skip=true` exits 0.
       - `-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