hililiwei commented on code in PR #7362:
URL: https://github.com/apache/iceberg/pull/7362#discussion_r1191189398


##########
flink/v1.17/flink/src/main/java/org/apache/iceberg/flink/source/ScanContext.java:
##########
@@ -149,12 +152,26 @@ private void validate() {
     }
 
     Preconditions.checkArgument(
-        !(startTag != null && startSnapshotId() != null),
-        "START_SNAPSHOT_ID and START_TAG cannot both be set.");
+        atMostOneNonNull(startSnapshotId(), startTag, 
startSnapshotTimestamp()),
+        "Cannot specify more than one of start-snapshot-id, start-tag, or 
start-snapshot-timestamp.");
 
     Preconditions.checkArgument(
-        !(endTag != null && endSnapshotId() != null),
-        "END_SNAPSHOT_ID and END_TAG cannot both be set.");
+        atMostOneNonNull(endSnapshotId(), endTag, endSnapshotTimestamp()),
+        "Cannot specify more than one of end-snapshot-id, end-tag, or 
end-snapshot-timestamp.");
+  }
+
+  private static boolean atMostOneNonNull(Object... objects) {

Review Comment:
   Yes, this is more concise. In terms of performance, I think the new way is 
acceptable.
   Done.



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