szehon-ho commented on a change in pull request #4243:
URL: https://github.com/apache/iceberg/pull/4243#discussion_r825142950



##########
File path: core/src/main/java/org/apache/iceberg/DataFilesTable.java
##########
@@ -47,115 +36,32 @@
 
   @Override
   public TableScan newScan() {
-    return new FilesTableScan(operations(), table(), schema());
-  }
-
-  @Override
-  public Schema schema() {
-    StructType partitionType = Partitioning.partitionType(table());
-    Schema schema = new Schema(DataFile.getType(partitionType).fields());
-    if (partitionType.fields().size() < 1) {
-      // avoid returning an empty struct, which is not always supported. 
instead, drop the partition field
-      return TypeUtil.selectNot(schema, 
Sets.newHashSet(DataFile.PARTITION_ID));
-    } else {
-      return schema;
-    }
+    return new DataFilesTableScan(operations(), table(), schema());
   }
 
   @Override
   MetadataTableType metadataTableType() {
     return MetadataTableType.FILES;
   }
 
-  public static class FilesTableScan extends BaseMetadataTableScan {
-    private final Schema fileSchema;
+  public static class DataFilesTableScan extends BaseFilesTableScan {
 
-    FilesTableScan(TableOperations ops, Table table, Schema fileSchema) {
-      super(ops, table, fileSchema);
-      this.fileSchema = fileSchema;
+    DataFilesTableScan(TableOperations ops, Table table, Schema fileSchema) {
+      super(ops, table, fileSchema, MetadataTableType.FILES);
     }
 
-    private FilesTableScan(TableOperations ops, Table table, Schema schema, 
Schema fileSchema,
-                           TableScanContext context) {
-      super(ops, table, schema, context);
-      this.fileSchema = fileSchema;
-    }
-
-    @Override
-    public TableScan appendsBetween(long fromSnapshotId, long toSnapshotId) {
-      throw new UnsupportedOperationException(
-          String.format("Cannot incrementally scan table of type %s", 
MetadataTableType.FILES.name()));
-    }
-
-    @Override
-    public TableScan appendsAfter(long fromSnapshotId) {
-      throw new UnsupportedOperationException(
-          String.format("Cannot incrementally scan table of type %s", 
MetadataTableType.FILES.name()));
+    DataFilesTableScan(TableOperations ops, Table table, Schema schema, Schema 
fileSchema, TableScanContext context) {
+      super(ops, table, schema, fileSchema, context, MetadataTableType.FILES);
     }
 
     @Override
     protected TableScan newRefinedScan(TableOperations ops, Table table, 
Schema schema, TableScanContext context) {
-      return new FilesTableScan(ops, table, schema, fileSchema, context);
+      return new DataFilesTableScan(ops, table, schema, this.fileSchema(), 
context);

Review comment:
       Whoops done




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