hive 嚴格模式

2021-10-08 01:23:46 字數 1802 閱讀 3054

hive提供了乙個嚴格模式,可以防止使用者執行那些可能產生意向不到的不好的效果的查詢。說通俗一點就是這種模式可以阻止某些查詢的執行。通過如下語句設定嚴格模式:

hive>

set hive.mapred.

mode

=strict;

hive>

select

distinct

(planner_id)

from fracture_ins where planner_id=

5;

執行後會出現如下錯誤:

failed: error in semantic analysis: no partition predicate found for alias 「fracture_ins」 table "fracture_ins

解決方案是在where中增加分割槽條件:

hive>

select

distinct

(planner_id)

from fracture_ins

>

where planner_id=

5and hit_date=

20120101

;

hive>

select

*from fracture_ins where hit_date>

2012

order

by planner_id;

出現如下錯誤:

failed: error in semantic analysis: line 1:56 in strict mode,

limit must be specified if order by is present planner_id

解決方案就是增加乙個limit關鍵字:

hive>

select

*from fracture_ins where hit_date>

2012

order

by planner_id

>

limit

100000

;

hive>

select

*from fracture_act join fracture_ads

where fracture_act.planner_id = fracture_ads.planner_id;

出現如下錯誤:

failed: error in semantic analysis: in strict mode, cartesian product

is not allowed. if you really want to perform the operation,

+set hive.mapred.mode=nonstrict+

解決方案就是加上on語句:

hive>

select

*from fracture_act join fracture_ads

>

on(fracture_act.planner_id = fracture_ads.planner_id)

;

hive嚴格模式

hive嚴格模式 hive提供了乙個嚴格模式,可以防止使用者執行那些可能產生意想不到的不好的效果的查詢。即某些查詢在嚴格 模式下無法執行。1 帶有分割槽的表的查詢 如果在乙個分割槽表執行hive,除非where語句中包含分割槽字段過濾條件來顯示資料範圍,否則不允許執行。換句話說,就是使用者不允許掃瞄...

hive嚴格模式

說真的,這個模式在我做sql開發的歲月裡,從未用到過。用的都是動態分割槽非嚴格模式。我的好友東嶽同學在車上問我。確實問到了我 體現出了我基本功不紮實的情況。hive提供了乙個嚴格模式,可以防止使用者執行那些可能產生意向不到的不好的效果的查詢。說通俗一點就是這種模式可以阻止某些查詢的執行。通過如下語句...

hive優化 嚴格模式

預設配置為 hive.mapred.mode nonstrict the mode in which the hive operations are being performed.in strict mode,some risky queries are not allowed to run.th...