Merge a set of sorted tables.
Merges sorted tables into one sorted table containing data from all tables.
Example 1:
input:
table 1 => col 1 {0, 1, 2, 3}
col 2 {4, 5, 6, 7}
table 2 => col 1 {1, 2}
col 2 {8, 9}
table 3 => col 1 {2, 4}
col 2 {8, 9}
output:
table => col 1 {0, 1, 1, 2, 2, 2, 3, 4}
col 2 {4, 5, 8, 6, 8, 9, 7, 9}
Example 2:
input:
table 1 => col 0 {1, 0}
col 1 {'c', 'b'}
col 2 {RED, GREEN}
table 2 => col 0 {1}
col 1 {'a'}
col 2 {NULL}
with key_cols[] = {0,1}
and asc_desc[] = {ASC, ASC};
Lex-sorting is on columns {0,1}; hence, lex-sorting of ((L0 x L1) V (R0 x R1)) is:
(0,'b', GREEN), (1,'a', NULL), (1,'c', RED)
(third column, the "color", just "goes along for the ride";
meaning it is permuted according to the data movements dictated
by lexicographic ordering of columns 0 and 1)
with result columns:
Res0 = {0,1,1}
Res1 = {'b', 'a', 'c'}
Res2 = {GREEN, NULL, RED}