Error while compiling statement: FAILED: SemanticException Cartesian products are disabled for .....

本文介绍了解决Hive中禁止笛卡尔积的错误,通过设置hive.strict.checks.cartesian.product和hive.mapred.mode为nostrict,以实现显示所有比赛组合的需求。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

问题

要执行的sql(需求:显示所有可能的比赛组合)

select a.name,b.name from problem3 a, problem3 b where a.name < b.name;

报错:

[5] J. K. Author, Title of the Report, Report No., month, year.
SQL 错误 [40000] [42000]: Error while compiling statement: 
FAILED: SemanticException Cartesian products are disabled for safety reasons. 
If you know what you are doing, 
please set hive.strict.checks.cartesian.product to false and that hive.
mapred.mode is not set to 'strict' to proceed. 
Note that if you may get errors or incorrect results if you make a mistake while using some of the unsafe features.

解决

按上面要求开启对应的配置即可,因为hive默认不让你笛卡儿积,这个代价太大,数据量会很大。

set hive.strict.checks.cartesian.product = false;
set hive.mapred.mode = nostrict;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值