wypoon commented on code in PR #7744:
URL: https://github.com/apache/iceberg/pull/7744#discussion_r1239067224


##########
core/src/main/java/org/apache/iceberg/DataFiles.java:
##########
@@ -248,6 +268,16 @@ public Builder withPartitionPath(String newPartitionPath) {
       return this;
     }
 
+    public Builder withPartitionValues(List<String> partitionValues) {
+      Preconditions.checkArgument(
+          isPartitioned || partitionValues.isEmpty(),
+          "Cannot add partition data for an unpartitioned table");
+      if (!partitionValues.isEmpty()) {

Review Comment:
   Do you mean `partitionValues.isEmpty()` can never be true logically? Or it 
is never true because `withPartitionValues` is never called with an empty 
`partitionValues`?
   If the latter, that is because I'm the only one who has written code calling 
`withPartitionValues` but there is nothing to stop future callers from calling 
it with empty `partitionValues`.
   I copied the code from the existing `withPartitionPath`. Perhaps the `if` in 
both methods is overkill and protects against calls that don't exist (but in 
principle could occur).
   In principle, `isPartitioned` could be true and `withPartitionValues` be 
called with empty `partitionValues`. Then the `Preconditions.checkArgument` 
would pass and the condition in the `if` would be false.



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

Reply via email to