Hisoka-X commented on code in PR #6679:
URL: https://github.com/apache/seatunnel/pull/6679#discussion_r1561890807
##########
seatunnel-connectors-v2/connector-doris/src/main/java/org/apache/seatunnel/connectors/doris/util/DorisCatalogUtil.java:
##########
@@ -153,6 +162,12 @@ public static String getCreateTableStatement(
rowTypeFields);
}
+ private static boolean canHandledByDefaultTemplate(String createTemplate,
String primaryKey) {
+ return StringUtils.equals(
+ createTemplate,
DorisOptions.SAVE_MODE_CREATE_TEMPLATE.defaultValue())
+ && StringUtils.isBlank(primaryKey);
+ }
Review Comment:
I thought about it again, whether this kind of check is too rigid, and its
useful scenarios are very limited. We can predict whether the spliced SQL will
be abnormal by checking whether the placeholders and corresponding values used
in the template exist. For example, by default template, we know that the
primarykeys information needs to be used by scanning the template, but the
primarykeys information is not found, then we can throw an exception.
```java
private static boolean canHandledByDefaultTemplate(String
createTemplate, String primaryKey) {
if (createTemplate.contains(String.format("\\$\\{%s\\}",
SaveModeConstants.ROWTYPE_PRIMARY_KEY)) && StringUtils.isEmpty(primaryKey)) {
throw exception;
}
.... same for uniqueKeys
}
```
--
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]