Dear Wiki user, You have subscribed to a wiki page or wiki category on "Lucene-hadoop Wiki" for change notification.
The following page has been changed by udanax: http://wiki.apache.org/lucene-hadoop/Hbase/HbaseShell The comment on the change is: add a example of nested-loop join ------------------------------------------------------------------------------ {{{ Hbase > SELECT studioName: FROM movieLog_table WHERE row = 'Star Wars'; - +----------------------------+ + +---------------------------------------------+ - | title studioName | + | title studioName | - | ========================== | + | =========================================== | - | Star Wars Fox | + | Star Wars Fox Entertainment Group, Inc. | - +----------------------------+ + +---------------------------------------------+ Successfully print out the selected data.(0.05 sec) - Hbase > SELECT 'studioName:YoungGu Art' FROM movieLog_table WHERE row = 'D-War'; + Hbase > SELECT 'studioName:YoungGu Art, Corp.' FROM movieLog_table WHERE row = 'D-War'; }}} === Insert data into a table === @@ -188, +188 @@ * Result = Ï ,,column_list,, (Relation) {{{ Relation - +---------------------------------------------------+ + +--------------------------------------------------------------------+ - | title year length inColor studioName | + | title year length inColor studioName | - | ================================================= | + | ================================================================== | - | Star Wars 1977 124 true Fox | + | Star Wars 1977 124 true Fox Entertainment Group, Inc. | - | Mighty Ducks 1991 104 true Paramount | + | Mighty Ducks 1991 104 true Paramount Pictures Corp. | - +---------------------------------------------------+ + +--------------------------------------------------------------------+ Hbase > Result = Relation.Projection('year','legnth'); Hbase > save Result into table('result'); @@ -211, +211 @@ * Result = Ï ,,selection_condition,, (Relation) {{{ Relation - +---------------------------------------------------+ + +--------------------------------------------------------------------+ - | title year length inColor studioName | + | title year length inColor studioName | - | ================================================= | + | ================================================================== | - | Star Wars 1977 124 true Fox | + | Star Wars 1977 124 true Fox Entertainment Group, Inc. | - | Mighty Ducks 1991 104 true Paramount | + | Mighty Ducks 1991 104 true Paramount Pictures Corp. | - +---------------------------------------------------+ + +--------------------------------------------------------------------+ - Hbase > Result = Relation.Selection(length > 100 and studioName = 'Fox'); + Hbase > Result = Relation.Selection(length > 100 and studioName = 'Fox Entertainment Group, Inc.'); - or Result = Relation.Selection(length > 100 and studioName NOT IN ('Fox', 'Paramount')); + or Result = Relation.Selection(length > 100 + and studioName NOT IN ('Fox Entertainment Group, Inc.', 'Paramount Pictures Corp.')); Hbase > save Result into table('result'); Result - +---------------------------------------------------+ + +--------------------------------------------------------------------+ - | title year length inColor studioName | + | title year length inColor studioName | - | ================================================= | + | ================================================================== | - | Star Wars 1977 124 true Fox | + | Star Wars 1977 124 true Fox Entertainment Group, Inc. | - +---------------------------------------------------+ + +--------------------------------------------------------------------+ }}} === Relational Group === @@ -239, +240 @@ }}} === Relational Join === - * The join of two relations R1(A,,1,, ,A,,2,, ,...,A,,n,,) and R2(B,,1,, ,B,,2,, ,...,B,,m,,) is a relation with degree k=n+m and attributes (A,,1,, ,A,,2,, ,...,A,,n,, , B,,1,, ,B,,2,, ,...,B,,m,,) that satisfy the join condition + * The join of two relations R1(A,,1,, ,A,,2,, ,...,A,,n,,) and R2(B,,1,, ,B,,2,, ,...,B,,m,,) is a relation with degree k=n+m and attributes (A,,1,, ,A,,2,, ,...,A,,n,, , B,,1,, ,B,,2,, ,...,B,,m,,) that satisfy the join condition * Result = R1 â·â ,,θ join_condition,, R2 {{{ R1 - +----------------------------------------------------------------------------------------+ + +----------------------------------------------------------------------------------------------+ - | title producer actor studioName | + | title producer actor studioName | - | ====================================================================================== | + | ============================================================================================ | - | Star Wars George Lucas Fox | + | Star Wars George Lucas Fox Entertainment Group, Inc. | - | Mighty Ducks Blair Peters actor:hero <Charles Adler> Paramount | + | Mighty Ducks Blair Peters actor:hero <Charles Adler> Paramount Pictures Corp. | - | actor:cameo <Someone> | + | actor:cameo <Someone> | - | The Bodyguard Mick Jackson actor:hero <Kevin Costner> Warner Home Video | + | The Bodyguard Mick Jackson actor:hero <Kevin Costner> Warner Home Video Inc. | - | actor:heroine <Whitney Houston> | + | actor:heroine <Whitney Houston> | - +----------------------------------------------------------------------------------------+ + +----------------------------------------------------------------------------------------------+ R2 +---------------------------------------------------------+ @@ -267, +268 @@ or Result = R1.join(R1.actor:heroine = R2.Row and R1.studioName = 'Warner Home Video' and R2.occupation = 'Singer') and R2; Result - +-------------------------------------------------------------------------------------------------------------------+ + +------------------------------------------------------------------------------------------------------------------------+ - | title producer actor studioName occupation birth knownFor | + | title producer actor studioName occupation birth knownFor | - | ================================================================================================================= | + | ====================================================================================================================== | - | The Bodyguard Mick Jackson actor:heroine <Whitney Houston> Warner Home Video Singer Aug 9, 1963 Diva | + | The Bodyguard Mick Jackson actor:heroine <Whitney Houston> Warner Home Video Inc. Singer Aug 9, 1963 Diva | - +-------------------------------------------------------------------------------------------------------------------+ + +------------------------------------------------------------------------------------------------------------------------+ + }}} + + * If we don't have an index for a domain in the join, we can still improve on the nested-loop join using sort join. + * https://issues.apache.org/jira/browse/HADOOP-2021 + + {{{ + R1 + +----------------------------------------------------------------------------------------------+ + | title producer actor studioName | + | ============================================================================================ | + | Star Wars George Lucas Fox Entertainment Group, Inc. | + | Mighty Ducks Blair Peters actor:hero <Charles Adler> Paramount Pictures Corp. | + | actor:cameo <Someone> | + | The Bodyguard Mick Jackson actor:hero <Kevin Costner> Warner Home Video Inc. | + | actor:heroine <Whitney Houston> | + +----------------------------------------------------------------------------------------------+ + + R2 + +--------------------------------------------------------------------------------------------------+ + | Symbol corporation Market Management | + | ================================================================================================ | + | CSCO Cisco Systems, inc. Market:NASDAQ Management:CEO <John T. Chambers> | + | Fox Fox Entertainment Group, Inc. Market:NYSE Management:President <Peter F. Chernin> | + | Management:SEVP <David F. DeVoe> | + | ... | + +--------------------------------------------------------------------------------------------------+ + + R1 = table('movieLog_table'); + R2 = table('stockCompany_info'); + result = R1.join(R1.studioName = R2.corporation) and R2; }}} === Query mixture examples === {{{ Relation - +---------------------------------------------------+ + +--------------------------------------------------------------------+ - | title year length inColor studioName | + | title year length inColor studioName | - | ================================================= | + | ================================================================== | - | Star Wars 1977 124 true Fox | + | Star Wars 1977 124 true Fox Entertainment Group, Inc. | - | Mighty Ducks 1991 104 true Paramount | + | Mighty Ducks 1991 104 true Paramount Pictures Corp. | - +---------------------------------------------------+ + +--------------------------------------------------------------------+ Hbase > Proj = Relation.Projection('year','legnth'); Hbase > Result = Proj.Selection(length > 120);