Hadoop hbase中的HTableDescriptor(表)已被弃用,是否有替代方案?
HTableDescriptor htd=新的HTableDescriptor(表) 上面的语句将表描述符设置为不推荐的Hadoop hbase中的HTableDescriptor(表)已被弃用,是否有替代方案?,hadoop,hbase,Hadoop,Hbase,HTableDescriptor htd=新的HTableDescriptor(表) 上面的语句将表描述符设置为不推荐的 我已经找了这么多地方,但找不到替代品。。。。非常感谢您提供的任何帮助我猜您正在使用带字符串参数的构造函数,即您的参数变量“table”是字符串: HTableDescriptor(String name); //Deprecated 您需要构造一个表描述符,将TableName对象指定为: HTableDescriptor(TableName name); 有关Table
我已经找了这么多地方,但找不到替代品。。。。非常感谢您提供的任何帮助我猜您正在使用带字符串参数的构造函数,即您的参数变量“table”是字符串:
HTableDescriptor(String name); //Deprecated
您需要构造一个表描述符,将TableName对象指定为:
HTableDescriptor(TableName name);
有关TableName对象的详细信息,请使用以下链接:
HTableDescriptor自2.0.0版起,将在HBase 3.0.0中删除。
*使用{@link TableDescriptorBuilder}生成{@link HTableDescriptor}
在您的示例中,表的数据类型是什么?请参阅我的答案:HTableDescriptor htd=newhtabledescriptor(TableName.valueOf(table));这是我们需要使用的语句
TableName tname = TableName.valueOf(fullTableName);
TableDescriptorBuilder tableDescBuilder = TableDescriptorBuilder.newBuilder(tname);
ColumnFamilyDescriptorBuilder columnDescBuilder = ColumnFamilyDescriptorBuilder
.newBuilder(Bytes.toBytes(family)).setBlocksize(32 * 1024)
.setCompressionType(Compression.Algorithm.SNAPPY).setDataBlockEncoding(DataBlockEncoding.NONE);
tableDescBuilder.setColumnFamily(columnDescBuilder.build());
tableDescBuilder.build();