szehon-ho commented on code in PR #4812:
URL: https://github.com/apache/iceberg/pull/4812#discussion_r905558549


##########
core/src/main/java/org/apache/iceberg/PositionDeletesTableScan.java:
##########
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iceberg;
+
+import org.apache.iceberg.expressions.Expression;
+import org.apache.iceberg.expressions.Expressions;
+import org.apache.iceberg.expressions.ResidualEvaluator;
+import org.apache.iceberg.io.CloseableIterable;
+import org.apache.iceberg.util.PropertyUtil;
+
+public class PositionDeletesTableScan extends BaseMetadataTableScan {
+
+  public PositionDeletesTableScan(TableOperations ops, Table table, Schema 
schema) {
+    super(ops, table, schema, MetadataTableType.POSITION_DELETES);
+  }
+
+  PositionDeletesTableScan(TableOperations ops, Table table, Schema schema, 
TableScanContext context) {
+    super(ops, table, schema, MetadataTableType.POSITION_DELETES, context);
+  }
+
+  @Override
+  protected TableScan newRefinedScan(TableOperations ops, Table table, Schema 
schema, TableScanContext context) {
+    return new PositionDeletesTableScan(ops, table, schema, context);
+  }
+
+  @Override
+  protected CloseableIterable<FileScanTask> doPlanFiles() {
+    // TODO- add partition column and implement filter push down
+    boolean ignoreResiduals = context().ignoreResiduals();
+    String schemaString = SchemaParser.toJson(tableSchema());
+    Expression filter = ignoreResiduals ? Expressions.alwaysTrue() : 
context().rowFilter();
+    ResidualEvaluator residuals = ResidualEvaluator.unpartitioned(filter);
+    DeleteFileIndex deleteIndex = DeleteFileIndex.builderFor(tableOps().io(), 
snapshot().deleteManifests())
+        .specsById(table().specs())
+        .build();
+
+    CloseableIterable<DeleteFile> deleteFiles = 
CloseableIterable.withNoopClose(deleteIndex.referencedDeleteFiles());
+    CloseableIterable<DeleteFile> positionDeleteFiles = 
CloseableIterable.filter(deleteFiles,
+        df -> df.content().equals(FileContent.POSITION_DELETES));
+    return CloseableIterable.transform(positionDeleteFiles, f -> {
+      PartitionSpec spec = table().specs().get(f.specId());
+      String specString = PartitionSpecParser.toJson(spec);
+      return new BaseFileScanTask(DataFiles.fromPositionDelete(f, spec),
+          null, /* Deletes */
+          schemaString,
+          specString,
+          residuals);
+    });
+  }
+
+  @Override
+  public long targetSplitSize() {
+    long tableValue = tableOps().current().propertyAsLong(

Review Comment:
   I think this should be fine, currently BaseFileScanTask checks if the file 
type is splittalbe before using this value.  I also added test in latest pr 
against all three file formats, against one test method that purposely hits the 
split limit. 



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