jackye1995 commented on code in PR #4517:
URL: https://github.com/apache/iceberg/pull/4517#discussion_r880652343
##########
spark/v3.2/spark/src/main/java/org/apache/iceberg/spark/source/SparkMicroBatchStream.java:
##########
@@ -111,7 +113,12 @@ public Offset latestOffset() {
}
Snapshot latestSnapshot = table.currentSnapshot();
- return new StreamingOffset(latestSnapshot.snapshotId(),
Iterables.size(latestSnapshot.addedFiles()), false);
+ long addedFilesCount =
PropertyUtil.propertyAsLong(latestSnapshot.summary(),
SnapshotSummary.ADDED_FILES_PROP, -1);
+ // If snapshotSummary doesn't have SnapshotSummary.ADDED_FILES_PROP,
iterate through addedFiles iterator to find
+ // addedFilesCount.
+ addedFilesCount = addedFilesCount == -1 ?
Iterables.size(latestSnapshot.addedFiles()) : addedFilesCount;
Review Comment:
ah I see, good point we cannot just put
`Iterables.size(latestSnapshot.addedFiles())` as the input to the last method
otherwise it will be evaluated.
--
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]