Skip to content

Commit

Permalink
[fix] Fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tsreaper committed Jul 29, 2024
1 parent e58f9b6 commit 2a6bf4d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
14 changes: 14 additions & 0 deletions docs/content/maintenance/manage-branches.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,20 @@ SELECT * FROM T;
| 20240726 | pear | 6 |
+------------------+------------------+--------+
*/
-- reset fallback branch
ALTER TABLE T RESET ( 'scan.fallback-branch' );
-- now it only reads from default branch
SELECT * FROM T;
/*
+------------------+------------------+--------+
| dt | name | amount |
+------------------+------------------+--------+
| 20240725 | apple | 5 |
| 20240725 | banana | 7 |
+------------------+------------------+--------+
*/
```
{{< /tab >}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ public FallbackReadFileStoreTable(FileStoreTable main, FileStoreTable fallback)
super(main);
this.fallback = fallback;

Preconditions.checkArgument(!(main instanceof FallbackReadFileStoreTable));
Preconditions.checkArgument(!(fallback instanceof FallbackReadFileStoreTable));

String mainBranch = main.coreOptions().branch();
String fallbackBranch = fallback.coreOptions().branch();
RowType mainRowType = main.schema().logicalRowType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.apache.paimon.options.Options;
import org.apache.paimon.schema.SchemaManager;
import org.apache.paimon.schema.TableSchema;
import org.apache.paimon.utils.Preconditions;
import org.apache.paimon.utils.StringUtils;

import java.io.IOException;
Expand Down Expand Up @@ -106,9 +105,6 @@ public static FileStoreTable create(
new SchemaManager(fileIO, tablePath, fallbackBranch).latest().get(),
branchOptions,
catalogEnvironment);

Preconditions.checkArgument(!(table instanceof FallbackReadFileStoreTable));
Preconditions.checkArgument(!(fallbackTable instanceof FallbackReadFileStoreTable));
table = new FallbackReadFileStoreTable(table, fallbackTable);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,10 @@ public void testFallbackBranchBatchRead() throws Exception {
assertThat(collectResult("SELECT v, k FROM t"))
.containsExactlyInAnyOrder(
"+I[apple, 10]", "+I[banana, 20]", "+I[lion, 10]", "+I[wolf, 20]");

sql("ALTER TABLE t RESET ( 'scan.fallback-branch' )");
assertThat(collectResult("SELECT v, k FROM t"))
.containsExactlyInAnyOrder("+I[apple, 10]", "+I[banana, 20]");
}

@Test
Expand Down

0 comments on commit 2a6bf4d

Please sign in to comment.