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

   ## Purpose of the PR
   
   Found while scanning `hugegraph-struct` for small, test-backed fixes. No 
issue was filed; each bug below is shown by a new unit test that fails on 
master.
   
   `ConditionQuery` is encoded by the Server (`HstoreTable`) and decoded by the 
Store before it filters rows, so a decoding bug changes query results.
   
   - `QueryAdapter` turned every string value `"OUT"` or `"IN"` into a 
`Directions` enum on decode, whatever the relation key was. A user-property 
condition such as `has(p, "OUT")` reached the Store with an enum value and 
never matched, and `textContains(p, "IN")` threw `Can't test 'IN'(Directions) 
for textcontains, expect String`. A schema name `"IN"` hit the same path.
   - Encoding a relation whose `IN` list was empty threw 
`IndexOutOfBoundsException` while reading the element class.
   - `unsetCondition`, `resetUserpropConditions` and `removeCondition` threw 
`UnsupportedOperationException` on a query with no conditions, because the 
shared empty list is an immutable Guava list. On a query that has conditions 
but not the key, the same calls are no-ops.
   
   ## Main Changes
   
   - `QueryAdapter.deserialize`: map `"OUT"` and `"IN"` back to `Directions` 
only when the relation key is `HugeKeys.DIRECTION`, the only key that carries a 
`Directions` value.
   - `QueryAdapter.serialize`: skip the `valuecls` hint for an empty list. The 
decoder already reads a list without the hint back as an empty list, so an 
older Store reads the new form too.
   - `ConditionQuery`: return early from the three removal methods while the 
query still holds the shared empty list.
   - Add `ConditionQueryCodecTest`.
   
   The JSON for every input that encoded before is unchanged.
   
   ## 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:
       - `ConditionQueryCodecTest` adds 8 tests. On master code, 7 fail: three 
show the `Directions` value, one shows the `IndexOutOfBoundsException` and 
three show the `UnsupportedOperationException`. The eighth checks that a 
`DIRECTION` relation still decodes to `Directions.OUT` and `Directions.IN`.
       - Ran on Linux x86_64, OpenJDK 17.0.20.1, Maven 3.8.7, 2026-11-07, at 
`96ed9ba6f`:
         `mvn -ntp -B test -pl hugegraph-struct -am -Deditorconfig.skip=true`
         Result: BUILD SUCCESS, 144 tests, 0 failures, 0 errors, 0 skipped. 
Master runs 136 tests in this module. Surefire: `ConditionQueryCodecTest` 8 
run, 0 failed.
       - 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