This is an automated email from the ASF dual-hosted git repository.
kerwin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-paimon.git
The following commit(s) were added to refs/heads/master by this push:
new 8cfe1204e [cdc] Fix that MySqlSyncTableActionFactory handles
METADATA_COLUMN in different way with MySqlSyncDatabaseActionFactory (#2782)
8cfe1204e is described below
commit 8cfe1204e2f7bcdb6919c2a34b3d7b73381853ad
Author: yuzelin <[email protected]>
AuthorDate: Wed Jan 24 20:03:02 2024 +0800
[cdc] Fix that MySqlSyncTableActionFactory handles METADATA_COLUMN in
different way with MySqlSyncDatabaseActionFactory (#2782)
---
docs/layouts/shortcodes/generated/mysql_sync_table.html | 2 +-
.../paimon/flink/action/cdc/SyncTableActionFactoryBase.java | 11 ++++++++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/docs/layouts/shortcodes/generated/mysql_sync_table.html
b/docs/layouts/shortcodes/generated/mysql_sync_table.html
index 85ee1a5b3..cce81be60 100644
--- a/docs/layouts/shortcodes/generated/mysql_sync_table.html
+++ b/docs/layouts/shortcodes/generated/mysql_sync_table.html
@@ -67,7 +67,7 @@ under the License.
</tr>
<tr>
<td><h5>--metadata_column</h5></td>
- <td>--metadata_column is used to specify which metadata columns to
include in the output schema of the connector. Metadata columns provide
additional information related to the source data, for example:
--metadata_column table_name --metadata_column database_name --metadata_column
op_ts. See its <a
href="https://ververica.github.io/flink-cdc-connectors/master/content/connectors/mysql-cdc.html#available-metadata">document</a>
for a complete list of available metadata.</td>
+ <td>--metadata_column is used to specify which metadata columns to
include in the output schema of the connector. Metadata columns provide
additional information related to the source data, for example:
--metadata_column table_name,database_name,op_ts. See its <a
href="https://ververica.github.io/flink-cdc-connectors/master/content/connectors/mysql-cdc.html#available-metadata">document</a>
for a complete list of available metadata.</td>
</tr>
<tr>
<td><h5>--mysql_conf</h5></td>
diff --git
a/paimon-flink/paimon-flink-cdc/src/main/java/org/apache/paimon/flink/action/cdc/SyncTableActionFactoryBase.java
b/paimon-flink/paimon-flink-cdc/src/main/java/org/apache/paimon/flink/action/cdc/SyncTableActionFactoryBase.java
index b2c145f47..17edc0124 100644
---
a/paimon-flink/paimon-flink-cdc/src/main/java/org/apache/paimon/flink/action/cdc/SyncTableActionFactoryBase.java
+++
b/paimon-flink/paimon-flink-cdc/src/main/java/org/apache/paimon/flink/action/cdc/SyncTableActionFactoryBase.java
@@ -25,6 +25,8 @@ import
org.apache.paimon.flink.action.MultipleParameterToolAdapter;
import org.apache.flink.api.java.tuple.Tuple3;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
import java.util.Map;
import java.util.Optional;
@@ -75,7 +77,14 @@ public abstract class SyncTableActionFactoryBase implements
ActionFactory {
}
if (params.has(METADATA_COLUMN)) {
- action.withMetadataColumns(new
ArrayList<>(params.getMultiParameter(METADATA_COLUMN)));
+ List<String> metadataColumns =
+ new ArrayList<>(params.getMultiParameter(METADATA_COLUMN));
+ if (metadataColumns.size() == 1) {
+
action.withMetadataColumns(Arrays.asList(metadataColumns.get(0).split(",")));
+ } else {
+ action.withMetadataColumns(
+ new
ArrayList<>(params.getMultiParameter(METADATA_COLUMN)));
+ }
}
if (params.has(TYPE_MAPPING)) {