Q:hive支持exist in查询吗?
A:支持,select user_id from user_act where app_id in ('237294','215928') and user_id>0;
Q:hive是否可以打印列名?
A:支持,在执行语句之前先,set hive.cli.print.header=true(只对cli有效)
Q:hive是否可以设置reduce的个数
A:支持,在执行语句之前先,set hive.exec.reducers.max=<number>
Q:hive是否可以查询hive表的集群文件位置
A:支持,select <column>,<column>,INPUT_FILE_NAME from user_act where log_date>='2013-10-10' and user_id>0 limit 10
或者,desc formatted ${table_name}
hive -e "set hive.cli.print.header=true;use acorn_3g;select user_id,INPUT__FILE__NAME from user_act where log_date='2013-10-10' and user_id>0 limit 10;"
user_id input__file__name
561969120 hdfs://YZSJHL18-25.opi.com/warehouse/acorn_3g.db/user_act/log_date=2013-10-10/2013-10-10.bz2
561969120 hdfs://YZSJHL18-25.opi.com/warehouse/acorn_3g.db/user_act/log_date=2013-10-10/2013-10-10.bz2
Q:hive是否支持本地执行模式
A:支持,当数据量小的时候,本地执行比提交到hadoop集群执行效率提升很大(大批量小作业,尽量采用本地执行模式)
set hive.exec.mode.local.auto=true(默认false)
满足如下条件才能真正使用本地模式:
1、job的数据数据大小必须小于参数hive.exec.mode.local.auto.inputbytes.max(默认值128M)
2、job的map处理的文件数小于参数hive.exec.mode.local.auto.input.files.max(默认值4)
3、job的reduce数必须小于等于1
用参数hive.mapred.local.mem来设置local mode下mapper和reducer task jvm heap size(在本地模式的最大内存量,以字节为单位,0为不限制)
Q:hive是否支持自动mapjoin?
A:支持,设置hive.auto.convert.join=true,根据输入表的文件大小,自动将reduce端common join转为mapjoin,从而加快大表关联小表的速度。(建议开启)
Q:hive是否支持跨数据库查询?
A:支持,和普通关系型数据库跨库查询一样,database.tablename。
Q:hql是否区分大小写
A:不区分大小写。
Q:查看创建表sql语句
A:show create table ${table_name}