You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by Apache Wiki <wi...@apache.org> on 2008/03/28 03:56:27 UTC

[Hadoop Wiki] Update of "Hbase/HbaseShell" by OwenOMalley

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Hadoop Wiki" for change notification.

The following page has been changed by OwenOMalley:
http://wiki.apache.org/hadoop/Hbase/HbaseShell

------------------------------------------------------------------------------
  = Hbase Shell Introduction =
-  * A Query Language Shell for Hadoop + Hbase 
+  * A Query Language Shell for Hadoop + Hbase
  
  == Initial Contributor ==
  
@@ -27, +27 @@

  All commands are terminated with a semi-colon: e.g. Type 'help;' to see list of available commands.
  ----
  = HQL =
- ==  Table of Contents ==
+ == Table of Contents ==
  
  {{{ }}}1. [#QueryGrammars Query Grammars] [[BR]]
- {{{    }}}1.1 [#DAL Database administration language] [[BR]]
+ {{{ }}}1.1 [#DAL Database administration language] [[BR]]
- {{{    }}}1.2 [#DDL Data definition language] [[BR]]
+ {{{ }}}1.2 [#DDL Data definition language] [[BR]]
- {{{    }}}1.3 [#DML Data manipulation language] [[BR]]
+ {{{ }}}1.3 [#DML Data manipulation language] [[BR]]
  {{{ }}}2. [#Example Example Of HQL Uses] [[BR]]
- {{{    }}}2.1 [#Create Create the table in a Hbase] [[BR]]
+ {{{ }}}2.1 [#Create Create the table in a Hbase] [[BR]]
- {{{    }}}2.2 [#Select Select data from a table] [[BR]]
+ {{{ }}}2.2 [#Select Select data from a table] [[BR]]
- {{{    }}}2.3 [#Insert Insert data into a table] [[BR]]
+ {{{ }}}2.3 [#Insert Insert data into a table] [[BR]]
- {{{    }}}2.4 [#Delete Delete data in a table] [[BR]]
+ {{{ }}}2.4 [#Delete Delete data in a table] [[BR]]
- {{{    }}}2.5 [#Jar How to use external jars in Hbase Shell] [[BR]]
+ {{{ }}}2.5 [#Jar How to use external jars in Hbase Shell] [[BR]]
  
  [[Anchor(QueryGrammars)]]
  == Query Grammars ==
@@ -59, +59 @@

  Data definition langague to define data tables
  
  ||<bgcolor="#ececec">'''Syntax''' ||<bgcolor="#ececec">'''Explanation''' ||
- ||Create ||<99%>'''Create''' a new table.[[BR]][[BR]]~-''CREATE TABLE table_name ([[BR]]{{{    }}}column_family_definition[[BR]]{{{    }}}[, column_family_spec][[BR]]{{{    }}}...[[BR]])[[BR]][[BR]]''-~'''colum_family_definition:'''~-''[[BR]]column_family_name[[BR]]{{{  }}}[MAX_VERSIONS=n][[BR]]{{{    }}}[MAX_LENGTH=n][[BR]]{{{    }}}[COMPRESSION=NONE|BLOCK|RECORD][[BR]]{{{    }}}[IN_MEMORY][[BR]]{{{    }}}[BLOOMFILTER=NONE|BLOOMFILTER|COUNTING_BLOOMFILTER|RETOUCHED_BLOOMFILTER VECTOR_SIZE=n NUM_HASH=n]''-~ ||
+ ||Create ||<99%>'''Create''' a new table.[[BR]][[BR]]~-''CREATE TABLE table_name ([[BR]]{{{ }}}column_family_definition[[BR]]{{{ }}}[, column_family_spec][[BR]]{{{ }}}...[[BR]])[[BR]][[BR]]''-~'''colum_family_definition:'''~-''[[BR]]column_family_name[[BR]]{{{ }}}[MAX_VERSIONS=n][[BR]]{{{ }}}[MAX_LENGTH=n][[BR]]{{{ }}}[COMPRESSION=NONE|BLOCK|RECORD][[BR]]{{{ }}}[IN_MEMORY][[BR]]{{{ }}}[BLOOMFILTER=NONE|BLOOMFILTER|COUNTING_BLOOMFILTER|RETOUCHED_BLOOMFILTER VECTOR_SIZE=n NUM_HASH=n]''-~ ||
- ||Alter ||<99%>'''Alter''' syntax changes the structure of the specified table.[[BR]][[BR]]~-''ALTER TABLE table_name[[BR]]{{{    }}}alter_definition [, alter_definition] ...[[BR]][[BR]]''-~'''alter_definition:'''~-''[[BR]]{{{     }}}ADD column_family_definition[[BR]]{{{    }}}| ADD (column_family_definition, ...)[[BR]]{{{    }}}| DROP column_family_name[[BR]]{{{    }}}| CHANGE column_family_name column_family_definition''-~||
+ ||Alter ||<99%>'''Alter''' syntax changes the structure of the specified table.[[BR]][[BR]]~-''ALTER TABLE table_name[[BR]]{{{ }}}alter_definition [, alter_definition] ...[[BR]][[BR]]''-~'''alter_definition:'''~-''[[BR]]{{{ }}}ADD column_family_definition[[BR]]{{{ }}}| ADD (column_family_definition, ...)[[BR]]{{{ }}}| DROP column_family_name[[BR]]{{{ }}}| CHANGE column_family_name column_family_definition''-~||
  ||Drop ||'''Drop''' columnfamilies in a table or tables.[[BR]][[BR]]~-''DROP [ALL|TABLE table_name1[, table_name2, ...]];''-~ ||
  ||Truncate ||'''Truncate''' cleans all data from a table. [[BR]][[BR]]~-''TRUNCATE TABLE table_name;''-~ ||
  ||Enable/Disable ||'''Enable/Disable''' table lock. [[BR]][[BR]]~-''[ENABLE|DISABLE] [ALL|table_name];''-~ ||
@@ -70, +70 @@

  Data manipulation language to manually manipulate data on more detailed parts
  
  ||<bgcolor="#ececec">'''Syntax''' ||<bgcolor="#ececec">'''Explanation''' ||
- ||Insert ||<99%>'''Insert''' one row into the table with a value for specified column in the table.[[BR]][[BR]]~-''INSERT INTO table_name (colmn_name, ...)[[BR]]{{{    }}}VALUES ('value', ...)[[BR]]{{{    }}}WHERE row = 'row-key'[[BR]]{{{    }}}[TIMESTAMP 'timestamp'];''-~ ||
+ ||Insert ||<99%>'''Insert''' one row into the table with a value for specified column in the table.[[BR]][[BR]]~-''INSERT INTO table_name (colmn_name, ...)[[BR]]{{{ }}}VALUES ('value', ...)[[BR]]{{{ }}}WHERE row = 'row-key'[[BR]]{{{ }}}[TIMESTAMP 'timestamp'];''-~ ||
- ||Delete ||'''Delete''' specified rows in table. [[BR]][[BR]]~-''DELETE { column_name, [, column_name] ... | COLUMNFAMILIES(column_family[, column_family] ... | *} [[BR]]{{{    }}}FROM table_name[[BR]]{{{    }}}[WHERE row = 'row-key'];''-~ ||
+ ||Delete ||'''Delete''' specified rows in table. [[BR]][[BR]]~-''DELETE { column_name, [, column_name] ... | COLUMNFAMILIES(column_family[, column_family] ... | *} [[BR]]{{{ }}}FROM table_name[[BR]]{{{ }}}[WHERE row = 'row-key'];''-~ ||
- ||Select ||<99%>'''Select''' syntax retrieves rows from a table.[[BR]]Several aggregate operators: COUNT()[[BR]][[BR]]~-''SELECT { column_name [, column_name] ... | expr[alias] | * }[[BR]]{{{    }}}FROM table_name[[BR]]{{{    }}}[WHERE row = 'row-key' | STARTING FROM 'row-key' [UNTIL 'stop-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''-~ ||
+ ||Select ||<99%>'''Select''' syntax retrieves rows from a table.[[BR]]Several aggregate operators: COUNT()[[BR]][[BR]]~-''SELECT { column_name [, column_name] ... | expr[alias] | * }[[BR]]{{{ }}}FROM table_name[[BR]]{{{ }}}[WHERE row = 'row-key' | STARTING FROM 'row-key' [UNTIL 'stop-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''-~ ||
  [[Anchor(Example)]]
  == Example Of HQL Uses ==
  [[Anchor(Create)]]
@@ -80, +80 @@

  
  {{{
  hql > help create;
- CREATE    Create tables
+ CREATE Create tables
  
  Syntax:
  CREATE TABLE table_name (
          column_family_definition [, column_family_definition] ...
-         );
+         )
  column_family_definition:
          column_family_name
          [MAX_VERSIONS=n]
@@ -101, +101 @@

   * ~-'''MAX_LENGTH''' specifies the maximum size of a column value. By default, the maximum size is unlimited. It is limited only by Integer.MAX_VALUE.-~
   * ~-'''COMPRESSION''' specifies which compression technique to use for the column family. By default, Hbase does not compress any data.-~
   * ~-'''IN_MEMORY''' specifies whether to keep the values in the column family in-memory, or not. By default, values are not kept in-memory.-~
-  * ~-'''BLOOMFILTER''' specifies which bloom filter to use for the column family. By default, none of the bloom filters is used. You can specify the options in two ways: with '''VECTOR_SIZE''' and '''NUM_HASH''', or with '''NUM_ENTRIES'''. '''VECTOR_SIZE''' specifies the number of elements in the vector, and '''NUM_HASH''' specifies the number of hash functions to use; With '''NUM_ENTRIES''', you  specify only the approximated number of entries in the column, and '''VECTOR_SIZE''' and '''NUM_HASH''' are automatically determined.-~
+  * ~-'''BLOOMFILTER''' specifies which bloom filter to use for the column family. By default, none of the bloom filters is used. You can specify the options in two ways: with '''VECTOR_SIZE''' and '''NUM_HASH''', or with '''NUM_ENTRIES'''. '''VECTOR_SIZE''' specifies the number of elements in the vector, and '''NUM_HASH''' specifies the number of hash functions to use; With '''NUM_ENTRIES''', you specify only the approximated number of entries in the column, and '''VECTOR_SIZE''' and '''NUM_HASH''' are automatically determined.-~
  
  {{{
  hql > CREATE TABLE movieLog_table (
@@ -117, +117 @@

  === Select data from a table ===
  {{{
  hql > help select;
- SELECT    Select values from tables
+ SELECT Select values from tables
  
  Syntax:
  SELECT { column_name, [, column_name] ... | expr[alias] | *} FROM table_name
@@ -125, +125 @@

          [NUM_VERSIONS = version_count]
          [TIMESTAMP 'timestamp']
          [LIMIT = row_count]
-         [INTO FILE 'file_name'];
+         [INTO FILE 'file_name']
  }}}
  
  '''SELECT''' retrieves a subset of data from the specified table.
@@ -133, +133 @@

   * ~-'''STARTING FROM''' returns all the rows starting from 'row-key'.-~
   * ~-'''NUM_VERSIONS''' retrieves only the recent n versions of values in a cell.-~
   * ~-'''TIMESTAMP''' returns only the values with the specified timestamp.-~
-  * ~-'''LIMIT''' limits the number of rows to be returned.-~ 
+  * ~-'''LIMIT''' limits the number of rows to be returned.-~
  
  {{{
  hql > SELECT studioName: FROM movieLog_table WHERE row = 'Star Wars';
  
  +----------------------------+
- | title         studioName   |
+ | title studioName |
  | ========================== |
- | Star Wars     Fox          |
+ | Star Wars Fox |
  +----------------------------+
  
  Successfully print out the selected data.(0.05 sec)
@@ -153, +153 @@

  === Insert data into a table ===
  {{{
  hql > help insert;
- INSERT    Insert values into tables
+ INSERT Insert values into tables
  
  Syntax:
  INSERT INTO table_name
@@ -165, +165 @@

          | column_family_name:column_label_name
  }}}
  
- '''INSERT''' inserts a set of values into a table. 
+ '''INSERT''' inserts a set of values into a table.
  
   * ~-If the specified column already exists, the new value is stored as a new version.-~
   * ~-If '''TIMESTAMP''' is not specified for the value, the current time is used as its timestamp.-~
@@ -180, +180 @@

  === Delete data in a table ===
  {{{
  hql > help delete;
- DELETE    Delete table data
+ DELETE Delete table data
  
  Syntax:
- DELETE { column_name, [, column_name] ... | COLUMNFAMILIES(column_family[, column_family] ... | *} 
+ DELETE { column_name, [, column_name] ... | COLUMNFAMILIES(column_family[, column_family] ... | *}
          FROM table_name
          [WHERE row = 'row-key'];
  }}}