zhupitertop opened a new pull request, #11413:
URL: https://github.com/apache/seatunnel/pull/11413
### Add a description
- Refactor HugeGraph sink to support multi-mapping (mappings array)
replacing single schema_config
- Add HugeGraph source connector with server-side paging, duplicate
filtering, and reserved graph columns
- Support VERTEX and EDGE (SINGLE / MULTIPLE + sortKeys) write modes
- Auto-chunk batches exceeding HugeGraph 500-record limit
- Shade and relocate Guava, Jackson, OkHttp, Okio, Javassist, Joda-Time
- Handle DATE properties returned as space-separated strings by HugeGraph
server
- Allow empty schema.fields for property-less labels in source
- Default dateFormat (yyyy-MM-dd) and timeZone (GMT+8) for sink mappings
- Improve error message when vertex/edge label does not exist
- Add unit tests for client, mappers, source reader, data type utils, and
config validation
- Add E2E tests for sink (IT) and source (SourceIT) with multi-mapping and
assert sinks
- Backward-compatible with legacy schema_config format
<!--
Thank you for contributing to SeaTunnel! Please make sure that your code
changes
are covered with tests. And in case of new features or big changes
remember to adjust the documentation.
Feel free to ping committers for the review!
## Contribution Checklist
- Make sure that the pull request corresponds to a [GITHUB
issue](https://github.com/apache/seatunnel/issues).
- Name the pull request in the form "[Feature] [component] Title of the
pull request", where *Feature* can be replaced by `Hotfix`, `Bug`, etc.
- Minor fixes should be named following this pattern: `[hotfix] [docs] Fix
typo in README.md doc`.
-->
### Purpose of this pull request
This PR adds a HugeGraph source connector and refactors the existing
HugeGraph sink connector to support multi-mapping configuration. The new
`mappings` array replaces the legacy single `schema_config`, allowing users to
write multiple vertex and edge labels in a single SeaTunnel job. The source
connector supports bounded full-label scans with server-side paging, automatic
duplicate filtering, and reserved graph columns (`~id`, `~label`, `~source_id`,
`~target_id`, etc.).
Related issue: https://github.com/apache/seatunnel/issues/151 (if applicable)
<!-- Describe the purpose of this pull request. For example: This pull
request adds checkstyle plugin.-->
### Does this PR introduce _any_ user-facing change?
Yes.
**Sink connector changes:**
Before (legacy `schema_config`):
```hocon
sink {
HugeGraph {
schema_config = {
type = "VERTEX"
label = "person"
idStrategy = "PRIMARY_KEY"
idFields = ["name"]
properties = ["name", "age"]
}
}
}
```
After (new `mappings` array, backward-compatible):
```hocon
sink {
HugeGraph {
mappings = [
{ type = "VERTEX"; label = "person"; idStrategy = "PRIMARY_KEY";
idFields = ["name"]; properties = ["name","age"] },
{ type = "EDGE"; label = "knows"; sourceConfig = { label = "person";
idFields = ["src"] }; targetConfig = { label = "person"; idFields = ["tgt"] } }
]
}
}
```
**New source connector:**
```hocon
source {
HugeGraph {
host = "localhost"; port = 8080; graph_name = "hugegraph"
label = "person"
schema = { fields { name = "string"; age = "int" } }
}
}
```
<!--
Note that it means *any* user-facing change including all aspects such as
the documentation fix.
If yes, please clarify the previous behavior and the change this PR proposes
- provide the console output, description and/or an example to show the
behavior difference if possible.
If possible, please also clarify if this is a user-facing change compared to
the released SeaTunnel versions or within the unreleased branches such as dev.
If no, write 'No'.
If you are adding/modifying connector documents, please follow our new
specifications: https://github.com/apache/seatunnel/issues/4544.
-->
### How was this patch tested?
**Unit tests (8 new test classes):**
- `HugeGraphClientTest` — client construction, URL building
- `HugeGraphSinkConfigTest` / `HugeGraphSourceConfigTest` — config validation
- `EdgeMapperTest` / `VertexMapperTest` — graph element mapping
- `HugeGraphSourceReaderTest` — paging, duplicate filtering, page boundary
handling
- `HugeGraphSourceFactoryTest` — factory creation
- `DataTypeUtilTest` — type conversion correctness
**E2E tests (2 test classes, 5 config scenarios):**
- `HugeGraphIT` — sink writer: vertex insert/update/delete, edge
insert/delete
- `HugeGraphSourceIT` — end-to-end pipeline: fake source → hugegraph sink →
hugegraph source → assert sink, covering vertex, edge, and multi-mapping fan-out
**Manual verification (13 scenarios, all passed):**
See test report document for full details. Key scenarios:
- 1M vertex bulk write with batch auto-chunking (A1/A2)
- Type normalization across int/long/float/double/date/binary/boolean (A3)
- Edge MULTIPLE + sortKeys for same-pair multi-edges (B1)
- Edge read-back with 6 reserved columns (B2)
- DATE round-trip with space-format server responses (B3)
- 1M vertex full-graph clone verification (B4)
- 4-writer concurrent write stress test (C1)
- PRIMARY_KEY / UUID / composite key strategies (C2)
- DELETE vertex cascading edge deletion (C4)
- Property-less label read (C5)
- Legacy schema_config backward compatibility (C6)
<!--
If tests were added, say they were added here. Please make sure to add some
test cases that check the changes thoroughly including negative and positive
cases if possible.
If it was tested in a way different from regular unit tests, please clarify
how you tested step by step, ideally copy and paste-able, so that other
reviewers can test and check, and descendants can verify in the future.
If tests were not added, please describe why they were not added and/or why
it was difficult to add.
If you are adding E2E test cases, maybe refer to
https://github.com/apache/seatunnel/blob/dev/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-cdc-mysql-e2e/src/test/resources/mysqlcdc_to_mysql.conf,
here is a good example.
-->
### Check list
* [x] If any new Jar binary package adding in your PR, please add License
Notice according
[New License
Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/developer/new-license.md)
* [x] If necessary, please update the documentation to describe the new
feature. https://github.com/apache/seatunnel/tree/dev/docs
- Updated `docs/en/connectors/sink/HugeGraph.md` and
`docs/zh/connectors/sink/HugeGraph.md`
- Added `docs/en/connectors/source/HugeGraph.md` and
`docs/zh/connectors/source/HugeGraph.md`
* [x] If necessary, please update `incompatible-changes.md` to describe the
incompatibility caused by this PR.
- Updated `docs/en/introduction/concepts/incompatible-changes.md` and
`docs/zh/introduction/concepts/incompatible-changes.md`
* [x] If you are contributing the connector code, please check that the
following files are updated:
1. [x] Update
[plugin-mapping.properties](https://github.com/apache/seatunnel/blob/dev/plugin-mapping.properties)
and add new connector information in it
2. [x] Update the pom file of
[seatunnel-dist](https://github.com/apache/seatunnel/blob/dev/seatunnel-dist/pom.xml)
3. [x] Add ci label in
[label-scope-conf](https://github.com/apache/seatunnel/blob/dev/.github/workflows/labeler/label-scope-conf.yml)
4. [x] Add e2e testcase in
[seatunnel-e2e](https://github.com/apache/seatunnel/tree/dev/seatunnel-e2e/seatunnel-connector-v2-e2e/)
5. [x] Update connector
[plugin_config](https://github.com/apache/seatunnel/blob/dev/config/plugin_config)
--
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]