Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to implement list sorting in hbase

Shulou Source: shulou.com Published: 2022-06-01 14:42:03 10月05日 Update

This article is to share with you about how to sort the list in hbase. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

Hbase is sorted in lexicographical order, that is, descending order, and the performance of the page is that the earliest data (the one with the smallest rowkey) comes first.

The current solution is to add a foreign key association table to the primary key, and the rules for generating foreign keys are

4000000000000-the primary key number, for example, the primary key is X201401110001, and the corresponding foreign key is X198598889999. In order to sort the entities in ascending order, use X198598889999 as the primary key when saving entities, and then get X201401110001 from the associated table according to X198598889999 when querying the page.

Note: add, delete and query need to be associated.

Example:

Public String add (XControl control) throwsException {pkControlDao.addXControlFK (id);} public void delete (String id) throwsException {pkControlDao.deleteXControlFK (id);} public PageInfosearchXControl (QueryControlRuleQO qo,Integer pageSize,Integer currteIndex) throwsException {/ / query the matching primary key if (StringUtils.isNotBlank (qo.getId () {qo.setPKs (pkControlDao.getXControlPKs (qo.getId ();}

The above is how to sort the list in hbase. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Tags: Sort relate query that is time more knowledge articles pages practical minimum that is functions ascending order comments dictionaries entities work meetings data articles Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Microsoft vpn Shulou Tech Info Docker