Skip to content

Commit

Permalink
Remove csv option from scan command #984 #1018
Browse files Browse the repository at this point in the history
  • Loading branch information
keith-turner committed Apr 4, 2018
1 parent 0ec21c9 commit f147016
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 250 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,6 @@ public static class ScanOptions {
+ "internal schema, making it easier to comprehend.")
public boolean scanAccumuloTable = false;

public boolean exportAsCsv = false;
public String csvHeader;
public String csvDelimiter;
public String csvEscape;
public String csvQuote;
public String csvQuoteMode;
public boolean exportAsJson = false;

public String getStartRow() {
return startRow;
}
Expand All @@ -242,8 +234,7 @@ public List<String> getColumns() {

public ScanUtil.ScanOpts getScanOpts() {
return new ScanUtil.ScanOpts(startRow, endRow, columns, exactRow, rowPrefix, help,
hexEncNonAscii, scanAccumuloTable, exportAsCsv, csvDelimiter, csvEscape, csvHeader,
csvQuote, csvQuoteMode, exportAsJson);
hexEncNonAscii, scanAccumuloTable, false);
}
}
}
4 changes: 0 additions & 4 deletions modules/command/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@
<groupId>org.apache.accumulo</groupId>
<artifactId>accumulo-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* 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
Expand All @@ -20,7 +20,6 @@
import java.util.List;

import com.beust.jcommander.Parameter;
import org.apache.commons.lang3.StringUtils;
import org.apache.fluo.api.config.FluoConfiguration;
import org.apache.fluo.core.client.FluoAdminImpl;
import org.apache.fluo.core.util.ScanUtil;
Expand Down Expand Up @@ -56,31 +55,6 @@ public static class ScanOptions extends CommonOpts {
+ "internal schema, making it easier to comprehend.")
public boolean scanAccumuloTable = false;

@Parameter(names = "--csv", help = true,
description = "Export key/values stored in Accumulo as CSV file. Uses Fluo application "
+ "properties to configure the CSV format.")
public boolean exportAsCsv = false;

@Parameter(names = "--csv-header", help = true, description = "Set header for \"true\".")
public String csvHeader;

@Parameter(names = "--csv-delimiter", help = true,
description = "Configure delimiter to a designeted character.")
public String csvDelimiter;

@Parameter(names = "--csv-escape", help = true,
description = "Configure escape to a designeted character.")
public String csvEscape;

@Parameter(names = "--csv-quote", help = true,
description = "Configure quote to a designeted character.")
public String csvQuote;

@Parameter(names = "--csv-quote-mode", help = true,
description = "Configure quote mode to a designeted mode. The possible "
+ "modes are: ALL, ALL_NON_NULL, MINIMAL, NONE and NON_NUMERIC")
public String csvQuoteMode;

@Parameter(names = "--json", help = true,
description = "Export key/values stored in Accumulo as JSON file.")
public boolean exportAsJson = false;
Expand All @@ -101,26 +75,6 @@ public String getRowPrefix() {
return rowPrefix;
}

public String getCsvHeader() {
return csvHeader;
}

public String getCsvDelimiter() {
return csvDelimiter;
}

public String getCsvEscape() {
return csvEscape;
}

public String getCsvQuote() {
return csvQuote;
}

public String getCsvQuoteMode() {
return csvQuoteMode;
}

public List<String> getColumns() {
if (columns == null) {
return Collections.emptyList();
Expand All @@ -130,25 +84,17 @@ public List<String> getColumns() {

/**
* Check if the parameters informed can be used together.
* @since 1.2
*/
private void checkScanOptions() {
if (this.exportAsCsv && this.exportAsJson) {
if (this.scanAccumuloTable && this.exportAsJson) {
throw new IllegalArgumentException(
"Both \"--csv\" and \"--json\" can not be set together.");
}

if (!this.exportAsCsv && (StringUtils.isNotEmpty(this.csvDelimiter)
| StringUtils.isNotEmpty(this.csvEscape) | StringUtils.isNotEmpty(this.csvHeader)
| StringUtils.isNotEmpty(this.csvQuote) | StringUtils.isNotEmpty(this.csvQuoteMode))) {
throw new IllegalArgumentException("No \"--csv\" detected");
"Both \"--raw\" and \"--json\" can not be set together.");
}
}

public ScanUtil.ScanOpts getScanOpts() {
return new ScanUtil.ScanOpts(startRow, endRow, columns, exactRow, rowPrefix, help,
hexEncNonAscii, scanAccumuloTable, exportAsCsv, csvDelimiter, csvEscape, csvHeader,
csvQuote, csvQuoteMode, exportAsJson);
hexEncNonAscii, scanAccumuloTable, exportAsJson);
}

public static ScanOptions parse(String[] args) {
Expand Down
8 changes: 0 additions & 8 deletions modules/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,6 @@
<groupId>org.apache.accumulo</groupId>
<artifactId>accumulo-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-client</artifactId>
Expand Down
Loading

0 comments on commit f147016

Please sign in to comment.