热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.apache.hadoop.hbase.client.TableDescriptorBuilder.removeColumnFamily()方法的使用及代码示例

本文整理了Java中org.apache.hadoop.hbase.client.TableDescriptorBuilder.removeColumnFamily()

本文整理了Java中org.apache.hadoop.hbase.client.TableDescriptorBuilder.removeColumnFamily()方法的一些代码示例,展示了TableDescriptorBuilder.removeColumnFamily()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TableDescriptorBuilder.removeColumnFamily()方法的具体详情如下:
包路径:org.apache.hadoop.hbase.client.TableDescriptorBuilder
类名称:TableDescriptorBuilder
方法名:removeColumnFamily

TableDescriptorBuilder.removeColumnFamily介绍

暂无

代码示例

代码示例来源:origin: apache/hbase

@Override
public TableDescriptor get() throws IOException {
TableDescriptor old = getTableDescriptors().get(tableName);
if (!old.hasColumnFamily(columnName)) {
throw new InvalidFamilyOperationException("Family '" + Bytes.toString(columnName)
+ "' does not exist, so it cannot be deleted");
}
if (old.getColumnFamilyCount() == 1) {
throw new InvalidFamilyOperationException("Family '" + Bytes.toString(columnName)
+ "' is the only column family in the table, so it cannot be deleted");
}
return TableDescriptorBuilder.newBuilder(old).removeColumnFamily(columnName).build();
}
}, nonceGroup, nonce);

代码示例来源:origin: apache/hbase

builder.removeColumnFamily(family.getName());
schemaChangeNeeded = true;

代码示例来源:origin: apache/hbase

@Override
public void perform() throws Exception {
TableDescriptor tableDescriptor = admin.getDescriptor(tableName);
ColumnFamilyDescriptor[] columnDescriptors = tableDescriptor.getColumnFamilies();
if (columnDescriptors.length <= (protectedColumns == null ? 1 : protectedColumns.size())) {
return;
}
int index = random.nextInt(columnDescriptors.length);
while(protectedColumns != null &&
protectedColumns.contains(columnDescriptors[index].getNameAsString())) {
index = random.nextInt(columnDescriptors.length);
}
byte[] colDescName = columnDescriptors[index].getName();
LOG.debug("Performing action: Removing " + Bytes.toString(colDescName)+ " from "
+ tableName.getNameAsString());
TableDescriptorBuilder builder = TableDescriptorBuilder.newBuilder(tableDescriptor);
builder.removeColumnFamily(colDescName);
// Don't try the modify if we're stopping
if (context.isStopping()) {
return;
}
admin.modifyTable(builder.build());
}
}

代码示例来源:origin: apache/hbase

private static Region setMobThreshold(Region region, byte[] cfName, long modThreshold) {
ColumnFamilyDescriptor cfd = ColumnFamilyDescriptorBuilder
.newBuilder(region.getTableDescriptor().getColumnFamily(cfName))
.setMobThreshold(modThreshold)
.build();
TableDescriptor td = TableDescriptorBuilder
.newBuilder(region.getTableDescriptor())
.removeColumnFamily(cfName)
.setColumnFamily(cfd)
.build();
((HRegion)region).setTableDescriptor(td);
return region;
}

代码示例来源:origin: apache/hbase

private static HRegion setMobThreshold(HRegion region, byte[] cfName, long modThreshold) {
ColumnFamilyDescriptor cfd = ColumnFamilyDescriptorBuilder
.newBuilder(region.getTableDescriptor().getColumnFamily(cfName))
.setMobThreshold(modThreshold)
.build();
TableDescriptor td = TableDescriptorBuilder
.newBuilder(region.getTableDescriptor())
.removeColumnFamily(cfName)
.setColumnFamily(cfd)
.build();
region.setTableDescriptor(td);
return region;
}

代码示例来源:origin: apache/hbase

TableDescriptor newTd = TableDescriptorBuilder
.newBuilder(td)
.removeColumnFamily(Bytes.toBytes("cf1"))
.modifyColumnFamily(modCf2)
.modifyColumnFamily(modCf3)

代码示例来源:origin: apache/hbase

.setCompactionEnabled(!oldDescriptor.isCompactionEnabled())
.setColumnFamily(ColumnFamilyDescriptorBuilder.of(cf2))
.removeColumnFamily(Bytes.toBytes(cf3))
.setRegionReplication(3)
.build();

代码示例来源:origin: apache/phoenix

private void setSharedIndexMaxVersion(PTable table, TableDescriptor tableDescriptor,
TableDescriptorBuilder indexDescriptorBuilder) {
if (table.getColumnFamilies().isEmpty()) {
byte[] familyName = SchemaUtil.getEmptyColumnFamily(table);
ColumnFamilyDescriptorBuilder indexColDescriptorBuilder = ColumnFamilyDescriptorBuilder.newBuilder(indexDescriptorBuilder.build().getColumnFamily(familyName));
ColumnFamilyDescriptor tableColDescriptor = tableDescriptor.getColumnFamily(familyName);
indexColDescriptorBuilder.setMaxVersions(tableColDescriptor.getMaxVersions());
indexColDescriptorBuilder.setValue( Bytes.toBytes(PhoenixTransactionContext.PROPERTY_TTL),tableColDescriptor.getValue(Bytes.toBytes(PhoenixTransactionContext.PROPERTY_TTL)));
indexDescriptorBuilder.removeColumnFamily(familyName);
indexDescriptorBuilder.addColumnFamily(indexColDescriptorBuilder.build());
} else {
for (PColumnFamily family : table.getColumnFamilies()) {
byte[] familyName = family.getName().getBytes();
ColumnFamilyDescriptor indexColDescriptor = indexDescriptorBuilder.build().getColumnFamily(familyName);
if (indexColDescriptor != null) {
ColumnFamilyDescriptor tableColDescriptor = tableDescriptor.getColumnFamily(familyName);
ColumnFamilyDescriptorBuilder indexColDescriptorBuilder = ColumnFamilyDescriptorBuilder.newBuilder(indexColDescriptor);
indexColDescriptorBuilder.setMaxVersions(tableColDescriptor.getMaxVersions());
indexColDescriptorBuilder.setValue( Bytes.toBytes(PhoenixTransactionContext.PROPERTY_TTL),tableColDescriptor.getValue(Bytes.toBytes(PhoenixTransactionContext.PROPERTY_TTL)));
indexDescriptorBuilder.removeColumnFamily(familyName);
indexDescriptorBuilder.addColumnFamily(indexColDescriptorBuilder.build());
}
}
}
}

代码示例来源:origin: apache/phoenix

indexColDescriptor.setValue(Bytes.toBytes(PhoenixTransactionContext.PROPERTY_TTL),
tableColDescriptor.getValue(Bytes.toBytes(PhoenixTransactionContext.PROPERTY_TTL)));
indexDescriptorBuilder.removeColumnFamily(indexFamilyName);
indexDescriptorBuilder.setColumnFamily(indexColDescriptor.build());
} else {
indexColDescriptor.setValue(Bytes.toBytes(PhoenixTransactionContext.PROPERTY_TTL),
tableColDescriptor.getValue(Bytes.toBytes(PhoenixTransactionContext.PROPERTY_TTL)));
indexDescriptorBuilder.removeColumnFamily(familyName);
indexDescriptorBuilder.setColumnFamily(indexColDescriptor.build());

代码示例来源:origin: apache/phoenix

ColumnFamilyDescriptorBuilder.newBuilder(origIndexDescriptor.getColumnFamily(defaultIndexColFam));
modifyColumnFamilyDescriptor(indexDefaultColDescriptorBuilder, applyPropsToAllIndexesDefaultCF);
newIndexDescriptorBuilder.removeColumnFamily(defaultIndexColFam);
newIndexDescriptorBuilder.setColumnFamily(indexDefaultColDescriptorBuilder.build());
tableAndIndexDescriptorMappings.put(origIndexDescriptor, newIndexDescriptorBuilder.build());
ColumnFamilyDescriptorBuilder.newBuilder(cfd);
modifyColumnFamilyDescriptor(newCfd, applyPropsToAllIndexesDefaultCF);
newViewIndexDescriptorBuilder.removeColumnFamily(cfd.getName());
newViewIndexDescriptorBuilder.setColumnFamily(newCfd.build());

代码示例来源:origin: apache/phoenix

modifyColumnFamilyDescriptor(colDescriptorBuilder, familyProps);
colDescriptor = colDescriptorBuilder.build();
newTableDescriptorBuilder.removeColumnFamily(cf);
newTableDescriptorBuilder.setColumnFamily(colDescriptor);

代码示例来源:origin: apache/phoenix

desc=TableDescriptorBuilder.newBuilder(desc).removeColumnFamily(cols[0].getName()).addColumnFamily(col).build();

代码示例来源:origin: org.apache.hbase/hbase-client

TableDescriptor newTd = TableDescriptorBuilder
.newBuilder(td)
.removeColumnFamily(Bytes.toBytes("cf1"))
.modifyColumnFamily(modCf2)
.modifyColumnFamily(modCf3)

代码示例来源:origin: org.apache.phoenix/phoenix-core

private void setSharedIndexMaxVersion(PTable table, TableDescriptor tableDescriptor,
TableDescriptorBuilder indexDescriptorBuilder) {
if (table.getColumnFamilies().isEmpty()) {
byte[] familyName = SchemaUtil.getEmptyColumnFamily(table);
ColumnFamilyDescriptorBuilder indexColDescriptorBuilder = ColumnFamilyDescriptorBuilder.newBuilder(indexDescriptorBuilder.build().getColumnFamily(familyName));
ColumnFamilyDescriptor tableColDescriptor = tableDescriptor.getColumnFamily(familyName);
indexColDescriptorBuilder.setMaxVersions(tableColDescriptor.getMaxVersions());
indexColDescriptorBuilder.setValue( Bytes.toBytes(PhoenixTransactionContext.PROPERTY_TTL),tableColDescriptor.getValue(Bytes.toBytes(PhoenixTransactionContext.PROPERTY_TTL)));
indexDescriptorBuilder.removeColumnFamily(familyName);
indexDescriptorBuilder.addColumnFamily(indexColDescriptorBuilder.build());
} else {
for (PColumnFamily family : table.getColumnFamilies()) {
byte[] familyName = family.getName().getBytes();
ColumnFamilyDescriptor indexColDescriptor = indexDescriptorBuilder.build().getColumnFamily(familyName);
if (indexColDescriptor != null) {
ColumnFamilyDescriptor tableColDescriptor = tableDescriptor.getColumnFamily(familyName);
ColumnFamilyDescriptorBuilder indexColDescriptorBuilder = ColumnFamilyDescriptorBuilder.newBuilder(indexColDescriptor);
indexColDescriptorBuilder.setMaxVersions(tableColDescriptor.getMaxVersions());
indexColDescriptorBuilder.setValue( Bytes.toBytes(PhoenixTransactionContext.PROPERTY_TTL),tableColDescriptor.getValue(Bytes.toBytes(PhoenixTransactionContext.PROPERTY_TTL)));
indexDescriptorBuilder.removeColumnFamily(familyName);
indexDescriptorBuilder.addColumnFamily(indexColDescriptorBuilder.build());
}
}
}
}

代码示例来源:origin: com.aliyun.phoenix/ali-phoenix-core

private void setSharedIndexMaxVersion(PTable table, TableDescriptor tableDescriptor,
TableDescriptorBuilder indexDescriptorBuilder) {
if (table.getColumnFamilies().isEmpty()) {
byte[] familyName = SchemaUtil.getEmptyColumnFamily(table);
ColumnFamilyDescriptorBuilder indexColDescriptorBuilder = ColumnFamilyDescriptorBuilder.newBuilder(indexDescriptorBuilder.build().getColumnFamily(familyName));
ColumnFamilyDescriptor tableColDescriptor = tableDescriptor.getColumnFamily(familyName);
indexColDescriptorBuilder.setMaxVersions(tableColDescriptor.getMaxVersions());
indexColDescriptorBuilder.setValue( Bytes.toBytes(PhoenixTransactionContext.PROPERTY_TTL),tableColDescriptor.getValue(Bytes.toBytes(PhoenixTransactionContext.PROPERTY_TTL)));
indexDescriptorBuilder.removeColumnFamily(familyName);
indexDescriptorBuilder.addColumnFamily(indexColDescriptorBuilder.build());
} else {
for (PColumnFamily family : table.getColumnFamilies()) {
byte[] familyName = family.getName().getBytes();
ColumnFamilyDescriptor indexColDescriptor = indexDescriptorBuilder.build().getColumnFamily(familyName);
if (indexColDescriptor != null) {
ColumnFamilyDescriptor tableColDescriptor = tableDescriptor.getColumnFamily(familyName);
ColumnFamilyDescriptorBuilder indexColDescriptorBuilder = ColumnFamilyDescriptorBuilder.newBuilder(indexColDescriptor);
indexColDescriptorBuilder.setMaxVersions(tableColDescriptor.getMaxVersions());
indexColDescriptorBuilder.setValue( Bytes.toBytes(PhoenixTransactionContext.PROPERTY_TTL),tableColDescriptor.getValue(Bytes.toBytes(PhoenixTransactionContext.PROPERTY_TTL)));
indexDescriptorBuilder.removeColumnFamily(familyName);
indexDescriptorBuilder.addColumnFamily(indexColDescriptorBuilder.build());
}
}
}
}

代码示例来源:origin: org.apache.hbase/hbase-it

@Override
public void perform() throws Exception {
TableDescriptor tableDescriptor = admin.getDescriptor(tableName);
ColumnFamilyDescriptor[] columnDescriptors = tableDescriptor.getColumnFamilies();
if (columnDescriptors.length <= (protectedColumns == null ? 1 : protectedColumns.size())) {
return;
}
int index = random.nextInt(columnDescriptors.length);
while(protectedColumns != null &&
protectedColumns.contains(columnDescriptors[index].getNameAsString())) {
index = random.nextInt(columnDescriptors.length);
}
byte[] colDescName = columnDescriptors[index].getName();
LOG.debug("Performing action: Removing " + Bytes.toString(colDescName)+ " from "
+ tableName.getNameAsString());
TableDescriptorBuilder builder = TableDescriptorBuilder.newBuilder(tableDescriptor);
builder.removeColumnFamily(colDescName);
// Don't try the modify if we're stopping
if (context.isStopping()) {
return;
}
admin.modifyTable(builder.build());
}
}

代码示例来源:origin: com.aliyun.phoenix/ali-phoenix-core

ColumnFamilyDescriptorBuilder.newBuilder(origIndexDescriptor.getColumnFamily(defaultIndexColFam));
modifyColumnFamilyDescriptor(indexDefaultColDescriptorBuilder, applyPropsToAllIndexesDefaultCF);
newIndexDescriptorBuilder.removeColumnFamily(defaultIndexColFam);
newIndexDescriptorBuilder.setColumnFamily(indexDefaultColDescriptorBuilder.build());
tableAndIndexDescriptorMappings.put(origIndexDescriptor, newIndexDescriptorBuilder.build());
ColumnFamilyDescriptorBuilder.newBuilder(cfd);
modifyColumnFamilyDescriptor(newCfd, applyPropsToAllIndexesDefaultCF);
newViewIndexDescriptorBuilder.removeColumnFamily(cfd.getName());
newViewIndexDescriptorBuilder.setColumnFamily(newCfd.build());

代码示例来源:origin: org.apache.hbase/hbase-server

private static Region setMobThreshold(Region region, byte[] cfName, long modThreshold) {
ColumnFamilyDescriptor cfd = ColumnFamilyDescriptorBuilder
.newBuilder(region.getTableDescriptor().getColumnFamily(cfName))
.setMobThreshold(modThreshold)
.build();
TableDescriptor td = TableDescriptorBuilder
.newBuilder(region.getTableDescriptor())
.removeColumnFamily(cfName)
.setColumnFamily(cfd)
.build();
((HRegion)region).setTableDescriptor(td);
return region;
}

代码示例来源:origin: org.apache.hbase/hbase-server

private static HRegion setMobThreshold(HRegion region, byte[] cfName, long modThreshold) {
ColumnFamilyDescriptor cfd = ColumnFamilyDescriptorBuilder
.newBuilder(region.getTableDescriptor().getColumnFamily(cfName))
.setMobThreshold(modThreshold)
.build();
TableDescriptor td = TableDescriptorBuilder
.newBuilder(region.getTableDescriptor())
.removeColumnFamily(cfName)
.setColumnFamily(cfd)
.build();
region.setTableDescriptor(td);
return region;
}

代码示例来源:origin: org.apache.hbase/hbase-server

.setCompactionEnabled(!oldDescriptor.isCompactionEnabled())
.setColumnFamily(ColumnFamilyDescriptorBuilder.of(cf2))
.removeColumnFamily(Bytes.toBytes(cf3))
.setRegionReplication(3)
.build();

推荐阅读
author-avatar
一米静心的阳光
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有