Skip to content

Commit

Permalink
minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
askwang committed Jul 16, 2024
1 parent d2727b4 commit 27a18a5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ public List<String> allTagNames() {
return tags().values().stream().flatMap(Collection::stream).collect(Collectors.toList());
}

/** askwang-todo: 二分查找加速 taggedSnapshot 查询速度. */
/** askwang-done: 二分查找加速 taggedSnapshot 查询速度. A: 内存查找很快,无需优化. */
private int findIndex(Snapshot taggedSnapshot, List<Snapshot> taggedSnapshots) {
for (int i = 0; i < taggedSnapshots.size(); i++) {
if (taggedSnapshot.id() == taggedSnapshots.get(i).id()) {
Expand Down Expand Up @@ -452,7 +452,7 @@ public static int findPreviousTag(List<Snapshot> taggedSnapshots, long targetSna
/** 减少不重叠的 snapshot 范围 [begin, end): [10, 15) taggedSnapshots: [7, 9, 11, 12]. */
private static int findNextOrEqualTagAskwang(
List<Snapshot> taggedSnapshots, long targetSnapshotId) {
for (int i = 0; i < targetSnapshotId; i++) {
for (int i = 0; i < taggedSnapshots.size(); i++) {
if (taggedSnapshots.get(i).id() >= targetSnapshotId) {
return i;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class ExpireSnapshotsProcedureTest extends PaimonSparkTestBase with StreamTest {

// min maybe large than maxExclusive
test("Paimon Procedure: max delete") {
failAfter(streamingTimeout) {
// failAfter(streamingTimeout) {
withTempDir {
checkpointDir =>
// define a change-log table and test `forEachBatch` api
Expand Down Expand Up @@ -207,15 +207,12 @@ class ExpireSnapshotsProcedureTest extends PaimonSparkTestBase with StreamTest {
inputData.addData((10, "b"))
stream.processAllAvailable()

// expire assert throw exception
assertThrows[IllegalArgumentException] {
spark.sql(
spark.sql(
"CALL paimon.sys.expire_snapshots(table => 'test.T', retain_max => 5, retain_min => 2, max_deletes => 4)")
}
} finally {
stream.stop()
}
}
}
// }
}
}

0 comments on commit 27a18a5

Please sign in to comment.