forked from apache/flink-cdc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FLINK-35647][route] Support symbol replacement to enrich routing rules
This closes apache#3428. Co-authored-by: 张田 <[email protected]> Co-authored-by: yangshuaitong <[email protected]>
- Loading branch information
1 parent
302a691
commit ad1f554
Showing
16 changed files
with
494 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
flink-cdc-cli/src/test/resources/definitions/pipeline-definition-full-with-repsym.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
################################################################################ | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
################################################################################ | ||
source: | ||
type: mysql | ||
name: source-database | ||
host: localhost | ||
port: 3306 | ||
username: admin | ||
password: pass | ||
tables: adb.*, bdb.user_table_[0-9]+, [app|web]_order_.* | ||
chunk-column: app_order_.*:id,web_order:product_id | ||
capture-new-tables: true | ||
|
||
sink: | ||
type: kafka | ||
name: sink-queue | ||
bootstrap-servers: localhost:9092 | ||
auto-create-table: true | ||
|
||
route: | ||
- source-table: mydb.default.app_order_.* | ||
sink-table: odsdb.default.app_order_<> | ||
replace-symbol: "<>" | ||
description: sync all sharding tables to one | ||
- source-table: mydb.default.web_order | ||
sink-table: odsdb.default.ods_web_order_>_< | ||
replace-symbol: ">_<" | ||
description: sync table to with given prefix ods_ | ||
|
||
transform: | ||
- source-table: mydb.app_order_.* | ||
projection: id, order_id, TO_UPPER(product_name) | ||
filter: id > 10 AND order_id > 100 | ||
primary-keys: id | ||
partition-keys: product_name | ||
table-options: comment=app order | ||
description: project fields from source table | ||
- source-table: mydb.web_order_.* | ||
projection: CONCAT(id, order_id) as uniq_id, * | ||
filter: uniq_id > 10 | ||
description: add new uniq_id for each row | ||
|
||
pipeline: | ||
name: source-database-sync-pipe | ||
parallelism: 4 | ||
schema.change.behavior: evolve | ||
schema-operator.rpc-timeout: 1 h |
36 changes: 36 additions & 0 deletions
36
flink-cdc-common/src/main/java/org/apache/flink/cdc/common/route/RouteRule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.flink.cdc.common.route; | ||
|
||
import java.io.Serializable; | ||
|
||
/** Definition of a routing rule with replacement symbol. */ | ||
public class RouteRule implements Serializable { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
public RouteRule(String sourceTable, String sinkTable, String replaceSymbol) { | ||
this.sourceTable = sourceTable; | ||
this.sinkTable = sinkTable; | ||
this.replaceSymbol = replaceSymbol; | ||
} | ||
|
||
public String sourceTable; | ||
public String sinkTable; | ||
public String replaceSymbol; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.