HBASE-6969 Avoid unneceseary regular expression matching in ruby code for "list" command
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1406805 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4ae5cc07c1
commit
e7f5eea91c
|
@ -39,8 +39,8 @@ module Hbase
|
|||
|
||||
#----------------------------------------------------------------------------------------------
|
||||
# Returns a list of tables in hbase
|
||||
def list
|
||||
@admin.listTables.map { |t| t.getNameAsString }
|
||||
def list(regex = ".*")
|
||||
@admin.listTables(regex).map { |t| t.getNameAsString }
|
||||
end
|
||||
|
||||
#----------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -34,8 +34,7 @@ EOF
|
|||
now = Time.now
|
||||
formatter.header([ "TABLE" ])
|
||||
|
||||
regex = /#{regex}/ unless regex.is_a?(Regexp)
|
||||
list = admin.list.grep(regex)
|
||||
list = admin.list(regex)
|
||||
list.each do |table|
|
||||
formatter.row([ table ])
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue