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/HQL" by InchulSong
Date Mon, 20 Aug 2007 19:47:09 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 InchulSong:
http://wiki.apache.org/lucene-hadoop/Hbase/HbaseShell/HQL

The comment on the change is:
some refinements on the HQL syntax

------------------------------------------------------------------------------
  == Hbase Query Language (HQL) Introduction ==
  HQL is an SQL-like query language for Hbase. You can use it to query and modify tables in
Hbase. 
  HQL is not intended to fully support the SQL syntax and semantics. 
- HQL, instead, is developed to make it easy to manipulate tables in Hbase through the Hbase
Shell command line,
+ HQL, instead, is developed to help easy manipulation of tables in Hbase through the Hbase
Shell command line without using programming APIs. 
- without using programming APIs. 
  
  We borrowed the syntax definition style from MySQL.
  
+ The issue [https://issues.apache.org/jira/browse/HADOOP-1720 HADOOP-1720] is adding HQL
support to the Hbase Shell.
  
+ ''Thanks to Edward Yoon for his initial idea of HQL, and to Stack for his suggestions. Any
suggestions for HQL in this wiki page, or to [[MailTo(icsong AT SPAMFREE gmail DOT com)]]''
- ''Thanks to Edward Yoon for his initial idea of HQL, and to Stack for his valuable suggestions.''
- 
- ''Any suggestions for HQL to [[MailTo(icsong AT SPAMFREE gmail DOT com)]], or in this wiki
page''
  
  == Data Definition Statements ==
  === CREATE TABLE Syntax ===
- CREATE TABLE enables you to create a new table and set various options for each column family.
- 
  {{{
  CREATE TABLE table_name (
-   column_family_name [MAX_VERSIONS=n],
-   ...
- )
- }}}
- 
-  * MAX_VERSIONS is for the management of versioned data. MAX_VERSIONS makes a table keep
only the recent n versions in a cell under a column family. Its default value is 1, i.e.,
if MAX_VERSIONS is not specified, Hbase keeps only the latest version of value in a cell.
- 
- {{{
- CREATE TABLE table_name (
-   column_family_spec,
+   column_family_spec
+   [, column_family_spec]
    ...
  )
  
  colum_family_spec:
-   column_family_name [MAX_VERSIONS=n] [LENGTH=n] 
-     [COMPRESSION=no | block | record] [IN_MEMORY] 
-     [BLOOMFILTER=bloom | counting | retouched]
+   column_family_name 
+     [MAX_VERSIONS=n]
+     [MAX_LENGTH=n]
+     [COMPRESSION=NONE|BLOCK|RECORD]
+     [IN_MEMORY]
+     [BLOOMFILTER=NONE|BLOOM|COUNTING|RETOUCHED]
  }}}
  
+ CREATE TABLE enables you to create a new table with various options for each column family.
+ 
+  * MAX_VERSIONS makes a table keep only the recent n versions in a cell. Its default value
is 3, i.e., only the most recent 3 versions of values are stored in a cell. 
+  * 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.
-  * Full version of CREATE TABLE. See [http://lucene.zones.apache.org:8080/hudson/job/Hadoop-Nightly/javadoc/org/apache/hadoop/hbase/HColumnDescriptor.html
   HColumnDescriptor API] for more information.
+  * See [http://lucene.zones.apache.org:8080/hudson/job/Hadoop-Nightly/javadoc/org/apache/hadoop/hbase/HColumnDescriptor.html
   HColumnDescriptor API] for more information.
  
  === DROP TABLE Syntax ===
- DROP TABLE removes one or more tables. 
- 
  {{{
  DROP TABLE table_name [, table_name] ...
  }}}
  
+ DROP TABLE removes one or more tables. 
+ 
  === ALTER TABLE Syntax ===
- ALTER TABLE enables you to change the structure of an existing table. You can 
- add, delete, and change column families. 
- 
  {{{
  ALTER TABLE table_name 
    alter_spec [, alter_spec] ...
@@ -65, +60 @@

    | CHANGE column_family_name column_family_spec
  }}}
  
+ ALTER TABLE changes the structure of an existing table. You can 
+ add, delete, or change column families. 
+ 
  == Data Manipulation Statements ==
  === SELECT Syntax ===
- SELECT enables you to retrieve a subset of data in a table.
- 
  {{{
- SELECT { column_name, ... | * }
+ SELECT { column_name [, column_name] ... | * }
    FROM table_name
    [WHERE row = 'row-key' | STARTING FROM 'row-key']
    [NUM_VERSIONS = version_count] 
    [TIMESTAMP 'timestamp'] 
    [LIMIT = row_count]
-   [INTO FILE 'file_name' options]
+   [INTO FILE 'file_name']
  
  column_name: 
+     column_family_name
-     column_family_name:column_label_name
+   | column_family_name:column_label_name
-   | column_family_name:
- 
- options:
-   FIELDS DELIMITED BY 'string' [ENCLOSED BY 'char']
  }}}
  
-  * You should quote column_name with single quotes if column_name has spaces in it.
+ SELECT retrieves a subset of data from the specified table.
+ 
+  * A column_name with spaces in it should be single-quoted.
   
-  * If you specify only column_family_name part for a column, you get values from all the
column_label_names in the column_family_name.
- 
   * STARTING FROM returns all the rows starting from 'row-key'.
  
   * NUM_VERSIONS retrieves only the recent n versions of values in a cell. 
@@ -98, +91 @@

  
   * LIMIT limits the number of rows to be returned. 
  
+  * INTO FILE outputs the returned rows into the specified file. For SELECT INTO another
table, see INSERT INTO SELECT below.
-  * INTO FILE outputs the returned rows into a specified file. options specifies how to delimit
each field in the file. For SELECT INTO another table, see INSERT below.
- 
- ''~- "add some row filtering here, i.g., regex match or upper limit on rows returned." -~''
by Stack. See issue [https://issues.apache.org/jira/browse/HADOOP-1611 HADOOP-1611]. 
  
  === INSERT Syntax ===
- INSERT inserts a set of values into a table. 
- 
  {{{
  INSERT INTO table_name (colmn_name, ...)
    VALUES ('value', ...)
@@ -112, +101 @@

    [TIMESTAMP 'timestamp']
  }}}
  
-  * If a specified column already exists, the specified value for the column is stored as
a new version. 
+ 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, the current time is used as the value of the timestamp
key.
+  * If TIMESTAMP is not specified for the value, the current time is used as its timestamp.
  
  {{{
- INSERT INTO table_name (column_name, ...)
+ INSERT INTO table_name (colmn_name, ...)
    [TIMESTAMP 'timestamp']
    SELECT ...
  }}}
@@ -125, +116 @@

   * TIMESTAMP inserts the rows selected by SELECT ... with the specified timestamp 
  
  === DELETE Syntax ===
- DELETE removes a subset of data from a table. 
- 
  {{{
- DELETE { column_name, [, column_name] ... | * }
+ DELETE { column_name, [, column_name] ... | *}
    FROM table_name
    WHERE row = 'row-key'
  }}}
  
+ DELETE removes a subset of data from a table. 
+ 
  === LOAD FROM FILE Syntax ===
- LOAD FROM FILE reads rows from a file and inserts these rows into a table. 
- 
  {{{
  LOAD FROM FILE 'file_name'
    INTO TABLE table_name
    [options]
  }}}
  
-  * LOAD FROM FILE is complement of SELECT INTO FILE.
+ LOAD FROM FILE reads rows from the specified file and inserts these rows into the specified
table. LOAD FROM FILE is complement of SELECT INTO FILE.
   
+ === SOURCE Syntax ===
+ {{{
+ SOURCE 'file_name'
+ }}}
+ 
+ SOURCE reads HQL statements from the specified file and executes them. 
+ 
+ == Miscellaneous Statements ==
+ {{{
+ SHOW TABLES 
+ }}}
+ 
+ SHOW TABLES shows all available tables, including disabled tables. For disabled tables,
+ it shows that they are disabled.
+ 
+ {{{
+ DESCRIBE table_name 
+ }}}
+ 
+ DESCRIBE shows the structure of the specified table such as the table's column families,
compression technique being used, and so on.
+ 
+ {{{
+ ENABLE | DISABLE table_name
+ }}}
+ 
+ ENABLE (DISABLE) enables (disables) the specified table.
+ 
+ == Transaction-Related Statements ==
  === START TRANSACTION, COMMIT, and ROLLBACK Syntax ===
- You can group togather a sequence of data manipulation statements in a single-row transaction.
- 
  {{{
  START TRANSACTION ON 'row-key' OF table_name | BEGIN ON 'row-key' OF table_name
  COMMIT ['timestamp']
  ROLLBACK 
  }}}
  
-  * The START TRANSACTION and BEGIN statements begin a new single-row transaction under a
'row-key' of table_name. 
+ You can group together a sequence of data manipulation statements in a single-row transaction.
  
-  * COMMIT commits the current transaction, making its changes permanent. If timestamp is
specified on commit, all the modifications under a single-row transaction are stored with
the specified timestamp. If not, they are stored with the current time.
+ The START TRANSACTION and BEGIN statements begin a new single-row transaction under the
specified 'row-key' of table_name. 
  
-  * ROLLBACK rolls back the current transaction, canceling its changes. 
+ COMMIT commits the current transaction, making its changes permanent. If timestamp is specified
on commit, all the modifications under the single-row transaction are stored with the specified
timestamp. If not, they are stored with the current time as their timestamps.
  
+ ROLLBACK rolls back the current transaction, canceling its changes. 
+ 
-  * By default, for every statement execution that updates a table, Hbase immediately stores
the update on disk.
+ By default, for every statement execution that updates a table, Hbase immediately stores
the update on disk.
  
  ''~- TRANSACTION on a row-level only -- and this is all you could guarantee in HBase --
may be a bit-over-the-top and require more effort than its worth.  How about implementing
this one last, if it is needed at all? -- St.Ack-~''
  
- == Other Statements ==
- SHOW TABLES shows all available tables.
- 
- {{{
- SHOW TABLES 
- }}}
- 
- DESCRIBE shows the structure of a table, including available column families and their settings
such as compression options, bloom filters, and so on. 
- 
- {{{
- DESCRIBE table_name 
- }}}
- 
- {{{
- ENABLE | DISABLE table_name
- }}}
- 

Mime
View raw message