hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jean-Marc Spaggiari (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-13599) The Example Provided in Section 69: Examples of the Documentation Does Not Compile
Date Wed, 01 Jul 2015 17:35:05 GMT

    [ https://issues.apache.org/jira/browse/HBASE-13599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14610686#comment-14610686
] 

Jean-Marc Spaggiari commented on HBASE-13599:
---------------------------------------------

Ping [~misty]... Should the online book be updated?

> The Example Provided in Section 69: Examples of the Documentation Does Not Compile
> ----------------------------------------------------------------------------------
>
>                 Key: HBASE-13599
>                 URL: https://issues.apache.org/jira/browse/HBASE-13599
>             Project: HBase
>          Issue Type: Bug
>          Components: documentation
>    Affects Versions: 1.0.0
>            Reporter: David Newcomer
>            Assignee: Lars Francke
>            Priority: Minor
>             Fix For: 2.0.0
>
>         Attachments: HBASE-13599-v1.patch
>
>
> I'm trying to build and run the example java code I found in the HBase Documentation,
and I'm running into several issues.
> 1. I don't have the code/library used in the following import:
> import static com.example.hbase.Constants.*;
> I don't believe it is included in any of the HBase libraries or documentation.
> 2. All of the methods in createOrOverwrite() that use table.getName() should instead
be using table.getTableName()
> 3. The interface org.apache.hadoop.hbase.client.Admin is abstract, and can't be instantiated
with a Configuration. Constructing an org.apache.hadoop.hbase.client.HBaseAdmin would allow
the code to compile, but that constructor is deprecated.
> 4. I have no references to the field "TABLE_NAME" or "CF_DEFAULT". I'm assuming they
are Strings in com.example.hbase.Constants. Perhaps those variables should simply be copied
into the the Example?
> Link to the documentation section:
> http://hbase.apache.org/book.html#_examples
> <code>
> package com.example.hbase.admin;
> import java.io.IOException;
> import org.apache.hadoop.hbase.HBaseConfiguration;
> import org.apache.hadoop.hbase.HColumnDescriptor;
> import org.apache.hadoop.hbase.HTableDescriptor;
> import org.apache.hadoop.hbase.TableName;
> import org.apache.hadoop.hbase.client.Admin;
> import org.apache.hadoop.hbase.io.compress.Compression.Algorithm;
> import org.apache.hadoop.conf.Configuration;
> import static com.example.hbase.Constants.*;
> public class CreateSchema {
>   public static void createOrOverwrite(Admin admin, HTableDescriptor table) throws IOException
{
>     if (admin.tableExists(table.getName())) {
>       admin.disableTable(table.getName());
>       admin.deleteTable(table.getName());
>     }
>     admin.createTable(table);
>   }
>   public static void createSchemaTables (Configuration config) {
>     try {
>       final Admin admin = new Admin(config);
>       HTableDescriptor table = new HTableDescriptor(TableName.valueOf(TABLE_NAME));
>       table.addFamily(new HColumnDescriptor(CF_DEFAULT).setCompressionType(Algorithm.SNAPPY));
>       System.out.print("Creating table. ");
>       createOrOverwrite(admin, table);
>       System.out.println(" Done.");
>       admin.close();
>     } catch (Exception e) {
>       e.printStackTrace();
>       System.exit(-1);
>     }
>   }
> }
> </code>



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message