bryanck commented on code in PR #15193:
URL: https://github.com/apache/iceberg/pull/15193#discussion_r2989605282
##########
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:
The read config timestamp can be set either via a session config or a read
option, how are the two different in this case? Also the prefix `session` is a
little bit confusing to me as the read config can be a read option also.
--
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]