hive - hql 注意

  不能用tab进行缩进,用空格替换

至于说,怎么判断是tab缩进

箭头那个就是。


表是 有分区的,select 时 ,要加上分区查询

select * from 【tableName】 where hour = '20181101';


create table xx as select 


删除表数据 truncate table 【tableName】


删除某天的数据(删分区)

alter table tbl_bbzx_hlw_agent_Transfer_hh drop if exists partition(hour='${hiveconf:day_id}');


查看 表结构

desc 【tableName】


插入空制符串,不支持,用 null 或插入数字


UNIX_TIMESTAMP(【data时间】, 'yyyyMMdd')  转换为时间戳,数字


类型转换

cast(【数据】 as 【数据类型】)


hql 文件执行

无变量输入

hive -f 【文件路径】

猜你喜欢

转载自blog.csdn.net/ImSanJin/article/details/84098495