TimothyDing commented on code in PR #9963:
URL: https://github.com/apache/gravitino/pull/9963#discussion_r2838937646


##########
common/src/main/java/org/apache/gravitino/json/JsonUtils.java:
##########
@@ -1319,7 +1319,9 @@ public DistributionDTO deserialize(JsonParser p, 
DeserializationContext ctxt)
         String strategy = getString(STRATEGY, node);
         builder.withStrategy(Strategy.getByName(strategy));
       }
-      builder.withNumber(getInt(NUMBER, node));
+      if (node.has(NUMBER)) {

Review Comment:
   @yuqi1129 
   Yes, this is a pre-existing bug. When deserializing a DistributionDTO from 
JSON, the original code unconditionally calls getInt(NUMBER, node), which 
throws an exception if the number field is absent from the payload.In Hologres, 
hash distribution only requires specifying distribution_key columns — the 
number of buckets is managed internally by the engine and is not 
user-configurable. So when creating a table via the REST API, the distribution 
JSON naturally omits the number field, triggering the deserialization 
failure.This fix makes the number field optional (guarded by node.has(NUMBER)), 
which is backward-compatible — existing requests that include number still work 
as before. This bug could also affect other catalog implementations that use 
distribution without an explicit bucket count.



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