You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "1996fanrui (via GitHub)" <gi...@apache.org> on 2024/05/27 03:52:40 UTC
Re: [PR] [FLINK-34901][connectors/jdbc]Update clause must EXCLUDED unique index. [flink-connector-jdbc]
1996fanrui commented on code in PR #108:
URL: https://github.com/apache/flink-connector-jdbc/pull/108#discussion_r1615442044
##########
flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/dialect/AbstractPostgresCompatibleDialect.java:
##########
@@ -50,12 +50,14 @@ public String getLimitClause(long limit) {
@Override
public Optional<String> getUpsertStatement(
String tableName, String[] fieldNames, String[] uniqueKeyFields) {
+ Set<String> uniqueKeyFieldsSet = Arrays.stream(uniqueKeyFields).collect(Collectors.toSet());
String uniqueColumns =
- Arrays.stream(uniqueKeyFields)
+ uniqueKeyFieldsSet.stream()
.map(this::quoteIdentifier)
.collect(Collectors.joining(", "));
String updateClause =
Arrays.stream(fieldNames)
+ .filter(f -> !uniqueKeyFieldsSet.contains(f))
Review Comment:
I'm curious is this a bug or performance improvement?
Also cc @RocMarshal , would you mind reviewing this PR as well (as you are the active contributor of jdbc connector)?
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org