How does Ali MaxCompute (formerly ODPS) modify column field data types

  • First of all, odps currently does not support modifying the column field data types of existing tables

  • Secondly, there are always ways, the following is my way

    1. Create a new table tb_tmp on the ODPS that is consistent with the original table. Note that the new table uses the modified field type

pass

 

    2. Call the dynamic partition statement on the ODPS to write the value of the original partition table tb to the new table tb_tmp

 

INSERT OVERWRITE TABLE tb_tmp PARTITION (partcol1 ...) 
select col1,col2,partcol1... FROM tb;

 

    3. Check whether the data amount of the original table and the new table is consistent with the partition

pass

 

    4. Delete the original table tb

1 DROP TABLE tb

 

    5. Rename the new table tb_tmp to tb

1 ALTER TABLE tb_tmp RENAME TO tb

 

Reference materials: https://help.aliyun.com/document_detail/73779.html?spm=a2c4g.11186623.6.690.645b65d5T9daDG

Guess you like

Origin www.cnblogs.com/wfwup/p/12721729.html