HBase: Specify VERSIONS while creating table using Java API

谁说胖子不能爱 提交于 2020-01-03 15:53:32

问题


I know we can do it from hbase shell in the following way:

create 't1', {NAME => 'f1', VERSIONS => 5}

I could not find any corresponding option in HTableDesctiptor in the Java API. Any idea how to do this?


回答1:


Max versions, and other ttl type settings, is specified per column family. So the max versions is on the HColumnDescriptor.




回答2:


I leave here a sample code based on your example as reference.

HTableDescriptor descriptor = new HTableDescriptor("t1");
HColumnDescriptor cd = new HColumnDescriptor("f1");
cd.setMaxVersions(5);
descriptor.addFamily(cd);


来源:https://stackoverflow.com/questions/13508499/hbase-specify-versions-while-creating-table-using-java-api

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!