There is a HIVE-E command in hive that can pass parameters, but when the HQL statement is more, the entire shell script will look messy, of course someone might say hive-f can implement a direct call to a file,bingo indeed, but there is a big flaw, This is not a parameter can not be passed in the actual work is intolerable. So I think of the encapsulation of a command hivef, both directly into the file, but also to pass parameters. In fact, the implementation is very simple, the following code to share out. Of course, it's not perfect.
#!/bin/bash
. /etc/profile
Cat $ > $1.tmp
For ARG in "[Email protected]"
Do
echo "Arg" $arg
Flag= ' echo $arg | grep '-'
if [$arg! = $];then
if [$flag];then
Tmp= ' echo $flag | Sed s/-//'
Else
Sed-i s/{$tmp}/$arg/g $1.tmp
echo "Nothing"
Fi
Fi
Done
Hive-f $1.tmp
Rm-f $1.tmp
I hope I can say help to everyone.
This article is from the "Askjoey" blog, make sure to keep this source http://askjoey.blog.51cto.com/7594056/1791712
The shell script encapsulates the HIVEF command in Hive