Here are the examples of the java api class org.apache.accumulo.core.client.BatchDeleter taken from open source projects.
1. AccumuloRyaDAO#dropGraph()
Project: incubator-rya
File: AccumuloRyaDAO.java
File: AccumuloRyaDAO.java
@Override public void dropGraph(AccumuloRdfConfiguration conf, RyaURI... graphs) throws RyaDAOException { BatchDeleter bd_spo = null; BatchDeleter bd_po = null; BatchDeleter bd_osp = null; try { bd_spo = createBatchDeleter(tableLayoutStrategy.getSpo(), conf.getAuthorizations()); bd_po = createBatchDeleter(tableLayoutStrategy.getPo(), conf.getAuthorizations()); bd_osp = createBatchDeleter(tableLayoutStrategy.getOsp(), conf.getAuthorizations()); bd_spo.setRanges(Collections.singleton(new Range())); bd_po.setRanges(Collections.singleton(new Range())); bd_osp.setRanges(Collections.singleton(new Range())); for (RyaURI graph : graphs) { bd_spo.fetchColumnFamily(new Text(graph.getData())); bd_po.fetchColumnFamily(new Text(graph.getData())); bd_osp.fetchColumnFamily(new Text(graph.getData())); } bd_spo.delete(); bd_po.delete(); bd_osp.delete(); //TODO indexers do not support delete-UnsupportedOperation Exception will be thrown // for (AccumuloIndex index : secondaryIndexers) { // index.dropGraph(graphs); // } } catch (Exception e) { throw new RyaDAOException(e); } finally { if (bd_spo != null) bd_spo.close(); if (bd_po != null) bd_po.close(); if (bd_osp != null) bd_osp.close(); } }
2. AccumuloDataStore#deleteAll()
Project: geowave
File: AccumuloDataStore.java
File: AccumuloDataStore.java
private boolean deleteAll(final String tableName, final String columnFamily, final String... additionalAuthorizations) { BatchDeleter deleter = null; try { deleter = accumuloOperations.createBatchDeleter(tableName, additionalAuthorizations); deleter.setRanges(Arrays.asList(new Range())); deleter.fetchColumnFamily(new Text(columnFamily)); deleter.delete(); return true; } catch (final TableNotFoundExceptionMutationsRejectedException | e) { LOGGER.warn("Unable to delete row from table [" + tableName + "].", e); return false; } finally { if (deleter != null) { deleter.close(); } } }
3. BasicAccumuloOperations#deleteAll()
Project: geowave
File: BasicAccumuloOperations.java
File: BasicAccumuloOperations.java
@Override public boolean deleteAll(final String tableName, final String columnFamily, final String... additionalAuthorizations) { BatchDeleter deleter = null; try { deleter = createBatchDeleter(tableName, additionalAuthorizations); deleter.setRanges(Arrays.asList(new Range())); deleter.fetchColumnFamily(new Text(columnFamily)); deleter.delete(); return true; } catch (final TableNotFoundExceptionMutationsRejectedException | e) { LOGGER.warn("Unable to delete row from table [" + tableName + "].", e); return false; } finally { if (deleter != null) { deleter.close(); } } }
4. BasicAccumuloOperations#delete()
Project: geowave
File: BasicAccumuloOperations.java
File: BasicAccumuloOperations.java
@Override public boolean delete(final String tableName, final List<ByteArrayId> rowIds, final String columnFamily, final String columnQualifier, final String... authorizations) { boolean success = true; BatchDeleter deleter = null; try { deleter = createBatchDeleter(tableName, authorizations); if ((columnFamily != null) && !columnFamily.isEmpty()) { if ((columnQualifier != null) && !columnQualifier.isEmpty()) { deleter.fetchColumn(new Text(columnFamily), new Text(columnQualifier)); } else { deleter.fetchColumnFamily(new Text(columnFamily)); } } final Set<ByteArrayId> removeSet = new HashSet<ByteArrayId>(); final List<Range> rowRanges = new ArrayList<Range>(); for (final ByteArrayId rowId : rowIds) { rowRanges.add(Range.exact(new Text(rowId.getBytes()))); removeSet.add(new ByteArrayId(rowId.getBytes())); } deleter.setRanges(rowRanges); final Iterator<Map.Entry<Key, Value>> iterator = deleter.iterator(); while (iterator.hasNext()) { final Entry<Key, Value> entry = iterator.next(); removeSet.remove(new ByteArrayId(entry.getKey().getRowData().getBackingArray())); } if (removeSet.isEmpty()) { deleter.delete(); } deleter.close(); } catch (final TableNotFoundExceptionMutationsRejectedException | e) { LOGGER.warn("Unable to delete row from table [" + tableName + "].", e); if (deleter != null) { deleter.close(); } success = false; } return success; }