通过严格模式,Hive可以防止用户执行一些性能不好的HQL语句。 建议开启严格模式。
hive-site.xml:
hive.strict.checks.orderby.no.limit
false
hive.strict.checks.no.partition.filter
false
hive.strict.checks.type.safety
true
hive.strict.checks.cartesian.product
false
hive.strict.checks.bucketing
true
开启严格模式可以禁止3种类型的查询:
- 对于分区表,除非where语句中含有分区字段过滤条件来限制范围,否则不允许执行。
- 对于使用了order by语句的查询,要求必须使用limit语句。
- 限制笛卡尔积的查询。
示例: 默认情况下下面三条语句都能正常执行并出结果:
- select * from tb_dept_partition;
- select * from tb_dept order by loc;
- select tb_emp.ename,tb_dept.dname from tb_emp,tb_dept;