michalheld commented on code in PR #15193:
URL: https://github.com/apache/iceberg/pull/15193#discussion_r3016457414


##########
spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/source/SparkScanBuilder.java:
##########
@@ -107,17 +109,30 @@ public class SparkScanBuilder extends BaseSparkScanBuilder
       TimeTravel timeTravel,
       CaseInsensitiveStringMap options) {
     super(spark, table, schema, options);
-    this.snapshot = snapshot;
     this.branch = branch;
     this.timeTravel = timeTravel;
     if (Spark3Util.containsIncrementalOptions(options)) {
       Preconditions.checkArgument(timeTravel == null, "Cannot use time travel 
in incremental scan");
       Pair<Long, Long> boundaries = 
readConf().incrementalAppendScanBoundaries();
       this.startSnapshotId = boundaries.first();
       this.endSnapshotId = boundaries.second();
+      this.snapshot = snapshot;
     } else {
       this.startSnapshotId = null;
       this.endSnapshotId = null;
+      Long sessionTimestamp = readConf().asOfTimestamp();
+      Preconditions.checkArgument(
+          timeTravel == null || sessionTimestamp == null,
+          "Cannot use both time travel and %s session property",
+          SparkSQLProperties.AS_OF_TIMESTAMP);
+      Preconditions.checkArgument(
+          branch == null || sessionTimestamp == null,
+          "Cannot use both branch and %s session property",
+          SparkSQLProperties.AS_OF_TIMESTAMP);
+      this.snapshot =
+          sessionTimestamp != null
+              ? table.snapshot(SnapshotUtil.snapshotIdAsOfTime(table, 
sessionTimestamp))
+              : snapshot;

Review Comment:
   moved old implementation to Spark 4.0. Spark 4.1 had a huge refactorization 
and requires some alignment on how it should be added there.



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