bosprimigenious opened a new pull request, #904:
URL: https://github.com/apache/hugegraph-toolchain/pull/904
Closes #901.
## Problem
`DataTypeUtil.splitField` assumed every `Collection` is a `List`:
```java
if (rawColumnValue instanceof Collection) {
return (List<Object>) rawColumnValue; // Set -> ClassCastException
}
```
A `Set` (e.g. a multi-value loader field materialised as `LinkedHashSet`)
therefore fails before the value can be split, exactly as reported.
## Fix
- `List` inputs are returned unchanged, so the existing behaviour (and the
`assertSame` test) is preserved.
- Any other `Collection` is copied into an `ArrayList`, which keeps the
iteration order of ordered collections such as `LinkedHashSet` and no longer
casts a `Set` to `List`.
- All other paths (single value, string split via `ListFormat`) are
untouched.
## Tests
Extended `DataTypeUtilTest.testSplitField`:
- `LinkedHashSet("a","b")` → `["a","b"]` (order preserved)
- `HashSet("x")` → `["x"]`
- existing cases still pass: `ImmutableList` returned as the same instance,
`"a|b"` split to `["a","b"]`, `null` rejected
I did not run Maven locally (no JDK in my environment); the CI build is the
verification for this one.
--
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]