How to delete and update a record in Hive

后端 未结 15 1367
梦如初夏
梦如初夏 2020-11-28 19:26

I have installed Hadoop, Hive, Hive JDBC. which are running fine for me. But I still have a problem. How to delete or update a single record using Hive because delete or upd

15条回答
  •  无人及你
    2020-11-28 20:02

    You can delete rows from a table using a workaround, in which you overwrite the table by the dataset you want left into the table as a result of your operation.

    insert overwrite table your_table 
        select * from your_table 
        where id <> 1
    ;
    

    The workaround is useful mostly for bulk deletions of easily identifiable rows. Also, obviously doing this can muck up your data, so a backup of the table is adviced and care when planning the "deletion" rule also adviced.

提交回复
热议问题