RussellSpitzer commented on code in PR #10943:
URL: https://github.com/apache/iceberg/pull/10943#discussion_r1777471776


##########
spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/source/SparkScanBuilder.java:
##########
@@ -407,14 +422,35 @@ public Scan build() {
 
   private Scan buildBatchScan() {
     Schema expectedSchema = schemaWithMetadataColumns();
+    org.apache.iceberg.Scan scan =
+        buildIcebergBatchScan(false /* not include Column Stats */, 
expectedSchema);
+    if (pushedLimit > 0 && hasDeletes(scan)) {
+      LOG.info("Skipping limit pushdown: detected row level deletes");
+      pushedLimit = -1;
+    }
     return new SparkBatchQueryScan(
         spark,
         table,
-        buildIcebergBatchScan(false /* not include Column Stats */, 
expectedSchema),
+        scan,
         readConf,
         expectedSchema,
         filterExpressions,
-        metricsReporter::scanReport);
+        metricsReporter::scanReport,
+        pushedLimit);
+  }
+
+  private boolean hasDeletes(org.apache.iceberg.Scan scan) {
+    try (CloseableIterable<FileScanTask> fileScanTasks = scan.planFiles()) {

Review Comment:
   Probably save this for another PR



-- 
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: issues-unsubscr...@iceberg.apache.org

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

Reply via email to