Skip to content

Commit 61131aa

Browse files
authored
Merge pull request #687 from IntersectMBO/jdral/union-docs
Some clarifications in the public documentation for table unions
2 parents b99ca5b + 23dc1af commit 61131aa

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
@@ -1447,7 +1447,11 @@ withUnions tables =
14471447
bracket (unions tables) closeTable
14481448

14491449
{- |
1450-
Create a table that contains the left-biased union of the entries of the given tables.
1450+
Create a table that contains the union of the entries of the given tables.
1451+
1452+
If the given key is a member of a single input table, then the same key and value occur in the output table.
1453+
Otherwise, the values for duplicate keys are combined using 'resolve' from left to right.
1454+
If the 'resolve' function behaves like 'const', then this computes a left-biased union.
14511455
14521456
The worst-case disk I\/O complexity of this operation is \(O(n)\).
14531457
@@ -1649,7 +1653,7 @@ _withInternalTables (Table (table :: Internal.Table m h) :| tables) action =
16491653
Get the amount of remaining union debt.
16501654
This includes the union debt of any table that was part of the union's input.
16511655
1652-
The worst-case disk I\/O complexity of this operation is \(O\(1)\).
1656+
The worst-case disk I\/O complexity of this operation is \(O(1)\).
16531657
-}
16541658
{-# SPECIALISE
16551659
remainingUnionDebt ::
@@ -1667,6 +1671,12 @@ remainingUnionDebt (Table table) =
16671671
{- |
16681672
Supply the given amount of union credits.
16691673
1674+
This reduces the union debt by /at least/ the number of supplied union credits.
1675+
It is therefore advisable to query 'remainingUnionDebt' every once in a while to see what the current debt is.
1676+
1677+
This function returns any surplus of union credits as /leftover/ credits when a union has finished.
1678+
In particular, if the returned number of credits is positive, then the union is finished.
1679+
16701680
The worst-case disk I\/O complexity of this operation is \(O(b)\),
16711681
where the variable \(b\) refers to the amount of credits supplied.
16721682

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)