Search in sources :

Example 11 with TableDescriptor

use of co.cask.cdap.spi.hbase.TableDescriptor in project cdap by caskdata.

the class HBase10CDH550TableUtil method modifyTable.

@Override
public void modifyTable(HBaseDDLExecutor ddlExecutor, HTableDescriptor tableDescriptor) throws IOException {
    Preconditions.checkArgument(ddlExecutor != null, "HBaseDDLExecutor should not be null");
    Preconditions.checkArgument(tableDescriptor != null, "Table descriptor should not be null.");
    TableName tableName = tableDescriptor.getTableName();
    TableDescriptor tbd = HBase10CDH550TableDescriptorUtil.getTableDescriptor(tableDescriptor);
    ddlExecutor.modifyTable(tableName.getNamespaceAsString(), tableName.getQualifierAsString(), tbd);
}
Also used : TableName(org.apache.hadoop.hbase.TableName) HTableDescriptor(org.apache.hadoop.hbase.HTableDescriptor) TableDescriptor(co.cask.cdap.spi.hbase.TableDescriptor)

Example 12 with TableDescriptor

use of co.cask.cdap.spi.hbase.TableDescriptor in project cdap by caskdata.

the class HBase10CDHTableDescriptorUtil method getTableDescriptor.

public static TableDescriptor getTableDescriptor(HTableDescriptor descriptor) {
    Set<ColumnFamilyDescriptor> families = new HashSet<>();
    for (HColumnDescriptor family : descriptor.getColumnFamilies()) {
        families.add(getColumnFamilyDescriptor(family));
    }
    Set<CoprocessorDescriptor> coprocessors = new HashSet<>();
    coprocessors.addAll(CoprocessorUtil.getCoprocessors(descriptor).values());
    Map<String, String> properties = CoprocessorUtil.getNonCoprocessorProperties(descriptor);
    // TODO: should add configurations as well
    return new TableDescriptor(descriptor.getTableName().getNamespaceAsString(), descriptor.getTableName().getQualifierAsString(), families, coprocessors, properties);
}
Also used : HColumnDescriptor(org.apache.hadoop.hbase.HColumnDescriptor) ColumnFamilyDescriptor(co.cask.cdap.spi.hbase.ColumnFamilyDescriptor) CoprocessorDescriptor(co.cask.cdap.spi.hbase.CoprocessorDescriptor) HTableDescriptor(org.apache.hadoop.hbase.HTableDescriptor) TableDescriptor(co.cask.cdap.spi.hbase.TableDescriptor) HashSet(java.util.HashSet)

Example 13 with TableDescriptor

use of co.cask.cdap.spi.hbase.TableDescriptor in project cdap by caskdata.

the class HBase10CDHTableUtil method modifyTable.

@Override
public void modifyTable(HBaseDDLExecutor ddlExecutor, HTableDescriptor tableDescriptor) throws IOException {
    Preconditions.checkArgument(ddlExecutor != null, "HBaseDDLExecutor should not be null");
    Preconditions.checkArgument(tableDescriptor != null, "Table descriptor should not be null.");
    TableName tableName = tableDescriptor.getTableName();
    TableDescriptor tbd = HBase10CDHTableDescriptorUtil.getTableDescriptor(tableDescriptor);
    ddlExecutor.modifyTable(tableName.getNamespaceAsString(), tableName.getQualifierAsString(), tbd);
}
Also used : TableName(org.apache.hadoop.hbase.TableName) HTableDescriptor(org.apache.hadoop.hbase.HTableDescriptor) TableDescriptor(co.cask.cdap.spi.hbase.TableDescriptor)

Example 14 with TableDescriptor

use of co.cask.cdap.spi.hbase.TableDescriptor in project cdap by caskdata.

the class HBase98TableDescriptorUtil method getTableDescriptor.

public static TableDescriptor getTableDescriptor(HTableDescriptor descriptor) {
    Set<ColumnFamilyDescriptor> families = new HashSet<>();
    for (HColumnDescriptor family : descriptor.getColumnFamilies()) {
        families.add(getColumnFamilyDescriptor(family));
    }
    Set<CoprocessorDescriptor> coprocessors = new HashSet<>();
    coprocessors.addAll(CoprocessorUtil.getCoprocessors(descriptor).values());
    Map<String, String> properties = CoprocessorUtil.getNonCoprocessorProperties(descriptor);
    // TODO: should add configurations as well
    return new TableDescriptor(descriptor.getTableName().getNamespaceAsString(), descriptor.getTableName().getQualifierAsString(), families, coprocessors, properties);
}
Also used : HColumnDescriptor(org.apache.hadoop.hbase.HColumnDescriptor) ColumnFamilyDescriptor(co.cask.cdap.spi.hbase.ColumnFamilyDescriptor) CoprocessorDescriptor(co.cask.cdap.spi.hbase.CoprocessorDescriptor) HTableDescriptor(org.apache.hadoop.hbase.HTableDescriptor) TableDescriptor(co.cask.cdap.spi.hbase.TableDescriptor) HashSet(java.util.HashSet)

Example 15 with TableDescriptor

use of co.cask.cdap.spi.hbase.TableDescriptor in project cdap by caskdata.

the class DefaultHBaseDDLExecutor method truncateTable.

@Override
public void truncateTable(String namespace, String name) throws IOException {
    Preconditions.checkArgument(namespace != null, "Namespace should not be null");
    Preconditions.checkArgument(name != null, "Table name should not be null.");
    HTableDescriptor descriptor = admin.getTableDescriptor(TableName.valueOf(namespace, encodeHBaseEntity(name)));
    TableDescriptor tbd = getTableDescriptor(descriptor);
    disableTableIfEnabled(namespace, name);
    deleteTableIfExists(namespace, name);
    createTableIfNotExists(tbd, null);
}
Also used : HTableDescriptor(org.apache.hadoop.hbase.HTableDescriptor) TableDescriptor(co.cask.cdap.spi.hbase.TableDescriptor) HTableDescriptor(org.apache.hadoop.hbase.HTableDescriptor)

Aggregations

TableDescriptor (co.cask.cdap.spi.hbase.TableDescriptor)15 HTableDescriptor (org.apache.hadoop.hbase.HTableDescriptor)15 ColumnFamilyDescriptor (co.cask.cdap.spi.hbase.ColumnFamilyDescriptor)7 CoprocessorDescriptor (co.cask.cdap.spi.hbase.CoprocessorDescriptor)7 HashSet (java.util.HashSet)7 HColumnDescriptor (org.apache.hadoop.hbase.HColumnDescriptor)7 TableName (org.apache.hadoop.hbase.TableName)7