FANNG1 commented on code in PR #10721:
URL: https://github.com/apache/gravitino/pull/10721#discussion_r3180677563


##########
flink-connector/flink/src/main/java/org/apache/gravitino/flink/connector/paimon/GravitinoPaimonCatalog.java:
##########
@@ -77,4 +90,93 @@ public void dropTable(ObjectPath tablePath, boolean 
ignoreIfNotExists)
   public Optional<Factory> getFactory() {
     return Optional.of(new FlinkTableFactory());
   }
+
+  @Override
+  protected Distribution toGravitinoDistribution(Map<String, String> 
properties) {
+    return getDistribution(properties);
+  }
+
+  @Override
+  protected Map<String, String> fromGravitinoDistribution(Distribution 
distribution) {
+    return distributionToProperties(distribution);
+  }
+
+  @VisibleForTesting
+  static Map<String, String> distributionToProperties(Distribution 
distribution) {
+    if (distribution == null || distribution.strategy() == Strategy.NONE) {
+      return new HashMap<>();
+    }
+    Map<String, String> properties = new HashMap<>();
+    int number = distribution.number();
+    Expression[] expressions = distribution.expressions();
+    boolean hasExpressions = expressions != null && expressions.length > 0;
+
+    if (number == Distributions.AUTO && !hasExpressions) {
+      return properties;
+    }
+
+    // Paimon does not allow 'bucket-key' with bucket=-1 (dynamic mode).
+    if (number != Distributions.AUTO && hasExpressions) {

Review Comment:
   could we remove the number check from `if (number != Distributions.AUTO && 
hasExpressions) `? 



-- 
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]

Reply via email to