HIVE modify the table

  1. Rename the
    syntax:
    the ALTER the Table table name rename to new table name;

  2. Add Field:
    ALTER table Table add columns (1 Field Name Data Type 1, ...);

  3. Alternatively modify the field all fields
    alter table table replace columns (1 Field Name Data Type 1, ...);

  4. Nature of the partition table is added to add a new partition on a subdirectory HDFS
    ALTER table Table add partition (partition field = value, ...);

    alter table logs add partition (dt='2018-08-09',country='cq'); 
    alter table   studnet_p   add partition ( class='bigdata0003'  );
    
  5. Delete Partition
    alter table table name drop partition (partition field = value, ...);
    alter table logs drop partition (dt = '2018-08-09', Country = 'CQ');
    alter table studnet_p drop partition (class = 'bigdata0003 ');

  6. Modify a field
    alter table table name change columns (1 Field Name Data Type 1, ...);

Delete the table:

drop  table   if exists    表名

When the read mode: when the hive queries to check the correctness of the data card

Write mode: pass through a relational database, data is inserted to check the correctness of the data card

Published 133 original articles · won praise 53 · views 20000 +

Guess you like

Origin blog.csdn.net/weixin_43599377/article/details/103812457