package com.architecting.ch11;

import java.io.IOException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.MasterNotRunningException;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.ZooKeeperConnectionException;
import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;
import org.apache.hadoop.hbase.io.compress.Compression.Algorithm;
import org.apache.hadoop.hbase.regionserver.BloomType;

public class CreateTable {
  
  public static final Log LOG = LogFactory.getLog(CreateTable.class);

  public static void main(String[] args) throws MasterNotRunningException,
      ZooKeeperConnectionException, IOException {
    try (Connection connection = ConnectionFactory.createConnection();
        Admin admin = connection.getAdmin();) {
      LOG.info("Starting table creation");
      // tag::CREATE[]
      HTableDescriptor desc =
                          new HTableDescriptor(TableName.valueOf("documents"));
      HColumnDescriptor family = new HColumnDescriptor("c");
      family.setCompressionType(Algorithm.GZ);
      family.setBloomFilterType(BloomType.NONE);
      desc.addFamily(family);
      admin.createTable(desc);
      // end::CREATE[]
      LOG.info("Table successfuly created");
    }
  }

}

@@ -671,16 +671,81 @@
 oomType;
+%0Aimport org.apache.hadoop.hbase.util.RegionSplitter.UniformSplit;
 %0A%0Apublic
@@ -1145,24 +1145,84 @@
 g::CREATE%5B%5D%0A
+      TableName documents = TableName.valueOf(%22documents%22);%0A
       HTable
@@ -1242,34 +1242,8 @@
 sc =
-%0A                         
  new
@@ -1260,35 +1260,16 @@
 criptor(
-TableName.valueOf(%22
 document
@@ -1269,18 +1269,16 @@
 ocuments
-%22)
 );%0A     
@@ -1459,16 +1459,70 @@
 amily);%0A
+      UniformSplit uniformSplit = new UniformSplit();%0A
       ad
@@ -1541,16 +1541,39 @@
 ble(desc
+, uniformSplit.split(8)
 );%0A     

Add splits to table creation.