Return-Path: X-Original-To: apmail-accumulo-commits-archive@www.apache.org Delivered-To: apmail-accumulo-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E698519D88 for ; Tue, 15 Mar 2016 00:46:21 +0000 (UTC) Received: (qmail 57573 invoked by uid 500); 15 Mar 2016 00:46:21 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 57523 invoked by uid 500); 15 Mar 2016 00:46:21 -0000 Mailing-List: contact commits-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list commits@accumulo.apache.org Received: (qmail 57391 invoked by uid 99); 15 Mar 2016 00:46:21 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Mar 2016 00:46:21 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 8AAF1DFF8E; Tue, 15 Mar 2016 00:46:21 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ctubbsii@apache.org To: commits@accumulo.apache.org Date: Tue, 15 Mar 2016 00:46:24 -0000 Message-Id: <7006d5b99c354a1b86a02cacb09928be@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [4/5] accumulo git commit: Merge branch '1.6' into 1.7 Merge branch '1.6' into 1.7 Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/422815aa Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/422815aa Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/422815aa Branch: refs/heads/1.7 Commit: 422815aa2090ffaccc51ab5c3efee482548e318b Parents: 37857c5 ecfd95c Author: Christopher Tubbs Authored: Mon Mar 14 20:45:56 2016 -0400 Committer: Christopher Tubbs Committed: Mon Mar 14 20:45:56 2016 -0400 ---------------------------------------------------------------------- .../java/org/apache/accumulo/shell/commands/DeleteRowsCommand.java | 1 - 1 file changed, 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/422815aa/shell/src/main/java/org/apache/accumulo/shell/commands/DeleteRowsCommand.java ---------------------------------------------------------------------- diff --cc shell/src/main/java/org/apache/accumulo/shell/commands/DeleteRowsCommand.java index 527efe6,0000000..2fc87b0 mode 100644,000000..100644 --- a/shell/src/main/java/org/apache/accumulo/shell/commands/DeleteRowsCommand.java +++ b/shell/src/main/java/org/apache/accumulo/shell/commands/DeleteRowsCommand.java @@@ -1,63 -1,0 +1,62 @@@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.accumulo.shell.commands; + +import org.apache.accumulo.shell.Shell; +import org.apache.accumulo.shell.Shell.Command; +import org.apache.commons.cli.CommandLine; +import org.apache.commons.cli.Option; +import org.apache.commons.cli.Options; +import org.apache.hadoop.io.Text; + +public class DeleteRowsCommand extends Command { + private Option forceOpt; - private Option startRowOptExclusive; + + @Override + public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws Exception { + final String tableName = OptUtil.getTableOpt(cl, shellState); + final Text startRow = OptUtil.getStartRow(cl); + final Text endRow = OptUtil.getEndRow(cl); + if (!cl.hasOption(forceOpt.getOpt()) && (startRow == null || endRow == null)) { + shellState.getReader().println("Not deleting unbounded range. Specify both ends, or use --force"); + return 1; + } + shellState.getConnector().tableOperations().deleteRows(tableName, startRow, endRow); + return 0; + } + + @Override + public String description() { + return "deletes a range of rows in a table. Note that rows matching the start row ARE NOT deleted, but rows matching the end row ARE deleted."; + } + + @Override + public int numArgs() { + return 0; + } + + @Override + public Options getOptions() { + final Options o = new Options(); + forceOpt = new Option("f", "force", false, "delete data even if start or end are not specified"); + o.addOption(OptUtil.startRowOpt()); + o.addOption(OptUtil.endRowOpt()); + o.addOption(OptUtil.tableOpt("table to delete a row range from")); + o.addOption(forceOpt); + return o; + } +}