XenosK commented on code in PR #7840: URL: https://github.com/apache/seatunnel/pull/7840#discussion_r1843262081
########## seatunnel-connectors-v2/connector-cdc/connector-cdc-base/src/main/java/org/apache/seatunnel/connectors/cdc/base/source/enumerator/splitter/AbstractJdbcSourceChunkSplitter.java: ########## @@ -379,12 +383,41 @@ protected SnapshotSplit createSnapshotSplit( protected Column getSplitColumn( JdbcConnection jdbc, JdbcDataSourceDialect dialect, TableId tableId) throws SQLException { - Optional<PrimaryKey> primaryKey = dialect.getPrimaryKey(jdbc, tableId); Column splitColumn = null; + Table table = dialect.queryTableSchema(jdbc, tableId).getTable(); + + // first , compare user defined split column is in the primary key or unique key + Map<String, String> splitColumnsConfig = new HashMap<>(); + try { + splitColumnsConfig = sourceConfig.getSplitColumn(); + } catch (Exception e) { + log.error("Config snapshot.split.column get exception in {}:{}", tableId, e); + } + String tableSc = + splitColumnsConfig.getOrDefault(tableId.catalog() + "." + tableId.table(), null); + + if (StringUtils.isNotEmpty(tableSc)) { + boolean isUniqueKey = dialect.isUniqueKey(jdbc, tableId, tableSc); Review Comment: > The above is pseudo code > > this method `getUniqueKeys ` return `List<ConstraintKey>`... done @hailin0 -- 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: commits-unsubscr...@seatunnel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org