Skip to content

Commit

Permalink
address checkstyle and some rubocop warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ndimiduk committed Aug 13, 2020
1 parent efab0ef commit d6d1a09
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
*/
@InterfaceAudience.Public
@InterfaceStability.Evolving
public class NormalizeTableFilterParams {
public final class NormalizeTableFilterParams {
private final List<TableName> tableNames;
private final String regex;
private final String namespace;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,8 @@ private static int createTableBegsSplit(final TableName tableName,
assertEquals(5, MetaTableAccessor.getRegionCount(TEST_UTIL.getConnection(), tableName));
admin.flush(tableName).get();

final TableDescriptor td = TableDescriptorBuilder.newBuilder(admin.getDescriptor(tableName).get())
final TableDescriptor td = TableDescriptorBuilder
.newBuilder(admin.getDescriptor(tableName).get())
.setNormalizationEnabled(normalizerEnabled)
.setMergeEnabled(isMergeEnabled)
.build();
Expand Down Expand Up @@ -483,7 +484,8 @@ private static int createTableBegsMerge(final TableName tableName) throws Except
assertEquals(5, MetaTableAccessor.getRegionCount(TEST_UTIL.getConnection(), tableName));
admin.flush(tableName).get();

final TableDescriptor td = TableDescriptorBuilder.newBuilder(admin.getDescriptor(tableName).get())
final TableDescriptor td = TableDescriptorBuilder
.newBuilder(admin.getDescriptor(tableName).get())
.setNormalizationEnabled(true)
.build();
admin.modifyTable(td).get();
Expand Down
21 changes: 17 additions & 4 deletions hbase-shell/src/main/ruby/hbase/admin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -267,24 +267,37 @@ def normalize(*args)
end
if arg.key?(TABLE_NAME)
table_name = arg.delete(TABLE_NAME)
raise(ArgumentError, "#{TABLE_NAME} must be of type String") unless table_name.is_a?(String)
unless table_name.is_a?(String)
raise(ArgumentError, "#{TABLE_NAME} must be of type String")
end

builder.tableNames(java.util.Collections.singletonList(TableName.valueOf(table_name)))
elsif arg.key?(TABLE_NAMES)
table_names = arg.delete(TABLE_NAMES)
raise(ArgumentError, "#{TABLE_NAMES} must be of type Array") unless table_names.is_a?(Array)
unless table_names.is_a?(Array)
raise(ArgumentError, "#{TABLE_NAMES} must be of type Array")
end

table_name_list = java.util.LinkedList.new
table_names.each do |table_name|
raise(ArgumentError, "#{TABLE_NAMES} value #{table_name} must be of type String") unless table_name.is_a?(String)
unless table_name.is_a?(String)
raise(ArgumentError, "#{TABLE_NAMES} value #{table_name} must be of type String")
end

table_name_list.add(TableName.valueOf(table_name))
end
builder.tableNames(table_name_list)
elsif arg.key?(REGEX)
regex = arg.delete(REGEX)
raise(ArgumentError, "#{REGEX} must be of type String") unless regex.is_a?(String)

builder.regex(regex)
elsif arg.key?(NAMESPACE)
namespace = arg.delete(NAMESPACE)
raise(ArgumentError, "#{NAMESPACE} must be of type String") unless namespace.is_a?(String)
unless namespace.is_a?(String)
raise(ArgumentError, "#{NAMESPACE} must be of type String")
end

builder.namespace(namespace)
else
raise(ArgumentError, "Unrecognized argument #{arg}")
Expand Down

0 comments on commit d6d1a09

Please sign in to comment.