HTable(config,tablename) 类型已弃用。代替有什么用?
The type HTable(config,tablename) is deprecated. What use instead?
我可以用什么代替 HTable(config,tablename)
?
此方法已弃用。在每个示例中,我都可以发现他们使用这个或另一个构造函数,这也已被弃用。
手动构造 HTable
对象已被 弃用 。请使用 Connection
来实例化 Table
。
从 Connection,Table 实现通过 Connection.getTable(TableName)
检索
示例:
Connection connection = ConnectionFactory.createConnection(config);
Table table = connection.getTable(TableName.valueOf("table1"));
try
{
// Use the table as needed, for a single operation and a single thread
}
finally
{
table.close();
connection.close();
}
HTable 不再是客户 API。请改用 Table。这是 api 文档 here 中的描述:
HTable is no longer a client API. Use Table instead. It is marked InterfaceAudience.Private as of hbase-1.0.0 indicating that this is an HBase-internal class as defined in Hadoop Interface Classification. There are no guarantees for backwards source / binary compatibility and methods or the class can change or go away without deprecation.
Connection.getTable(TableName)
仅用于检索 Table。
如果您需要创建 table 而不是 ,请使用 TableDescriptorBuilder
和 Admin.createTable(TableDescriptor)
。
例如:
val tableDescriptor: TableDescriptor = TableDescriptorBuilder
.newBuilder(TableName.valueOf("mytable"))
.setColumnFamily(ColumnFamilyDescriptorBuilder.newBuilder("myId".getBytes).build())
.setColumnFamily(ColumnFamilyDescriptorBuilder.newBuilder("data".getBytes).build())
.build()
admin.createTable(tableDescriptor)
我可以用什么代替 HTable(config,tablename)
?
此方法已弃用。在每个示例中,我都可以发现他们使用这个或另一个构造函数,这也已被弃用。
手动构造 HTable
对象已被 弃用 。请使用 Connection
来实例化 Table
。
从 Connection,Table 实现通过 Connection.getTable(TableName)
检索示例:
Connection connection = ConnectionFactory.createConnection(config);
Table table = connection.getTable(TableName.valueOf("table1"));
try
{
// Use the table as needed, for a single operation and a single thread
}
finally
{
table.close();
connection.close();
}
HTable 不再是客户 API。请改用 Table。这是 api 文档 here 中的描述:
HTable is no longer a client API. Use Table instead. It is marked InterfaceAudience.Private as of hbase-1.0.0 indicating that this is an HBase-internal class as defined in Hadoop Interface Classification. There are no guarantees for backwards source / binary compatibility and methods or the class can change or go away without deprecation.
Connection.getTable(TableName)
仅用于检索 Table。
如果您需要创建 table 而不是 ,请使用 TableDescriptorBuilder
和 Admin.createTable(TableDescriptor)
。
例如:
val tableDescriptor: TableDescriptor = TableDescriptorBuilder
.newBuilder(TableName.valueOf("mytable"))
.setColumnFamily(ColumnFamilyDescriptorBuilder.newBuilder("myId".getBytes).build())
.setColumnFamily(ColumnFamilyDescriptorBuilder.newBuilder("data".getBytes).build())
.build()
admin.createTable(tableDescriptor)