Skip to content

Commit 23dc1af

Browse files
committed
Some clarifications in the public documentation for table unions
1 parent 6b12a15 commit 23dc1af

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/Database/LSMTree.hs

+12-2
Original file line numberDiff line numberDiff line change
@@ -1449,7 +1449,11 @@ withUnions tables =
14491449
bracket (unions tables) closeTable
14501450

14511451
{- |
1452-
Create a table that contains the left-biased union of the entries of the given tables.
1452+
Create a table that contains the union of the entries of the given tables.
1453+
1454+
If the given key is a member of a single input table, then the same key and value occur in the output table.
1455+
Otherwise, the values for duplicate keys are combined using 'resolve' from left to right.
1456+
If the 'resolve' function behaves like 'const', then this computes a left-biased union.
14531457
14541458
The worst-case disk I\/O complexity of this operation is \(O(n)\).
14551459
@@ -1651,7 +1655,7 @@ _withInternalTables (Table (table :: Internal.Table m h) :| tables) action =
16511655
Get the amount of remaining union debt.
16521656
This includes the union debt of any table that was part of the union's input.
16531657
1654-
The worst-case disk I\/O complexity of this operation is \(O\(1)\).
1658+
The worst-case disk I\/O complexity of this operation is \(O(1)\).
16551659
-}
16561660
{-# SPECIALISE
16571661
remainingUnionDebt ::
@@ -1669,6 +1673,12 @@ remainingUnionDebt (Table table) =
16691673
{- |
16701674
Supply the given amount of union credits.
16711675
1676+
This reduces the union debt by /at least/ the number of supplied union credits.
1677+
It is therefore advisable to query 'remainingUnionDebt' every once in a while to see what the current debt is.
1678+
1679+
This function returns any surplus of union credits as /leftover/ credits when a union has finished.
1680+
In particular, if the returned number of credits is positive, then the union is finished.
1681+
16721682
The worst-case disk I\/O complexity of this operation is \(O(b)\),
16731683
where the variable \(b\) refers to the amount of credits supplied.
16741684

src/Database/LSMTree/Simple.hs

+6
Original file line numberDiff line numberDiff line change
@@ -1099,6 +1099,12 @@ remainingUnionDebt (Table table) =
10991099
{- |
11001100
Supply the given amount of union credits.
11011101
1102+
This reduces the union debt by /at least/ the number of supplied union credits.
1103+
It is therefore advisable to query 'remainingUnionDebt' every once in a while to see what the current debt is.
1104+
1105+
This function returns any surplus of union credits as /leftover/ credits when a union has finished.
1106+
In particular, if the returned number of credits is positive, then the union is finished.
1107+
11021108
The worst-case disk I\/O complexity of this operation is \(O(\frac{b}{P})\),
11031109
where the variable \(b\) refers to the amount of credits supplied.
11041110

0 commit comments

Comments
 (0)