Help Center/
CloudTable Service/
Developer Guide/
HBase Application Development Guide/
Developing Term Index Applications/
Sample Code Description/
Statistics Query
Updated on 2024-11-28 GMT+08:00
Statistics Query
Function Description
The total number of entities that meet the query conditions is returned. The detailed information about the data is not returned. The setCountOnly() parameter is set in the code.
Below is an example of the code implementation.
Sample Code
public void testCountOnlyQuery() { LOG.info("Entering testCountOnlyQuery."); try (Table table = conn.getTable(tableName)) { // Using Table instance to create LemonTable. LemonTable lemonTable = new LemonTable(table); // Build LemonQuery. LemonQuery query = LemonQuery.builder() // Set ad-hoc query condition. .setQuery("education:bachelor OR education:master") // just return how many entities meet the query condition, without any rowkey/column .setCountOnly() .build(); ResultSet resultSet = lemonTable.query(query); // Read result rows. int count = resultSet.getCount(); LOG.info("the entity count of query is " + count); } catch (IOException e) { LOG.error("testCountOnlyQuery failed ", e); } LOG.info("Exiting testCountOnlyQuery."); }
Parent topic: Sample Code Description
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot