kennknowles commented on code in PR #34856:
URL: https://github.com/apache/beam/pull/34856#discussion_r2076075983


##########
sdks/java/io/iceberg/src/main/java/org/apache/beam/sdk/io/iceberg/IcebergScanConfig.java:
##########
@@ -204,13 +233,33 @@ public Builder setTableIdentifier(String... names) {
 
     public abstract Builder setBranch(@Nullable String branch);
 
+    public abstract Builder setKeepFields(@Nullable List<String> fields);
+
+    public abstract Builder setDropFields(@Nullable List<String> fields);
+
     public abstract IcebergScanConfig build();
   }
 
   @VisibleForTesting
   abstract Builder toBuilder();
 
   void validate(Table table) {
+    @Nullable List<String> keep = getKeepFields();
+    @Nullable List<String> drop = getDropFields();
+    if (keep != null || drop != null) {
+      checkArgument(
+          keep == null || drop == null, error("only one of 'keep' or 'drop' 
can be set."));
+      Set<String> fieldsSpecified = Sets.newHashSet(checkNotNull(drop != null 
? drop : keep));

Review Comment:
   Readability nit: I honestly think just duping the code is easier to read. 
Since you have already done the `checkArgument`, just
   
   ```java
   if (keep == null) {
     fieldsSpecified = all the fields
   } else {
     fieldsSpecified = keep
   }
   
   if (drop != null) {
     fieldsSpecified = fieldsSpecified setminus drop
   }
   ```



-- 
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: github-unsubscr...@beam.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to