9.6 严格模式
Hive 提供了一个严格模式,可以防止用户执行那些可能带来意想不到的不好的影响的查询。
hive.mapred.mode
默认是 nonestrict
, 修改为 strict
就开起来严格模式.
<property>
<name>hive.mapred.mode</name>
<value>strict</value>
<description>
The mode in which the Hive operations are being performed.
In strict mode, some risky queries are not allowed to run. They include:
Cartesian Product.
No partition being picked up for a query.
Comparing bigints and strings.
Comparing bigints and doubles.
Orderby without limit.
</description>
</property>
1)
2)
3)
在2.x 新版本中上面属性被标记为过时了, 使用hive.strict.checks.*
系列属性来代替:
<property>
<name>hive.strict.checks.large.query</name>
<value>false</value>
<description>
Enabling strict large query checks disallows the following:
Orderby without limit.
查询分区表单的时候没有使用分区
No partition being picked up for a query against partitioned table.
不考虑数据量, 仅仅考虑查询模式
Note that these checks currently do not consider data size, only the query pattern.
</description>
</property>
<property>
<name>hive.strict.checks.type.safety</name>
<value>true</value>
<description>
Enabling strict type safety checks disallows the following:
bigint和字符串比较
Comparing bigints and strings.
bigint和double比较
Comparing bigints and doubles.
</description>
</property>
<property>
<name>hive.strict.checks.cartesian.product</name>
<value>true</value>
<description>
Enabling strict Cartesian join checks disallows the following:
不允许笛卡尔积
Cartesian product (cross join).
</description>
</property>
<property>
<name>hive.strict.checks.bucketing</name>
<value>true</value>
<description>
Enabling strict bucketing checks disallows the following:
向分桶表加载数据
Load into bucketed tables.
</description>
</property>