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:
Michael Stack 2012-11-07 21:07:05 +00:00
parent 4ae5cc07c1
commit e7f5eea91c
2 changed files with 3 additions and 4 deletions

View File

@ -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
#----------------------------------------------------------------------------------------------

View File

@ -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