Hive随记

2017年07月22日

获取当前时间并格式化

    select from_unixtime(unix_timestamp(),'yyyy-MM-dd HH:mm:ss')

字符串解析为日期

    select unix_timestamp('20111207 13:01:03','yyyyMMdd HH:mm:ss')

MapReduce计算模型

Hive 类型转换

    cast(manual_dettime as bigint)

hive 导出数据时,加列名

hive -e “set hive.cli.print.header=true;select * from table” > data.csv

LATERAL VIEW

https://cwiki.apache.org/confluence/display/Hive/LanguageManual+LateralView