I have the following set of hive tables :
create table image_additions (
customer_id STRING,
image_key STRING,
image_size STRING
);
create table image_removals (
customer_id STRING,
image_key STRING,
image_size STRING
);
create table images_stored (
customer_id STRING,
image_key STRING,
image_size STRING
);
And I want to run an insert from a query like the following :
insert into images_stored
select ia.customer_id,
ia.image_key,
ia.image_size
from image_additions ia
where ia.image_key not in
(select ir.image_key from image_removals ir);
This produces a cartesian product, and hive does not allow me to run it. How can I do this, using an alternative query ?