aokolnychyi commented on a change in pull request #3763:
URL: https://github.com/apache/iceberg/pull/3763#discussion_r773309738
##########
File path:
spark/v3.2/spark/src/main/java/org/apache/iceberg/spark/source/SparkScanBuilder.java
##########
@@ -157,8 +159,73 @@ private Schema schemaWithMetadataColumns() {
@Override
public Scan build() {
- return new SparkBatchQueryScan(
- spark, table, readConf, schemaWithMetadataColumns(),
filterExpressions);
+ Long snapshotId = readConf.snapshotId();
+ Long asOfTimestamp = readConf.asOfTimestamp();
+
+ Preconditions.checkArgument(snapshotId == null || asOfTimestamp == null,
+ "Cannot set both %s and %s to select which table snapshot to scan",
+ SparkReadOptions.SNAPSHOT_ID, SparkReadOptions.AS_OF_TIMESTAMP);
+
+ Long startSnapshotId = readConf.startSnapshotId();
+ Long endSnapshotId = readConf.endSnapshotId();
+
+ if (snapshotId != null || asOfTimestamp != null) {
+ Preconditions.checkArgument(startSnapshotId == null && endSnapshotId ==
null,
Review comment:
I think it would be possible but would require adding validation
capabilities to `SparkReadConf`. I think the current validation is easier to
read than what we had before so I'd probably address this in a follow-up.
--
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]