-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathcool
executable file
·84 lines (70 loc) · 2.44 KB
/
cool
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
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/usr/bin/env bash
COOL_CORE_PATH="${COOL_CORE_JAR_PATH:-./cool-core/target/cool-core-0.1-SNAPSHOT.jar}"
COOL_EXTENSION_PATH_PREFIX="${COOL_EXTENSION_PATH_PREFIX:-./cool-extensions}"
COOL_QUERY_SERVER_PATH="${COOL_QUERY_SERVER_PATH:-./cool-queryserver/target/cool-queryserver-0.1-SNAPSHOT.jar}"
main_help() {
COOL_HELP_LEFT_ALIGN="%-17s"
echo "Usage: $0 <command> [<args>]"
echo
echo Commands
printf " $COOL_HELP_LEFT_ALIGN %s\n" "help" "Show this help menu"
printf " $COOL_HELP_LEFT_ALIGN %s\n" "load" "Load dataset"
printf " $COOL_HELP_LEFT_ALIGN %s\n" "cohortselection" "Perform cohort selection"
printf " $COOL_HELP_LEFT_ALIGN %s\n" "cohortquery" "Perform cohort query"
printf " $COOL_HELP_LEFT_ALIGN %s\n" "funnelquery" "Perform funnel query"
printf " $COOL_HELP_LEFT_ALIGN %s\n" "olapquery" "Perform OLAP query"
printf " $COOL_HELP_LEFT_ALIGN %s\n" "server" "Start query server"
exit ${1:-0}
}
main_load() {
case ${1} in csv)
java -cp $COOL_CORE_PATH com.nus.cool.functionality.CsvLoader "${@:2}"
;;
parquet)
echo "java -jar $COOL_EXTENSION_PATH_PREFIX/parquet-extensions/target/parquet-extensions-0.1-SNAPSHOT.jar ${@:2}"
java -jar $COOL_EXTENSION_PATH_PREFIX/parquet-extensions/target/parquet-extensions-0.1-SNAPSHOT.jar "${@:2}"
;;
avro)
java -jar $COOL_EXTENSION_PATH_PREFIX/avro-extensions/target/avro-extensions-0.1-SNAPSHOT.jar "${@:2}"
;;
arrow)
java -jar $COOL_EXTENSION_PATH_PREFIX/arrow-extensions/target/arrow-extensions-0.1-SNAPSHOT.jar "${@:2}"
;;
*)
echo "unknown format: $1"
main_help 1
exit 1
;;
esac
}
main_cohortselection() {
java -cp $COOL_CORE_PATH com.nus.cool.functionality.CohortSelection "$@"
}
main_cohortquery() {
java -cp $COOL_CORE_PATH com.nus.cool.functionality.CohortAnalysis "$@"
}
main_funnelquery() {
java -cp $COOL_CORE_PATH com.nus.cool.functionality.FunnelAnalysis "$@"
}
main_olapquery() {
java -cp $COOL_CORE_PATH com.nus.cool.functionality.IcebergLoader "$@"
}
main_server() {
java -jar $COOL_QUERY_SERVER_PATH
}
function main() {
if (($# == 0)); then
main_help 0
fi
case ${1} in
help | load | cohortselection | cohortquery | funnelquery | olapquery | server)
"main_$1" "${@:2}"
;;
*)
echo "unknown command: $1"
main_help 1
exit 1
;;
esac
}
main "$@"