一、环境
1、Hadoop 0.20.2
2、Hive 0.5
3、操作系统 Linux m131 2.6.9-78.8AXS2smp #1 SMP Tue Dec 16 02:42:55 EST 2008 x86_64 x86_64 x86_64 GNU/Linux
二、步骤
1、直接贴上脚本吧
#!/bin/bash #give the params: name value tablename if [ $# -eq 3 ] then name=$1 value=$2 tablename=$3 echo name=${name} echo value=${value} echo tablename=${tablename} else echo "Usage: $0 username username_value tablename" exit 1 fi cd /run/hie/kakadata #1.select the dialaccount, srcip cd /jz/hiveuser/hive.kaka/ echo "insert overwrite directory '/bcpdata/kaka/ad_ip_${name}_${value}' select distinct if(account<>'',account,0)as account, if(account<>'&