hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Lucene-hadoop Wiki] Update of "Hbase/HbaseShell" by udanax
Date Sat, 17 Nov 2007 01:04:01 GMT
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

------------------------------------------------------------------------------
  ||Delete ||'''Delete''' command deletes specified rows in table. [[BR]][[BR]]~-''DELETE
{ column_name, [, column_name] ... | *}[[BR]]{{{    }}}FROM table_name[[BR]]{{{    }}}WHERE
row = 'row-key';''-~ ||
  ||Select ||<99%>'''Select''' command retrieves rows from a table.[[BR]][[BR]]~-''SELECT
{ column_name [, column_name] ... | * }[[BR]]{{{    }}}FROM table_name[[BR]]{{{    }}}[WHERE
row = 'row-key' | STARTING FROM 'row-key'][[BR]]{{{    }}}[NUM_VERSIONS = version_count][[BR]]{{{
   }}}[TIMESTAMP 'timestamp'][[BR]]{{{    }}}[LIMIT = row_count][[BR]]{{{    }}}[INTO FILE
'file_name'][[BR]][[BR]]''-~'''column_name:'''~-''[[BR]]{{{     }}}column_family_name[[BR]]{{{
   }}}| column_family_name:column_label_name''-~ ||
  
+ 
+ == Hbase Shell Algebraic Commands ==
+ 
+ ||<bgcolor="#E5E5E5">'''Command''' ||<bgcolor="#E5E5E5">'''Explanation''' ||
+ ||Table ||<99%>'''Table''' command loads specified table. [[BR]][[BR]]~-''Table('table_name');''-~
||
+ ||Substitute ||<99%>'''Substitute''' specific algebraic expression to specified string[[BR]][[BR]]~-''A
= Projection(column-list);''-~ ||
+ ||Save ||<99%>'''Save''' command will save results to specified table or matrix. [[BR]][[BR]]~-''A
= Table('table_name'); [[BR]]B = A.Selection(condition_expression); [[BR]]Save B Into table(result_table);''-~
||
+ 
  ----
  = Example =
- == Example Of basic command Uses ==
+ == Example Of Basic Command Uses ==
  === Create the table in a Hbase ===
  
  {{{
@@ -136, +144 @@

  
  {{{
  Hbase > SELECT studioName: FROM movieLog_table WHERE row = 'Star Wars';
- +------+----------------------+----------------------+----------------------+
- | No.  | Row                  | Column               | Cell                 |
- +------+----------------------+----------------------+----------------------+
- | 1    | Star Wars            | studioName:          | Fox                  |
- +------+----------------------+----------------------+----------------------+
+ 
+ +----------------------------+
+ | title         studioName   |
+ | ========================== |
+ | Star Wars     Fox          |
+ +----------------------------+
  
  Successfully print out the selected data.(0.05 sec)
  
@@ -173, +182 @@

      --> WHERE row='Star Wars';
  }}}
  
+ 
+ == Example Of Relational Algebraic Command Uses ==
+ 
+ === Relational Projection ===
+ 
+  * selects a subset of the columnfamilies of a relation
+  * Result = π ,,column_list,, (Relation) 
+ {{{
+ Relation
+ +---------------------------------------------------+
+ | title         year   length  inColor studioName   |
+ | ================================================= |
+ | Star Wars     1977   124     true    Fox          |
+ | Mighty Ducks  1991   104     true    Paramount    |
+ +---------------------------------------------------+
+ 
+ Hbase > Result = Relation.Projection('year','legnth');
+ Hbase > save Result into table('result');
+ 
+ Result
+ +------------------------------+
+ | title         year   length  |
+ | ============================ |
+ | Star Wars     1977   124     |
+ | Mighty Ducks  1991   104     |
+ +------------------------------+
+ }}}
+ === Relational Selection ===
+  * selects a subset of the rows in a relation that satisfy a selection condition
+  * Result = σ ,,selection_condition,, (Relation) 
+ {{{
+ Relation
+ +---------------------------------------------------+
+ | title         year   length  inColor studioName   |
+ | ================================================= |
+ | Star Wars     1977   124     true    Fox          |
+ | Mighty Ducks  1991   104     true    Paramount    |
+ +---------------------------------------------------+
+ 
+ Hbase > Result = Relation.Selection(length > 100 and studioName = 'Fox'); 
+      or Result = Relation.Selection(length > 100 and studioName NOT IN ('Fox', 'Paramount'));
+ Hbase > save Result into table('result');
+ 
+ Result
+ +---------------------------------------------------+
+ | title         year   length  inColor studioName   |
+ | ================================================= |
+ | Star Wars     1977   124     true    Fox          |
+ +---------------------------------------------------+
+ }}}
+ 
+ === Relational Group ===
+  * Aggregation functions on collections of data values: average, minimum, maximum, sum,
count.
+  * Group rows by value of an columnfamily and apply aggregate function independently to
each group of rows.
+  * <Grouping columnfamilies> ƒ ,,function_list,, (Relation) 
+ {{{
+ Hbase > Group Relation by (studioName, SUM('vote:user'));
+ }}}
+ 
+ === 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 
+   * Result = R1 ▷◁ ,,θ join_condition,, R2
+ {{{
+ R1
+ +----------------------------------------------------------------------------------------+
+ | title         producer      actor                              studioName            
 |
+ | ======================================================================================
|
+ | Star Wars     George Lucas                                     Fox                   
 |
+ | Mighty Ducks  Blair Peters  actor:hero      <Charles Adler>    Paramount       
       |
+ |                             actor:cameo     <Someone>                          
       |
+ | The Bodyguard Mick Jackson  actor:hero      <Kevin Costner>    Warner Home Video
      |
+ |                             actor:heroine   <Whitney Houston>                  
       |
+ +----------------------------------------------------------------------------------------+
+ 
+ R2
+ +---------------------------------------------------------+
+ | name              occupation   birth         knownFor   |
+ | ======================================================= |
+ | Whitney Houston   Singer       Aug 9, 1963   Diva       |
+ +---------------------------------------------------------+
+ 
+ Hbase > R1 = table('movieLog_table');
+ Hbase > R2 = table('personInfo_table');
+ Hbase > Result = R1.join(R1.producer: = R2.ROW) and R2; 
+      or Result = R1.join(R1.actor:hero = R2.Row) and R2;
+      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  |
+ | =================================================================================================================
|
+ | The Bodyguard Mick Jackson  actor:heroine <Whitney Houston>  Warner Home Video 
Singer      Aug 9, 1963 Diva      |
+ +-------------------------------------------------------------------------------------------------------------------+
+ }}}
+ 
+ === Query mixture examples ===
+ {{{
+ Relation
+ +---------------------------------------------------+
+ | title         year   length  inColor studioName   |
+ | ================================================= |
+ | Star Wars     1977   124     true    Fox          |
+ | Mighty Ducks  1991   104     true    Paramount    |
+ +---------------------------------------------------+
+ 
+ Hbase > Proj = Relation.Projection('year','legnth');
+ Hbase > Result = Proj.Selection(length > 120);
+ Hbase > save Result into table('result');
+ 
+ Result
+ +------------------------------+
+ | title         year   length  |
+ | ============================ |
+ | Star Wars     1977   124     |
+ +------------------------------+
+ }}}
+ 
  ----
  = Comments =
  

Mime
View raw message