rdblue commented on a change in pull request #1508:
URL: https://github.com/apache/iceberg/pull/1508#discussion_r698065821
##########
File path: spark3/src/main/java/org/apache/iceberg/spark/source/SparkTable.java
##########
@@ -113,14 +111,20 @@ public String name() {
return icebergTable.toString();
}
+ private Schema snapshotSchema() {
+ if (snapshotId != null && icebergTable instanceof BaseTable) {
+ return ((BaseTable) icebergTable).schemaForSnapshot(snapshotId);
+ } else if (asOfTimestamp != null && icebergTable instanceof BaseTable) {
+ return ((BaseTable)
icebergTable).schemaForSnapshotAsOfTime(asOfTimestamp);
+ } else {
+ return icebergTable.schema();
+ }
Review comment:
There are 4 copies of this logic. I think it would be good to put this
in a util class, like `SnapshotUtil`. Maybe name the method
`SnapshotUtil.schemaAsOf(Table, Snapshot)`
--
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]