syun64 commented on issue #6978:
URL: https://github.com/apache/iceberg/issues/6978#issuecomment-1450898243

   Adding these conditions to these two locations in SparkTable.java fixes the 
issue:
   
   
https://github.com/apache/iceberg/blob/master/spark/v3.1/spark/src/main/java/org/apache/iceberg/spark/source/SparkTable.java#L201
   ```
     @Override
     public ScanBuilder newScanBuilder(CaseInsensitiveStringMap options) {
       if (options.containsKey(SparkReadOptions.FILE_SCAN_TASK_SET_ID)) {
         // skip planning the job and fetch already staged file scan tasks
         return new SparkFilesScanBuilder(sparkSession(), icebergTable, 
options);
       }
   
       if (refreshEagerly) {
         icebergTable.refresh();
       }
   
       CaseInsensitiveStringMap scanOptions = addSnapshotId(options, 
snapshotId);
       if (icebergTable instanceof BaseMetadataTable) {
         return new SparkScanBuilder(sparkSession(), icebergTable, options);
       } else {
         return new SparkScanBuilder(sparkSession(), icebergTable, 
snapshotSchema(), scanOptions);
       }
     }
   ```
   
https://github.com/apache/iceberg/blob/master/spark/v3.1/spark/src/main/java/org/apache/iceberg/spark/source/SparkTable.java#L133
   
   
   ```
     @Override
     public StructType schema() {
       if (lazyTableSchema == null) {
         if (icebergTable instanceof BaseMetadataTable) {
           this.lazyTableSchema = 
SparkSchemaUtil.convert(icebergTable.schema());
         } else {
           this.lazyTableSchema = SparkSchemaUtil.convert(snapshotSchema());
         }
       }
   
       return lazyTableSchema;
     }
   ```


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