-
Notifications
You must be signed in to change notification settings - Fork 0
/
tc.sh
41 lines (34 loc) · 920 Bytes
/
tc.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bash
# This script will execute a transitive closure flow using one of the classes from join.jar
# The only options for ClassName are BinaryJoinTC or TripleJoinTC
# Input should be edges of the format "u,v", one per line.
badargs()
{
echo usage: sh tc.sh ClassName input output numReducer
echo *ClassName should be either BinaryJoinTC or TripleJoinTC
exit
}
if [ $# -ne 4 ] || [ "$1" != BinaryJoinTC -a "$1" != TripleJoinTC ]
then
badargs
fi
set +o posix
class=$1
input=$2
output=$3
reducers=$4
result=1
bin/hadoop fs -rmr $input $output
bin/hadoop fs -put $input $input
rm $output temp
while [ $result -ne 0 ]
do
bin/hadoop jar join.jar $class $input $output $reducers
rm $output
bin/hadoop fs -getmerge $output $output
diff <(sort -u $output) <(sort -u temp)
result=$?
cp $output temp
bin/hadoop fs -rmr $input $output
bin/hadoop fs -put $output $input
done