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/08/18 14:01:41 UTC

[GitHub] [hbase] bitoffdev commented on a change in pull request #2268: HBASE-24874 Fix hbase-shell access to ModifiableTableDescriptor methods

bitoffdev commented on a change in pull request #2268:
URL: https://github.com/apache/hbase/pull/2268#discussion_r472220333



##########
File path: hbase-shell/src/main/ruby/hbase/admin.rb
##########
@@ -664,6 +668,40 @@ def alter_status(table_name)
       puts 'Done.'
     end
 
+    #----------------------------------------------------------------------------------------------
+    # Use our internal logic to convert from "spec string" format to a coprocessor descriptor
+    #
+    # Provided for backwards shell compatibility
+    #
+    # @param [String] spec_str
+    # @return [ColumnDescriptor]
+    def coprocessor_descriptor_from_spec_str(spec_str)
+      method = TableDescriptorBuilder.java_class.declared_method_smart :toCoprocessorDescriptor
+      method.accessible = true
+      result = method.invoke(nil, spec_str).to_java
+      # unpack java's Optional to be more rubonic
+      return result.isPresent ? result.get : nil
+    end
+
+    #----------------------------------------------------------------------------------------------
+    # Use CoprocessorDescriptorBuilder to convert a Hash to CoprocessorDescriptor
+    #
+    # @param [Hash] spec column descriptor specification
+    # @return [ColumnDescriptor]
+    def coprocessor_descriptor_from_hash(spec)
+      classname = spec['CLASSNAME']
+      jar_path = spec['JAR_PATH']
+      priority = spec['PRIORITY']
+      properties = spec['PROPERTIES']
+
+      builder = CoprocessorDescriptorBuilder.newBuilder classname

Review comment:
       Good call, the current NullPointerException isn't super user friendly. I just updated the patch to handle this more user-friendly.




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