INSERT OVERWRITE

INSERT OVERWRITE from a source with UNION ALL is not all for some tables.

Hive 1 and 2

For managed tables, INSERT OVERWRITE from a source with UNION ALL is allowed.

Hive 3

INSERT OVERWRITE from a source with UNION ALL on full CRUD ACID tables is not allowed.

For example, test_groupby_3 is a managed table and insert overwrite with union all will throw an error.
insert overwrite table test_groupby_3
. . . . . . . . . . . . . . . . . . . . . . .> select col1,count from test_groupby
. . . . . . . . . . . . . . . . . . . . . . .> union all
. . . . . . . . . . . . . . . . . . . . . . .> select col1,count from test_groupby_1;
 
ERROR : FAILED: Error in acquiring locks: QueryId=hive_20220321114459_851b1546-ca9f-4643-b888-7df23adaec66 is not supported due to OVERWRITE and UNION ALL.  Please use truncate + insert

Action Required

Instead of overwrite, use truncate and insert.

Distribution Affected

CDH5, CDH6, HDP2