SemanticException Cartesian products are disabled for safety reasons. If you know what you are doin

 SemanticException Cartesian products are disabled for safety reasons. If you know what you are doing, please sethive.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. (state=42000,code=40000)

 

這個是爲防止大數據集羣穩定性,類似非全等join(非inner join)是禁止的,禁用了SemanticException笛卡爾產品。如果您知道自己在做什麼,請將hive.strict.checks.cartesian.product設置爲false,並且hive.mapred.mode未設置爲“strict”以繼續。請注意,如果在使用某些不安全功能時出錯,則可能會得到錯誤或不正確的結果。(州=42000,代碼=40000)

set hive.strict.checks.cartesian.product=flase;

set hive.mapred.mode=nonstrict;

 

一,

>set hive.strict.checks.cartesian.product=flase;

設置是否嚴格檢查笛卡爾積操作,當設置爲flase的時候是不嚴格,可以笛卡爾積操作,類似join,

反之當設置爲true的時候不可以笛卡爾積操作,不能join

二,

>set hive.mapred.mode=nonstrict;是非嚴格模式

如果設置爲strict(嚴格模式),有三個影響

1.在order by 的時候必須使用limit限制輸出條數,因爲hivesql跟傳統的sql一樣,都會做全局排序,但是hive的底層是MR,爲保證順序性order by會將數據都交給一個reducer。這樣會造成數據傾斜不出數據,因此嚴格模式必須使用limit提升性能,同時跟傳統的sql唯一的區別是mysql可以不用limit

2.在分區表裏,必須使用分區,多分區的指定一個分區也行,

3.在使用join語句的時候,必須使用on。標配join...on...,left  join..on...

發佈了41 篇原創文章 · 獲贊 5 · 訪問量 2萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章