HBASE-16622 Fix some issues with the HBase reference guide
This commit is contained in:
parent
7b0acc292e
commit
6b346ad046
@ -108,7 +108,7 @@ We encourage you to have this formatter in place in eclipse when editing HBase c
|
|||||||
. In Preferences, Go to `Java->Code Style->Formatter`.
|
. In Preferences, Go to `Java->Code Style->Formatter`.
|
||||||
. Click btn:[Import] and browse to the location of the _hbase_eclipse_formatter.xml_ file, which is in the _dev-support/_ directory.
|
. Click btn:[Import] and browse to the location of the _hbase_eclipse_formatter.xml_ file, which is in the _dev-support/_ directory.
|
||||||
Click btn:[Apply].
|
Click btn:[Apply].
|
||||||
. Still in Preferences, click .
|
. Still in Preferences, click `Java->Editor->Save Actions`.
|
||||||
Be sure the following options are selected:
|
Be sure the following options are selected:
|
||||||
+
|
+
|
||||||
* Perform the selected actions on save
|
* Perform the selected actions on save
|
||||||
|
@ -43,8 +43,6 @@ See <<external_apis>> for more information.
|
|||||||
----
|
----
|
||||||
package com.example.hbase.admin;
|
package com.example.hbase.admin;
|
||||||
|
|
||||||
package util;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
@ -77,7 +75,7 @@ public class Example {
|
|||||||
Admin admin = connection.getAdmin()) {
|
Admin admin = connection.getAdmin()) {
|
||||||
|
|
||||||
HTableDescriptor table = new HTableDescriptor(TableName.valueOf(TABLE_NAME));
|
HTableDescriptor table = new HTableDescriptor(TableName.valueOf(TABLE_NAME));
|
||||||
table.addFamily(new HColumnDescriptor(CF_DEFAULT).setCompressionType(Algorithm.SNAPPY));
|
table.addFamily(new HColumnDescriptor(CF_DEFAULT).setCompressionType(Algorithm.NONE));
|
||||||
|
|
||||||
System.out.print("Creating table. ");
|
System.out.print("Creating table. ");
|
||||||
createOrOverwrite(admin, table);
|
createOrOverwrite(admin, table);
|
||||||
@ -90,12 +88,12 @@ public class Example {
|
|||||||
Admin admin = connection.getAdmin()) {
|
Admin admin = connection.getAdmin()) {
|
||||||
|
|
||||||
TableName tableName = TableName.valueOf(TABLE_NAME);
|
TableName tableName = TableName.valueOf(TABLE_NAME);
|
||||||
if (admin.tableExists(tableName)) {
|
if (!admin.tableExists(tableName)) {
|
||||||
System.out.println("Table does not exist.");
|
System.out.println("Table does not exist.");
|
||||||
System.exit(-1);
|
System.exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
HTableDescriptor table = new HTableDescriptor(tableName);
|
HTableDescriptor table = admin.getTableDescriptor(tableName);
|
||||||
|
|
||||||
// Update existing table
|
// Update existing table
|
||||||
HColumnDescriptor newColumn = new HColumnDescriptor("NEWCF");
|
HColumnDescriptor newColumn = new HColumnDescriptor("NEWCF");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user