/
hiver.sh
executable file
·41 lines (33 loc) · 1 KB
/
hiver.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
#!/bin/bash
#
# Usage:
# hiver.sh
# hiver.sh -hiveconf fs.defaultFS=file:/// -hiveconf mapreduce.framework.name=local
set -x
set -e
bin=`dirname "$0"`
bin=`cd "$bin"; pwd`
actual="$bin"/../actual
cd "$bin"/../..
#rm -rf $actual/ch17
mkdir -p $actual/ch17
for f in ch17-hive/src/main/hive/*.hive; do
out=$f.output.txt
hive "$@" -S < $f 2> /dev/null \
| grep -v '^hive> $' \
| grep -v '^$' \
| sed -e 's|&|\&|g' \
-e 's|"|\"|g' \
-e 's|>|\>|g' \
-e 's|<|\<|g' \
-e 's| | |g' \
-e 's|^\(hive> \)\(.*\)|<prompt moreinfo="none">\1</prompt><userinput moreinfo="none">\2</userinput>|' \
-e 's|^\( > \)\(.*\)|<prompt moreinfo="none">\1</prompt><userinput moreinfo="none">\2</userinput>|' \
-e 's|Hank |Hank |g' \
-e 's|0 NULL NULL|0 NULL NULL|' \
-e 's|NULL NULL |NULL NULL |' \
> $out
cat $out
python "$bin"/phragmite_hive.py $out $actual/ch17
rm $out
done