简体   繁体   English

如何在 Hive 中无限制地防止 sql?

[英]How to prevent sql without limit in Hive?

Many users are used to using 'select * from tables' in oracle/mysql很多用户习惯在oracle/mysql中使用'select * from tables'

But i should not allow them to query like that in hive但是我不应该让他们在 hive 中这样查询

Is there any way to prevent a full_table scan in hive?有什么办法可以防止在 hive 中进行 full_table 扫描?

Like trigger or somethng else?像触发器还是别的什么?

Thanks a lot!非常感谢!

To prevent full table scan use these settings.要防止全表扫描,请使用这些设置。

set hive.mapred.mode=strict;  --prevent full scan
SET hive.limit.query.max.table.partition=10; --limit partitions to 10

Hive will generate exception if partition predicate is not specified:如果未指定分区谓词,Hive 将产生异常:

FAILED: SemanticException [Error 10041]: No partition predicate found

And exception example in case the number of partitions exceeded:以及超出分区数的例外示例:

SemanticException Number of partitions scanned (=37) on table

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM