rdblue commented on a change in pull request #1508: URL: https://github.com/apache/iceberg/pull/1508#discussion_r496938533
########## File path: spark2/src/main/java/org/apache/iceberg/spark/source/Reader.java ########## @@ -165,13 +165,23 @@ TableProperties.PARQUET_BATCH_SIZE, TableProperties.PARQUET_BATCH_SIZE_DEFAULT)); } + private Schema getTableSchema() { + if (snapshotId != null) { + return table.schemaForSnapshot(snapshotId); + } else if (asOfTimestamp != null) { + return table.schemaForSnapshotAsOfTime(asOfTimestamp); + } else { + return table.schema(); + } + } + private Schema lazySchema() { if (schema == null) { if (requestedSchema != null) { // the projection should include all columns that will be returned, including those only used in filters - this.schema = SparkSchemaUtil.prune(table.schema(), requestedSchema, filterExpression(), caseSensitive); + this.schema = SparkSchemaUtil.prune(getTableSchema(), requestedSchema, filterExpression(), caseSensitive); } else { - this.schema = table.schema(); + this.schema = getTableSchema(); Review comment: In addition to updates here, we will need to update schema handling in `BaseTableScan` so that the projection returned by the scan is based on the schema of the `Snapshot` that will be scanned. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org