zoukankan      html  css  js  c++  java
  • Hive 表结构操作

    • 添加列  add columns

        alter table table_name add columns (id int comment '主键ID' ) ;

        默认在表所有字段之后,分区字段之前。

    • 替换列 replace columns ,会替换所有列,慎用

        alter table table_name replace columns (id int comment '主键ID' ) ;

    • 修改字段名称、类型、注释 change 

        1. 修改字段注释

          alter table table_name change id id int comment '订单号'; 

        2. 修改列名, id 改成 tab_id

          alter table table_name change id tab_id int comment '订单号'; 

    • 删除表分区

        alter table table_name drop if exists partition (statis_date='20151015'); 

    • 删除文件(如果是外部表)  

        Hive 模式: dfs -rm -r -f /user/kimbo/table_name/statis_date=${date_7} ;

        命令行模式: hadoop fs -rm -r  /user/kimbo/table_name/statis_date=${date_7} ;

  • 相关阅读:
    l1-010
    l1-009
    L1-008修改
    l1-008
    Codeforces Round #406 (Div. 2)
    求N!的长度【数学】 51nod 1058 1130
    51nod 1090 & 1267 【二分简单题】
    Codeforces Round #405 (Div. 2)
    Codeforces Round #404 (Div. 2)
    PAT 天梯赛真题集(L2、L3)
  • 原文地址:https://www.cnblogs.com/kimbo/p/7066283.html
Copyright © 2011-2022 走看看