hive DDL
/apps/hadoop/sbin/start-all.sh
sudo service mysql start
hive
mkdir /data/hive3
cd data/hive3
wget http://192.168.1.100:60000/allfiles/hive3/buyer_log
wget http://192.168.1.100:60000/allfiles/hive3/buyer_favorite
create table buyer_log(id string,buyer_id string,dt string,ip string,opt_type string) row format delimited fields terminated by ' ' stored as textfile;
load data local inpath '/data/hive3/buyer_log' into table buyer_log;
load data local inpath '/data/hive3/buyer_favorite' into table buyer_favorite;
select * from buyer_log limit 10;
select b.id,b.ip from buyer_log b limit 10;
select buyer_id from buyer_log where opt_type=1 limit 10;
select l.dt,f.goods_id from buyer_log l,buyer_favorite f where l.buyer_id=f.buyer_id limit 10;
create table buyer_log1 like buyer_log;
create table buyer_log2 like buyer_log;
from buyer_log insert overwrite table buyer_log1 select *
insert overwrite table buyer_log2 select *;
from buyer_log
insert overwrite local directory '/data/hive3/out' select *;
insert overwrite local directory '/data/hive3/out1' select *;
#!/bin/bash
cd /apps/hive/sbin;
hive -e 'show tables;'
chmod +x sh1
./sh1