Database Reference
In-Depth Information
Algorithm 8.1
GIM-V
BASE Stage 1.
Input:
Matrix
M
= {(
id
src
, (
id
dsrt
,
mval
))}, Ve ctor
V
= {(
id
,
vval
)}
Output:
Partial vector
V
′ = {
id
src
, combine2(
mval
,
vval
)}
1: Stage1-Map(Key
k
, Value
v
):
2:
if
(
k
,
v
) is of type V then
3:
Output (
k
,
v
);
// (
k
:
id
,
v
:
vval
)
4:
else if
(
k
,
v
) is of type M
then
5:
(
id
dst
,
mval
) ←
v
;
6:
Output(
id
dst
, (
k
,
mval
));
// (
k
:
id
src
)
7:
end if
8:
9: Stage1-Reduce(Key
k
, Value
v
[1..
m
]):
10:
saved
_
kv
←[ ];
11:
saved
_
v
←[ ];
12:
for
v
∈
v
[1..
m
]
do
13:
if
(
k
,
v
) is of type V
then
14:
saved
_
v
←
v
;
15: Output (
k
, (“
self
”;
saved
_
v
));
16:
else if
(
k
,
v
) is of type M
then
17:
Add
v
to
saved
_
kv
;
// (
v
: (
id
src
,
mval
))
18:
end if
19:
end for
20:
for
(
id
src
,
mval
′) ∈
saved
_
kv
do
21: Output(
id
src
, (“
others
”, combine2(
mval
′,
saved
_
v
)));
22:
end for
Algorithm 8.2
GIM-V
BASE Stage 2.
Input:
Partial vector
V
′ = {(
id
src
,
vval
′)}
Output:
Result vector
V
= {(
id
src
,
vval
)}
1: Stage2-Map(Key
k
, Value
v
):
2: Output(
k
,
v
);
3:
4: Stage2-Reduce(Key
k
, Value
v
[1..
m
]):
5:
others
_
v
←[ ];
6:
self
_
v
←[ ];
7:
for
v
∈
v
[1..
m
]
do
8: (
tag
,
v
′) ←
v
;
9:
if
tag
= “same”
then
10:
self
_
v
←
v
′;
11:
else if
tag
= “others”
then
12: Add
v
′ to
others
_
v
;
13:
end if
14:
end for
15: Output(
k
, assign(
self
_
v
, combineAll
k
(
others
_
v
)));
Search WWH ::
Custom Search