-
Notifications
You must be signed in to change notification settings - Fork 1
/
moviedoop.sh
71 lines (62 loc) · 2.11 KB
/
moviedoop.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
MOVIEDOOP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
MOVIEDOOP_JAR="${MOVIEDOOP_HOME}/target/moviedoop-1.0.jar"
##
# HADOOP COMMANDS
##
HADOOP_JAR="${HADOOP_HOME}/bin/hadoop jar"
HDFS_RM="${HADOOP_HOME}/bin/hdfs dfs -rm -r -f"
##
# DATASET
##
${HIVE_HOME}/bin/hive -f ${MOVIEDOOP_HOME}/lib/hive/movies_orc.q
${HIVE_HOME}/bin/hive -f ${MOVIEDOOP_HOME}/lib/hive/ratings_orc.q
##
# INPUT
##
HDFS_WAREHOUSE="/user/hive/warehouse"
IN_RATINGS="${HDFS_WAREHOUSE}/ratings_orc"
IN_MOVIES="${HDFS_WAREHOUSE}/movies_orc"
##
# OUTPUT
##
HDFS_OUT="/user/moviedoop/output"
##
# QUERY 1
##
QUERY="query1_6"
OPT_AVERAGE_REDUCE_CARDINALITY="-Dmoviedoop.average.reduce.cardinality"
AVERAGE_REDUCE_CARDINALITY=2
OPTS="${OPT_AVERAGE_REDUCE_CARDINALITY}=${AVERAGE_REDUCE_CARDINALITY}"
QUERY_OUT="${HDFS_OUT}/${QUERY}"
$HDFS_RM "${QUERY_OUT}*"
${HADOOP_JAR} ${MOVIEDOOP_JAR} ${QUERY} ${OPTS} ${IN_RATINGS} ${IN_MOVIES} ${QUERY_OUT}
##
# QUERY 2
##
QUERY="query2_5"
OPT_RATINGS_REDUCE_CARDINALITY="-Dmoviedoop.ratings.reduce.cardinality"
RATINGS_REDUCE_CARDINALITY=2
OPT_AVERAGE_REDUCE_CARDINALITY="-Dmoviedoop.average.reduce.cardinality"
AVERAGE_REDUCE_CARDINALITY=2
OPTS="${OPT_RATINGS_REDUCE_CARDINALITY}=${RATINGS_REDUCE_CARDINALITY}"
OPTS="${OPTS} ${OPT_AVERAGE_REDUCE_CARDINALITY}=${AVERAGE_REDUCE_CARDINALITY}"
QUERY_OUT="${HDFS_OUT}/${QUERY}"
$HDFS_RM "${QUERY_OUT}*"
${HADOOP_JAR} ${MOVIEDOOP_JAR} ${QUERY} ${OPTS} ${IN_RATINGS} ${IN_MOVIES} ${QUERY_OUT}
##
# QUERY 3
##
QUERY="query3_5"
OPT_AVERAGE_REDUCE_CARDINALITY="-Dmoviedoop.average.reduce.cardinality"
AVERAGE_REDUCE_CARDINALITY=2
OPT_TOPK_REDUCE_CARDINALITY="-Dmoviedoop.topk.reduce.cardinality"
TOPK_REDUCE_CARDINALITY=2
OPT_SORT_REDUCE_CARDINALITY="-Dmoviedoop.sort.reduce.cardinality"
SORT_REDUCE_CARDINALITY=2
OPTS="${OPT_AVERAGE_REDUCE_CARDINALITY}=${AVERAGE_REDUCE_CARDINALITY}"
OPTS="${OPTS} ${OPT_TOPK_REDUCE_CARDINALITY}=${TOPK_REDUCE_CARDINALITY}"
OPTS="${OPTS} ${OPT_SORT_REDUCE_CARDINALITY}=${SORT_REDUCE_CARDINALITY}"
QUERY_OUT="${HDFS_OUT}/${QUERY}"
$HDFS_RM "${QUERY_OUT}*"
${HADOOP_JAR} ${MOVIEDOOP_JAR} ${QUERY} ${OPTS} ${IN_RATINGS} ${IN_MOVIES} ${QUERY_OUT}