導讀 跟大家講解下有關hive中left outer join 的問題,相信小伙伴們對這個話題應該也很關注吧,現在就為小伙伴們說說hive中left outer join
跟大家講解下有關hive中left outer join 的問題,相信小伙伴們對這個話題應該也很關注吧,現在就為小伙伴們說說hive中left outer join 的問題,小編也收集到了有關hive中left outer join 的問題的相關資料,希望大家看到了會喜歡。
hive中leftouterjoin的問題,where過濾條件寫的地方不對,得出的結果不一樣,請看下面的代碼過程,不用多解釋。 Hive Hadoop hive desc t1; OKid int name string p_id int Time taken: 0.118 seconds, Fetched: 3 row(s)hive desc t2;OKid int name string T
hive中left outer join 的問題,where過濾條件寫的地方不對,得出的結果不一樣,請看下面的代碼過程,不用多解釋。 Hive Hadoop .CodeEntity .code_pieces ul.piece_anchor{width:25px;position:absolute;top:25px;left:-30px;z-index:1000;}.CodeEntity .code_pieces ul.piece_anchor li{width:25px;background: #efe;margin-bottom:2px;}.CodeEntity .code_pieces ul.piece_anchor li{border-left:3px #40AA63 solid;border-right:3px #efe solid;}.CodeEntity .code_pieces ul.piece_anchor li:hover{border-right:3px #40AA63 solid;border-left:3px #efe solid;}.CodeEntity .code_pieces ul.piece_anchor li a{color: #333;padding: 3px 10px;}.CodeEntity .code_pieces .jump_to_code{visibility:hidden;position:relative;}.CodeEntity .code_pieces .code_piece:hover .jump_to_code{visibility:visible;}.CodeEntity .code_pieces .code_piece:hover .jump_to_code a{text-decoration:none;}.CodeEntity .code_pieces h2 i{float:right;font-style:normal;font-weight:normal;}.CodeEntity .code_pieces h2 i a{font-size:9pt;background: #FFFFFF;color:#00A;padding: 2px 5px;text-decoration:none;} hive> desc t1; OKid int name string p_id int Time taken: 0.118 seconds, Fetched: 3 row(s)hive> desc t2;OKid int name string Time taken: 0.051 seconds, Fetched: 2 row(s)hive> select * from t1;OK1 aaa 22 bbb 23 ccc 34 ddd 45 fff 36 ooo 23Time taken: 0.418 seconds, Fetched: 6 row(s)hive> select * from t2;OK4 jjj4 jjj4 jjj2 abc3 hhh4 jjj3 ii2 fuck7 shitTime taken: 0.068 seconds, Fetched: 9 row(s)hive> select * from t1 left outer join t2 on (t1.p_id=t2.id) where t2.name='abc';OK1 aaa 2 2 abc2 bbb 2 2 abcTime taken: 21.53 seconds, Fetched: 2 row(s)hive> select * from t1 left outer join t2 on (t1.p_id=t2.id and t2.name='abc'); OK1 aaa 2 2 abc2 bbb 2 2 abc3 ccc 3 NULL NULL4 ddd 4 NULL NULL5 fff 3 NULL NULL6 ooo 23 NULL NULLTime taken: 17.676 seconds, Fetched: 6 row(s)hive left outer join 要過濾右表的數據應該是第二種寫法,第一種是mysql的寫法,但是在hive中會存在問題。來源:php中文網