How allow hive.mapred.mode=nonstrict? How allow hive.mapred.mode=nonstrict? hadoop hadoop

How allow hive.mapred.mode=nonstrict?


As you already know a cartesian product is not allowed in strict mode (and for good reasons). In your use case it seems like you don't have permissions to make changes to these type of hive settings.

To hack around this problem what you could do is the following.First create two new tables

create table new_1 as SELECT *,1 as join_key from table1;create table new_2 as SELECT *,1 as join_key2 from table2;

Then join these tables on this join_key. The result will be the cartesian product since it will match each row of table1 with each row of table2.

select * from new_1 join new_2 on join_key=join_key2

Just found out that using --hiveconf solves the problem:

hive -v -f  my_file.hql --hiveconf hive.mapred.mode=nonstrict

will allow the nonstrict mode specifically for this query.