Skip to content

Commit

Permalink
HBASE-27317 Rectifying the option for columnfamily as mandatory (apac…
Browse files Browse the repository at this point in the history
…he#4773)

Signed-off-by: Peter Somogyi <[email protected]>
(cherry picked from commit efc7575)
Change-Id: I6be43119efa4b63cebd06bb01a1a656cb9f2f015
  • Loading branch information
abhradeepkundu authored and Abhradeep Kundu committed Sep 14, 2022
1 parent 346a9c1 commit 2661498
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ public class StoreFileListFilePrettyPrinter extends Configured implements Tool {
private final String regionOption = "r";
private final String tableNameOption = "t";

private final String cmdString = "sft";

private String namespace;
private String regionName;
private String columnFamily;
Expand Down Expand Up @@ -96,9 +98,7 @@ private void init() {
public boolean parseOptions(String[] args) throws ParseException, IOException {
HelpFormatter formatter = new HelpFormatter();
if (args.length == 0) {
formatter
.printHelp("sft [--file=</path/to/tracker/file> | --table=<namespace:tablename|tablename>"
+ " --region=<regionname> [--columnFamily=<columnfamily>] ]", options, true);
formatter.printHelp(cmdString, options, true);
return false;
}

Expand All @@ -111,22 +111,19 @@ public boolean parseOptions(String[] args) throws ParseException, IOException {
regionName = cmd.getOptionValue(regionOption);
if (StringUtils.isEmpty(regionName)) {
err.println("Region name is not specified.");
formatter.printHelp("sft [--file=</path/to/tracker/file> | --table=<namespace:tablename|"
+ "tablename> --region=<regionname> [--columnFamily=<columnfamily>] ]", options, true);
formatter.printHelp(cmdString, options, true);
System.exit(1);
}
columnFamily = cmd.getOptionValue(columnFamilyOption);
if (StringUtils.isEmpty(columnFamily)) {
err.println("Column family is not specified.");
formatter.printHelp("sft [--file=</path/to/tracker/file> | --table=<namespace:tablename|"
+ "tablename> --region=<regionname> [--columnFamily=<columnfamily>] ]", options, true);
formatter.printHelp(cmdString, options, true);
System.exit(1);
}
String tableNameWtihNS = cmd.getOptionValue(tableNameOption);
if (StringUtils.isEmpty(tableNameWtihNS)) {
err.println("Table name is not specified.");
formatter.printHelp("sft [--file=</path/to/tracker/file> | --table=<namespace:tablename|"
+ "tablename> --region=<regionname> [--columnFamily=<columnfamily>] ]", options, true);
formatter.printHelp(cmdString, options, true);
System.exit(1);
}
TableName tn = TableName.valueOf(tableNameWtihNS);
Expand Down

0 comments on commit 2661498

Please sign in to comment.