hive:

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/weixin_38750084/article/details/85334955

1.查看表结构信息
  desc formatted table_name;
  desc table_name;

   查看建表语句及其他详细信息的方法
   show create table table_name;

2.自定义udf函数
  1.继承UDF类
  2.重写evaluate方法
  3.把项目打成jar包
  4.hive中执行命令add jar /home/jrjt/dwetl/PUB/UDF/udf/GetProperty.jar;
  5.创建函数create temporary function get_pro as 'jd.Get_Property'//jd.jd.Get_Property为类路径;

3.导出数据到文件
  insert overwrite directory '/tmp/csl_rule_cfg' select a.* from dim.dim_csl_rule_config a;
  hive -e "select day_id,pv,uv,ip_count,click_next_count,second_bounce_rate,return_visit,pg_type from tmp.tmp_h02_click_log_baitiao_ag_sum where day_id in ('2014-03-06','2014-03-07','2014-03-08','2014-03-09','2014-03-10');"> /home/jrjt/testan/baitiao.dat;

其他:

hive不支持用insert语句一条一条的进行插入操作,也不支持update操作。数据是以load的方式加载到建立好的表中。数据一旦导入就不可以修改。

猜你喜欢

转载自blog.csdn.net/weixin_38750084/article/details/85334955