JNSimba commented on code in PR #288:
URL:
https://github.com/apache/doris-flink-connector/pull/288#discussion_r1445552629
##########
flink-doris-connector/src/main/java/org/apache/doris/flink/catalog/doris/DorisSystem.java:
##########
@@ -199,11 +200,31 @@ public static String buildCreateTableDDL(TableSchema
schema) {
// append distribute key
sb.append(" DISTRIBUTED BY HASH(")
.append(String.join(",",
identifier(schema.getDistributeKeys())))
- .append(") BUCKETS AUTO ");
+ .append(")");
+ Map<String, String> properties = schema.getProperties();
+ if (properties.containsKey(TABLE_BUCKETS)) {
+ try {
+ int bucketsNum =
Integer.parseInt(properties.get(TABLE_BUCKETS));
+ if (bucketsNum <= 0) {
+ throw new CreateTableException("The number of buckets must
be positive.");
+ }
+ sb.append(" BUCKETS ").append(bucketsNum);
+ } catch (NumberFormatException e) {
+ throw new CreateTableException("The number of buckets must be
an integer.");
+ }
+ } else {
+ sb.append(" BUCKETS AUTO ");
+ }
// append properties
int index = 0;
- for (Map.Entry<String, String> entry :
schema.getProperties().entrySet()) {
+ int skipProNum = 0;
+ for (Map.Entry<String, String> entry : properties.entrySet()) {
+ // skip table-buckets
+ if (entry.getKey().contains(TABLE_BUCKETS)) {
Review Comment:
Can we use this as a prefix and then define different buckets to support
different tables?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]