You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2020/06/24 02:56:59 UTC
[GitHub] [hbase] Apache9 commented on a change in pull request #1959: HBASE-20819 Use TableDescriptor to replace HTableDescriptor in hbase-shell module
Apache9 commented on a change in pull request #1959:
URL: https://github.com/apache/hbase/pull/1959#discussion_r444616508
##########
File path: hbase-shell/src/main/ruby/hbase/admin.rb
##########
@@ -701,40 +703,40 @@ def alter(table_name_str, wait = true, *args)
# Delete column family
if method == 'delete'
raise(ArgumentError, 'NAME parameter missing for delete method') unless name
- htd.removeFamily(name.to_java_bytes)
+ tdb.removeColumnFamily(name.to_java_bytes)
hasTableUpdate = true
# Unset table attributes
elsif method == 'table_att_unset'
raise(ArgumentError, 'NAME parameter missing for table_att_unset method') unless name
if name.is_a?(Array)
name.each do |key|
- if htd.getValue(key).nil?
+ if tdb.build.getValue(key).nil?
raise ArgumentError, "Could not find attribute: #{key}"
end
- htd.remove(key)
+ tdb.setValue(key, nil)
end
else
- if htd.getValue(name).nil?
+ if tdb.build.getValue(name).nil?
raise ArgumentError, "Could not find attribute: #{name}"
end
- htd.remove(name)
+ tdb.setValue(name, nil)
Review comment:
Ditto.
##########
File path: hbase-shell/src/main/ruby/hbase/admin.rb
##########
@@ -701,40 +703,40 @@ def alter(table_name_str, wait = true, *args)
# Delete column family
if method == 'delete'
raise(ArgumentError, 'NAME parameter missing for delete method') unless name
- htd.removeFamily(name.to_java_bytes)
+ tdb.removeColumnFamily(name.to_java_bytes)
hasTableUpdate = true
# Unset table attributes
elsif method == 'table_att_unset'
raise(ArgumentError, 'NAME parameter missing for table_att_unset method') unless name
if name.is_a?(Array)
name.each do |key|
- if htd.getValue(key).nil?
+ if tdb.build.getValue(key).nil?
raise ArgumentError, "Could not find attribute: #{key}"
end
- htd.remove(key)
+ tdb.setValue(key, nil)
Review comment:
We have a removeValue method so we'd better make use of it. Anyway the implementation is to just call setValue(key, null).
##########
File path: hbase-shell/src/main/ruby/hbase/admin.rb
##########
@@ -701,40 +703,40 @@ def alter(table_name_str, wait = true, *args)
# Delete column family
if method == 'delete'
raise(ArgumentError, 'NAME parameter missing for delete method') unless name
- htd.removeFamily(name.to_java_bytes)
+ tdb.removeColumnFamily(name.to_java_bytes)
hasTableUpdate = true
# Unset table attributes
elsif method == 'table_att_unset'
raise(ArgumentError, 'NAME parameter missing for table_att_unset method') unless name
if name.is_a?(Array)
name.each do |key|
- if htd.getValue(key).nil?
+ if tdb.build.getValue(key).nil?
raise ArgumentError, "Could not find attribute: #{key}"
end
- htd.remove(key)
+ tdb.setValue(key, nil)
end
else
- if htd.getValue(name).nil?
+ if tdb.build.getValue(name).nil?
raise ArgumentError, "Could not find attribute: #{name}"
end
- htd.remove(name)
+ tdb.setValue(name, nil)
end
hasTableUpdate = true
# Unset table configuration
elsif method == 'table_conf_unset'
raise(ArgumentError, 'NAME parameter missing for table_conf_unset method') unless name
if name.is_a?(Array)
name.each do |key|
- if htd.getConfigurationValue(key).nil?
+ if tdb.build.getValue(key).nil?
raise ArgumentError, "Could not find configuration: #{key}"
end
- htd.removeConfiguration(key)
+ tdb.setValue(key, nil)
Review comment:
Ditto.
##########
File path: hbase-shell/src/main/ruby/hbase/admin.rb
##########
@@ -701,40 +703,40 @@ def alter(table_name_str, wait = true, *args)
# Delete column family
if method == 'delete'
raise(ArgumentError, 'NAME parameter missing for delete method') unless name
- htd.removeFamily(name.to_java_bytes)
+ tdb.removeColumnFamily(name.to_java_bytes)
hasTableUpdate = true
# Unset table attributes
elsif method == 'table_att_unset'
raise(ArgumentError, 'NAME parameter missing for table_att_unset method') unless name
if name.is_a?(Array)
name.each do |key|
- if htd.getValue(key).nil?
+ if tdb.build.getValue(key).nil?
raise ArgumentError, "Could not find attribute: #{key}"
end
- htd.remove(key)
+ tdb.setValue(key, nil)
end
else
- if htd.getValue(name).nil?
+ if tdb.build.getValue(name).nil?
raise ArgumentError, "Could not find attribute: #{name}"
end
- htd.remove(name)
+ tdb.setValue(name, nil)
end
hasTableUpdate = true
# Unset table configuration
elsif method == 'table_conf_unset'
raise(ArgumentError, 'NAME parameter missing for table_conf_unset method') unless name
if name.is_a?(Array)
name.each do |key|
- if htd.getConfigurationValue(key).nil?
+ if tdb.build.getValue(key).nil?
raise ArgumentError, "Could not find configuration: #{key}"
end
- htd.removeConfiguration(key)
+ tdb.setValue(key, nil)
end
else
- if htd.getConfigurationValue(name).nil?
+ if tdb.build.getValue(name).nil?
raise ArgumentError, "Could not find configuration: #{name}"
end
- htd.removeConfiguration(name)
+ tdb.setValue(name, nil)
Review comment:
Ditto.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org