Hive notes

来源:互联网 发布:mmap文件阅读器 mac 编辑:程序博客网 时间:2024/06/08 06:35

hive commond:

1.hive -e “select * from mytable limit 3;
2.hive -S -e “select * from mytable limit 3” > /tmp/myquery
(no useless information like “OK Time taken:xxx seconds”)
3.hive -S -e ‘set’ | grep warehouse
(search hive ‘set’ information by bash commond)
4.hive -f /path/…/hsqlcommond.hql ——–bash commond
hive> source /path/…/hsqlcommond.hql ———-hive shell

Use hive -i filename;

1.first:search for filename.hiverc in $HIVE_HOME then excute the file;
eg:
set hive.cli.print.current.db=true; —–show current database
set hive.exec.mode.local.auto=true; ——-use local mode
set hive.cli.print.header=true —-show header

Execute bash shell commond in hive shell

hive>! echo “hello my best friend jackeylove4”;
hive>! pwd

Use hadoop dsf commond in hive shell (more efficient)

hive>dfs -ls /;
hive>dfs -put filepath hdfspath;

Hive script explain code:

--copyright (c) 2012.......--This is the best Hive script ever!select * from mytable;