Copilot commented on code in PR #8894:
URL: https://github.com/apache/gravitino/pull/8894#discussion_r2454528679


##########
server/src/main/java/org/apache/gravitino/server/web/rest/StatisticOperations.java:
##########
@@ -250,17 +250,14 @@ public Response listPartitionStatistics(
                   "Listing partition statistics is only supported for tables 
now.");
             }
 
-            if (fromPartitionName == null && toPartitionName == null) {
-              throw new IllegalArgumentException(
-                  "Both 'from' and 'to' parameters cannot be null at the same 
time.");
-            }
-
             MetadataObjectUtil.checkMetadataObject(metalake, object);
 
             PartitionRange range;
             PartitionRange.BoundType fromBoundType = 
getFromBoundType(fromInclusive);
             PartitionRange.BoundType toBoundType = 
getFromBoundType(toInclusive);

Review Comment:
   The method `getFromBoundType` is being used for both `fromBoundType` and 
`toBoundType`. The `toBoundType` should likely use a method like 
`getToBoundType` instead to correctly determine the boundary type for the upper 
bound.



##########
server/src/main/java/org/apache/gravitino/server/web/rest/StatisticOperations.java:
##########
@@ -250,17 +250,14 @@ public Response listPartitionStatistics(
                   "Listing partition statistics is only supported for tables 
now.");
             }
 
-            if (fromPartitionName == null && toPartitionName == null) {
-              throw new IllegalArgumentException(
-                  "Both 'from' and 'to' parameters cannot be null at the same 
time.");
-            }
-
             MetadataObjectUtil.checkMetadataObject(metalake, object);
 
             PartitionRange range;
             PartitionRange.BoundType fromBoundType = 
getFromBoundType(fromInclusive);
             PartitionRange.BoundType toBoundType = 
getFromBoundType(toInclusive);
-            if (fromPartitionName != null && toPartitionName != null) {
+            if (fromPartitionName == null && toPartitionName == null) {
+              range = PartitionRange.ALL_PARTITIONS;
+            } else if (fromPartitionName != null && toPartitionName != null) {

Review Comment:
   Missing handling for cases where only one of `fromPartitionName` or 
`toPartitionName` is null. The code should either handle these cases explicitly 
or throw an appropriate error, as the current logic will leave `range` 
uninitialized if only one parameter is null.



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