stevenzwu commented on code in PR #10207:
URL: https://github.com/apache/iceberg/pull/10207#discussion_r1576603768
##########
flink/v1.19/flink/src/main/java/org/apache/iceberg/flink/source/ScanContext.java:
##########
@@ -155,6 +155,13 @@ private void validate() {
Preconditions.checkArgument(
tag == null,
String.format("Cannot scan table using ref %s configured for
streaming reader", tag));
+ Preconditions.checkArgument(
+ snapshotId == null, "Cannot set snapshot-id option for streaming
reader");
+ Preconditions.checkArgument(
+ asOfTimestamp == null, "Cannot set as-of-timestamp option for
streaming reader");
+ Preconditions.checkArgument(
Review Comment:
where were end snapshot (id or tag) silently overridden? I thought it might
be a valid scenario. E.g., during backfill, maybe it can be streaming mode and
discover splits snapshot by snapshot with an end snapshot.
##########
flink/v1.19/flink/src/test/java/org/apache/iceberg/flink/source/TestScanContext.java:
##########
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iceberg.flink.source;
+
+import org.assertj.core.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+class TestScanContext {
+ @Test
+ void testIncrementalFromSnapshotId() {
+ Assertions.assertThatThrownBy(
+ () ->
+ ScanContext.builder()
+ .streaming(true)
+
.startingStrategy(StreamingStartingStrategy.INCREMENTAL_FROM_SNAPSHOT_ID)
+ .build())
+ .hasMessageContaining("Invalid starting snapshot id for")
Review Comment:
nit: can we assert on more specific error msg? In this case, maybe null.
general comment for other assertions
--
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]