lvyanquan commented on code in PR #3428:
URL: https://github.com/apache/flink-cdc/pull/3428#discussion_r1665772373
##########
flink-cdc-runtime/src/main/java/org/apache/flink/cdc/runtime/operators/schema/SchemaOperator.java:
##########
@@ -270,10 +276,18 @@ private RecordData regenerateRecordData(
private List<TableId> getRoutedTables(TableId originalTableId) {
return routes.stream()
.filter(route -> route.f0.isMatch(originalTableId))
- .map(route -> route.f1)
+ .map(route -> resolveReplacement(originalTableId, route))
.collect(Collectors.toList());
}
+ private TableId resolveReplacement(
+ TableId originalTable, Tuple3<Selectors, String, String> route) {
+ if (route.f2 != null) {
+ return TableId.parse(route.f1.replace(route.f2,
originalTable.getTableName()));
Review Comment:
Can we use Map<TableId, TableId> to reduce this replace and parse operation?
##########
docs/content/docs/core-concept/route.md:
##########
@@ -30,11 +30,12 @@ under the License.
# Parameters
To describe a route, the follows are required:
-| parameter | meaning |
optional/required |
-|--------------|----------------------------------------------------|-------------------|
-| source-table | Source table id, supports regular expressions | required
|
-| sink-table | Sink table id, supports regular expressions | required
|
-| description | Routing rule description(a default value provided) | optional
|
+| parameter | meaning |
optional/required |
+|----------------|----------------------------------------------------|-------------------|
+| source-table | Source table id, supports regular expressions |
required |
+| sink-table | Sink table id, supports regular expressions |
required |
+| replace-symbol | Special symbol in sink-table for pattern replacing |
optional |
Review Comment:
`and will be replaced by original table name`
--
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]