aokolnychyi commented on code in PR #6309:
URL: https://github.com/apache/iceberg/pull/6309#discussion_r1035032134


##########
spark/v3.3/spark/src/main/java/org/apache/iceberg/spark/source/SparkScanBuilder.java:
##########
@@ -213,40 +215,53 @@ public Scan build() {
 
     Schema expectedSchema = schemaWithMetadataColumns();
 
-    TableScan scan =
-        table
-            .newScan()
-            .caseSensitive(caseSensitive)
-            .filter(filterExpression())
-            .project(expectedSchema);
+    if (startSnapshotId == null) {
+      BatchScan scan =
+          table
+              .newBatchScan()
+              .caseSensitive(caseSensitive)
+              .filter(filterExpression())
+              .project(expectedSchema);
 
-    if (snapshotId != null) {
-      scan = scan.useSnapshot(snapshotId);
-    }
+      if (snapshotId != null) {
+        scan = scan.useSnapshot(snapshotId);
+      }
 
-    if (asOfTimestamp != null) {
-      scan = scan.asOfTime(asOfTimestamp);
-    }
+      if (asOfTimestamp != null) {
+        scan = scan.asOfTime(asOfTimestamp);
+      }
 
-    if (branch != null) {
-      scan = scan.useRef(branch);
-    }
+      if (branch != null) {
+        scan = scan.useRef(branch);
+      }
 
-    if (tag != null) {
-      scan = scan.useRef(tag);
-    }
+      if (tag != null) {
+        scan = scan.useRef(tag);
+      }
+
+      scan = configureSplitPlanning(scan);
+
+      return new SparkBatchQueryScan(
+          spark, table, scan, readConf, expectedSchema, filterExpressions);
+
+    } else {
+      IncrementalAppendScan scan =
+          table
+              .newIncrementalAppendScan()
+              .fromSnapshotExclusive(startSnapshotId)

Review Comment:
   I believe the `startSnapshotId` option is always exclusive. 
   
   ```
   // Start snapshot ID used in incremental scans (exclusive)
   public static final String START_SNAPSHOT_ID = "start-snapshot-id";
   ```
   
   We may want to add a new boolean option to make it configurable.



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