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 # Returns a list of tables in hbase
def list def list(regex = ".*")
@admin.listTables.map { |t| t.getNameAsString } @admin.listTables(regex).map { |t| t.getNameAsString }
end end
#---------------------------------------------------------------------------------------------- #----------------------------------------------------------------------------------------------

View File

@ -34,8 +34,7 @@ EOF
now = Time.now now = Time.now
formatter.header([ "TABLE" ]) formatter.header([ "TABLE" ])
regex = /#{regex}/ unless regex.is_a?(Regexp) list = admin.list(regex)
list = admin.list.grep(regex)
list.each do |table| list.each do |table|
formatter.row([ table ]) formatter.row([ table ])
end end