Creating temp table from another table including partition column in hive

天涯浪子 提交于 2019-12-02 04:18:29

This is a problem with source table xyz because it contains partition __HIVE_DEFAULT_PARTITION__

Hive creates a partition with value __HIVE_DEFAULT_PARTITION__ when in dynamic partition mode inserted partition value is NULL.

Partition __HIVE_DEFAULT_PARTITION__ is not compatible with numeric type and this causing error because it cannot be cast to numeric type.

To remove or query this partition, you need to change the column type to string first:

ALTER TABLE xyz PARTITION COLUMN (col4 string);

Of course you may want to backup table and check the data before removing and decide what to do with this data.

To remove partition:

ALTER TABLE xyz DROP PARTITION (col4 = '__HIVE_DEFAULT_PARTITION__');

After removing partition you can change the type of partition column back to numeric type.

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