Help Center/
MapReduce Service/
Developer Guide (Normal_Earlier Than 3.x)/
HBase Development Guide/
Developing an HBase Application/
Deleting HBase Data
Updated on 2024-08-16 GMT+08:00
Deleting HBase Data
Function Description
HBase allows you to delete data (a row of data or data sets) using the delete method of a Table instance.
Sample Code
The following code snippets are in the testDelete method in the HBaseExample class of the com.huawei.bigdata.hbase.examples packet.
public void testDelete() { LOG.info("Entering testDelete."); byte[] rowKey = Bytes.toBytes("012005000201"); Table table = null; try { // Instantiate an HTable object. table = conn.getTable(tableName); // Instantiate a Delete object. Delete delete = new Delete(rowKey); // Submit a delete request. table.delete(delete); LOG.info("Delete table successfully."); } catch (IOException e) { LOG.error("Delete table failed ", e); } finally { if (table != null) { try { // Close the HTable object. table.close(); } catch (IOException e) { LOG.error("Close table failed ", e); } } } LOG.info("Exiting testDelete."); }
Parent topic: Developing an HBase Application
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