File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed
main/java/org/apache/paimon/table
test/java/org/apache/paimon/table/system Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -477,8 +477,12 @@ protected Runnable newExpireRunnable() {
477477
478478 private Optional <TableSchema > tryTimeTravel (Options options ) {
479479 CoreOptions coreOptions = new CoreOptions (options );
480- Snapshot snapshot =
481- TimeTravelUtil .resolveSnapshotFromOptions (coreOptions , snapshotManager ());
480+ Snapshot snapshot ;
481+ try {
482+ snapshot = TimeTravelUtil .resolveSnapshotFromOptions (coreOptions , snapshotManager ());
483+ } catch (Exception e ) {
484+ return Optional .empty ();
485+ }
482486 if (snapshot == null ) {
483487 return Optional .empty ();
484488 }
Original file line number Diff line number Diff line change 4747import static org .apache .paimon .SnapshotTest .newSnapshotManager ;
4848import static org .apache .paimon .utils .FileStorePathFactoryTest .createNonPartFactory ;
4949import static org .assertj .core .api .Assertions .assertThat ;
50+ import static org .junit .jupiter .api .Assertions .assertThrows ;
5051
5152/** Unit tests for {@link ManifestsTable}. */
5253public class ManifestsTableTest extends TableTestBase {
@@ -148,6 +149,18 @@ public void testReadManifestsFromSpecifiedTimestampMillis() throws Exception {
148149 assertThat (result ).containsExactlyElementsOf (expectedRow );
149150 }
150151
152+ @ Test
153+ public void testReadManifestsFromNotExistSnapshot () {
154+ manifestsTable =
155+ (ManifestsTable )
156+ manifestsTable .copy (
157+ Collections .singletonMap (CoreOptions .SCAN_SNAPSHOT_ID .key (), "3" ));
158+ assertThrows (
159+ Exception .class ,
160+ () -> read (manifestsTable ),
161+ "Specified parameter scan.snapshot-id = 3 is not exist, you can set it in range from 1 to 2" );
162+ }
163+
151164 private List <InternalRow > getExpectedResult (long snapshotId ) {
152165 if (!snapshotManager .snapshotExists (snapshotId )) {
153166 return Collections .emptyList ();
You can’t perform that action at this time.
0 commit comments