MSCK REPAIR hive external tables

帅比萌擦擦* 提交于 2021-01-21 09:37:08

问题


I have a daily ingestion of data in to HDFS . From data into HDFS I generate Hive external tables partitioned by date . My qestion is as follows , should I run MSCK REPAIR TABLE tablename after each data ingestion , in this case I have to run the command each day. Or running it just one time at the table creation is enough . Thanks a lot for your answers

Best regards


回答1:


You only run MSCK REPAIR TABLE while the structure or partition of the external table is changed. This command updates the metadata of the table.

One example that usually happen, e.g.

You use a field dt which represent a date to partition the table.

  • Yesterday, you inserted some data which is dt=2018-06-12, then you should run MSCK REPAIR TABLE to update the metadata to tell hive to aware a new partition dt=2018-06-12.
  • Today, you insert some data which is dt=2018-06-13, then you should run MSCK REPAIR TABLE to update the metadata to tell hive to aware a new partition dt=2018-06-13.


来源:https://stackoverflow.com/questions/50832059/msck-repair-hive-external-tables

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!