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

   - close #3013
   
     `Userdata.CREATE_TIME` (`"~create_time"`) is written as `java.util.Date`
     by `SchemaTransaction.setCreateTimeIfNeeded()`, then persisted through 
backend
     serializers as JSON. On reload, userdata is deserialized through raw
     `Map.class` paths, so Jackson cannot restore the value type and
     `schemaElement.userdata().get(Userdata.CREATE_TIME)` can come back as 
`String`.
   
     That breaks callers and existing tests that expect `~create_time` to keep 
the
     server-side `Date` contract after a schema is reloaded from backend 
storage.
   
     ## Main Changes
   
     - Added a single `SchemaElement.normalizeUserdataValue(key, value)` helper.
       - Converts `Userdata.CREATE_TIME` string values back with 
`DateUtil.parse(...)`.
       - Leaves existing `Date` values and all other userdata keys unchanged.
       - Throws a clearer `IllegalArgumentException` if a `~create_time` string 
is invalid.
   
     - Routed both userdata setters through the helper:
       - `userdata(String, Object)` covers serializer reload paths such as
         `TextSerializer`, `BinarySerializer`, `MysqlSerializer`, and
         `CassandraSerializer`.
       - `userdata(Userdata)` covers schema `fromMap()` hydration paths for
         `PropertyKey`, `VertexLabel`, `EdgeLabel`, and `IndexLabel`.
   
     - Added a null check to `userdata(Userdata)` for consistent argument 
validation.
   
     - Added regression coverage for schema userdata normalization and 
serializer
       round trips.
   
     This PR is intentionally limited to the server-side `SchemaElement`. The 
mirror
     class in `hugegraph-struct` has a similar userdata shape and can be 
handled in a
     separate follow-up PR.
   
     ## 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:
         - `SchemaElementTest` covers single-key normalization, bulk 
normalization,
           idempotency for `Date`, invalid `~create_time` strings, null bulk 
userdata,
           and non-`CREATE_TIME` keys.
         - 
`TextSerializerTest#testPropertyKeyUserdataCreateTimeRoundTripsAsDate`
           verifies the text serializer schema round trip keeps `CREATE_TIME` 
as `Date`.
         - 
`BinarySerializerTest#testPropertyKeyUserdataCreateTimeRoundTripsAsDate`
           verifies the binary serializer schema round trip keeps `CREATE_TIME` 
as `Date`.
         - The new test class is registered in `UnitTestSuite`.
   
     ## Does this PR potentially affect the following parts?
   
     - [ ]  Dependencies (add/update license 
(https://hugegraph.apache.org/docs/contribution-guidelines/contribute/#321-check-licenses)
 info & ../install-dist/scripts/dependency/regenerate_known_dependencies.sh)
     - [ ]  Modify configurations
     - [ ]  The public API
     - [ ]  Other affects (typed here)
     - [x]  Nope
   
     The public SchemaElement.userdata(...) signatures are unchanged. The 
behavior
     change is limited to internal userdata normalization for 
Userdata.CREATE_TIME.
   
     ## Documentation Status
   
     - [ ]  Doc - TODO
     - [ ]  Doc - Done
     - [x]  Doc - No Need
   
     ## Notes
   
     - This PR fixes the server-side schema reload path only.
     - `hugegraph-struct` appears to have the same raw userdata deserialization 
shape, but it is left for a separate follow-up to keep this PR focused on #3013.
     - The normalization helper stays key-specific because 
`Userdata.CREATE_TIME` is the only typed userdata value involved here.
   
   


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