xndai commented on code in PR #17360:
URL: https://github.com/apache/iceberg/pull/17360#discussion_r3650599197


##########
core/src/main/java/org/apache/iceberg/util/SnapshotUtil.java:
##########
@@ -390,9 +390,12 @@ public static long snapshotIdAsOfTime(Table table, long 
timestampMillis) {
 
   public static Long nullableSnapshotIdAsOfTime(Table table, long 
timestampMillis) {
     Long snapshotId = null;
+    long bestTimestamp = Long.MIN_VALUE;
     for (HistoryEntry logEntry : table.history()) {
-      if (logEntry.timestampMillis() <= timestampMillis) {
+      if (logEntry.timestampMillis() <= timestampMillis
+          && logEntry.timestampMillis() > bestTimestamp) {

Review Comment:
   it doesn't really matter. In this implementation the first snapshot appears 
in the chain would be picked. Since this is something undefined by the spec, I 
feel it's ok to have such behavior.



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