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


##########
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:
   Good catch, It should be expected an error from Paimon and the creation 
should failed. The IT test should cover this route.I have update the unit test 
to reflect the pass through mode.



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