darkyellowcat opened a new pull request, #902:
URL: https://github.com/apache/hugegraph-toolchain/pull/902

   ## Purpose of the PR
   
   - close #901
   
   `DataTypeUtil.splitField()` currently assumes that every `Collection` is 
also a `List` and performs an unchecked cast. However, implementations such as 
`HashSet`, `LinkedHashSet`, and Guava's `ImmutableSet` do not implement `List`, 
resulting in a `ClassCastException`.
   
   This PR fixes the issue by handling non-List collections correctly.
   
   ## Main Changes
   
   - Preserve the original behavior for `List` inputs, returning the original 
list.
   - Convert other `Collection` implementations into `ArrayList` to avoid 
`ClassCastException`.
   - Preserve iteration order for ordered collections.
   - Add unit tests covering:
     - `LinkedHashSet`
     - `HashSet`
     - Guava `ImmutableSet`
     - Empty collections
   
   ## Verifying these changes
   
   - [ ] Trivial rework / code cleanup without any test coverage. (No Need)
   - [ ] Already covered by existing tests.
   - [x] Need tests and can be verified as follows:
     - `DataTypeUtilTest`: 18 tests passed, 0 failures, 0 errors.
     - Added test cases for different `Collection` implementations and empty 
collections.
   
   ## Does this PR potentially affect the following parts?
   
   - [x] Nope
   - [ ] Dependencies (add/update license info)
   - [ ] Modify configurations
   - [ ] The public API
   - [ ] Other affects (typed here)
   
   ## Documentation Status
   
   - [ ] `Doc - TODO`
   - [ ] `Doc - Done`
   - [x] `Doc - No Need`


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