wypoon commented on a change in pull request #1508:
URL: https://github.com/apache/iceberg/pull/1508#discussion_r702206123



##########
File path: spark2/src/main/java/org/apache/iceberg/spark/source/Reader.java
##########
@@ -152,20 +153,30 @@
       this.localityPreferred = false;
     }
 
-    this.schema = table.schema();
+    this.schema = snapshotSchema();
     this.caseSensitive = caseSensitive;
     this.batchSize = 
options.get(SparkReadOptions.VECTORIZATION_BATCH_SIZE).map(Integer::parseInt).orElseGet(()
 ->
         PropertyUtil.propertyAsInt(table.properties(),
           TableProperties.PARQUET_BATCH_SIZE, 
TableProperties.PARQUET_BATCH_SIZE_DEFAULT));
   }
 
+  protected Schema snapshotSchema() {
+    if (snapshotId != null && table instanceof BaseTable) {

Review comment:
       Yes, I'll follow your suggestion so we don't need to change `BaseTable`.
   Also, as you point out below, this same code appears in several places. I'll 
put it in a util method.




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