leonardBang commented on code in PR #18469:
URL: https://github.com/apache/flink/pull/18469#discussion_r924312328
##########
flink-connectors/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/dialect/mysql/MySqlDialect.java:
##########
@@ -126,4 +126,14 @@ public Set<LogicalTypeRoot> supportedTypes() {
LogicalTypeRoot.TIME_WITHOUT_TIME_ZONE,
LogicalTypeRoot.TIMESTAMP_WITHOUT_TIME_ZONE);
}
+
+ @Override
+ public String appendUrlSuffix(String url) {
+ String suffix = "rewriteBatchedStatements=true";
Review Comment:
This can be a constant with a meaningful note.
##########
flink-connectors/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/dialect/mysql/MySqlDialect.java:
##########
@@ -126,4 +126,14 @@ public Set<LogicalTypeRoot> supportedTypes() {
LogicalTypeRoot.TIME_WITHOUT_TIME_ZONE,
LogicalTypeRoot.TIMESTAMP_WITHOUT_TIME_ZONE);
}
+
+ @Override
+ public String appendUrlSuffix(String url) {
+ String suffix = "rewriteBatchedStatements=true";
+ if (url.contains("?")) {
+ return url + "&" + suffix;
Review Comment:
We should user's url `rewriteBatchedStatements=false` if the user configured
url contains `rewriteBatchedStatements=false` instead of use the default
property.
##########
flink-connectors/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/dialect/JdbcDialect.java:
##########
@@ -142,4 +142,14 @@ Optional<String> getUpsertStatement(
*/
String getSelectFromStatement(
String tableName, String[] selectFields, String[] conditionFields);
+
+ /**
+ * Some database need require additional JDBC options,such as MySQL require
+ * rewriteBatchedStatements=true to enable batch writing. Inspired by the
Alibaba DataX.
+ *
+ * @return A JDBC url.
+ */
+ default String appendUrlSuffix(String url) {
Review Comment:
how about `appendDefaultUrlProperties`?
--
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]