Created 11-24-2016 01:23 PM
I have a custom function written in Ruby to count the number of columns. But I don't know how to add this function in HBase shell? Is there a way to add any custom functions of UDFs in HBase shell?
Created 11-28-2016 08:19 PM
Most likely you would prefer to pipe the results of your HBase shell command into your Ruby function.
Could you show some of the source code or pseudo logic of your Ruby function so that we can verify?
Created 11-29-2016 02:51 AM
Here is the ruby function.
def count_table(tablename, args = {})
table = @shell.hbase_table(tablename)
# Run the scanner
scanner = table._get_scanner(args)
count = 0
iter = scanner.iterator
# Iterate results
while iter.hasNext
row = iter.next
count += 1
end
# Return the counter
return count
end
Created 12-07-2016 03:30 PM
Could you describe why you want to add this Ruby function to HBase shell?
Also - why are you looking to count the number of columns? Do you mean column families in HBase or Column Qualifiers?
If you can give a recap of your overall project, that will help. There may be a much easier solution with a different approach.