Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Has the len function to get the length of a hbase cell been changed ?

Highlighted

Has the len function to get the length of a hbase cell been changed ?

New Contributor

I used to get then length of a cell in hbase with the len function of org.apache.hadoop.hbase.util.Bytes jar.

This worked fine in hadoop version 2.5.3.0 and hbase 1.1.2

HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 1.1.2.2.5.3.0-37, rcb8c969d1089f1a34e9df11b6eeb96e69bcf878d, Tue Nov 29 21:55:20 UTC 2016

hbase(main):001:0> scan 'NWX.BIG_DATA',{COLUMN => ['0:PROCESSED'], LIMIT => 3 }
ROW COLUMN+CELL
2000000001 column=0:PROCESSED, timestamp=1520600431206, value=U
2000000002 column=0:PROCESSED, timestamp=1520600431784, value=U
2000000003 column=0:PROCESSED, timestamp=1520600433132, value=U
3 row(s) in 0.7790 seconds

hbase(main):002:0> scan 'NWX.BIG_DATA',{COLUMN => ['0:PROCESSED','0:DATA:len'], LIMIT => 3 }
ROW COLUMN+CELL
2000000001 column=0:DATA, timestamp=1522853598827, value=22006
2000000001 column=0:PROCESSED, timestamp=1520600431206, value=U
2000000002 column=0:DATA, timestamp=1520600431682, value=22831
2000000002 column=0:PROCESSED, timestamp=1520600431784, value=U
2000000003 column=0:DATA, timestamp=1520600432945, value=42097
2000000003 column=0:PROCESSED, timestamp=1520600433132, value=U
3 row(s) in 0.0190 seconds

Now, after the upgrade from our Test Cluster to hadoop 2.6.4.0 and hbase 1.1.2 i got following error messages:

HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 1.1.2.2.6.4.0-91, r2a88e694af7238290a5747f963a4fa0079c55bf9, Thu Jan 4 10:42:39 UTC 2018

hbase(main):001:0> scan 'NWX.BIG_DATA',{COLUMN => ['0:PROCESSED'], LIMIT => 3 }
ROW COLUMN+CELL
2000000001 column=0:PROCESSED, timestamp=1520600431206, value=U
2000000002 column=0:PROCESSED, timestamp=1520600431784, value=U
2000000003 column=0:PROCESSED, timestamp=1520600433132, value=U
3 row(s) in 0.1910 seconds

hbase(main):002:0> scan 'NWX.BIG_DATA',{COLUMN => ['0:PROCESSED','0:DATA:len'], LIMIT => 3 }
ROW COLUMN+CELL

ERROR: wrong number of arguments (3 for 1)



Exception `ArgumentError' at org/jruby/RubyMethod.java:129 - wrong number of arguments (3 for 1)

ERROR: wrong number of arguments (3 for 1)
Backtrace: org/jruby/RubyMethod.java:129:in `call'
/usr/hdp/2.6.4.0-91/hbase/lib/ruby/hbase/table.rb:695:in `convert_bytes_with_position'
/usr/hdp/2.6.4.0-91/hbase/lib/ruby/hbase/table.rb:688:in `convert_bytes'
/usr/hdp/2.6.4.0-91/hbase/lib/ruby/hbase/table.rb:684:in `convert'
/usr/hdp/2.6.4.0-91/hbase/lib/ruby/hbase/table.rb:661:in `to_string'
/usr/hdp/2.6.4.0-91/hbase/lib/ruby/hbase/table.rb:514:in `_scan_internal'
file:/usr/hdp/2.6.4.0-91/hbase/lib/ruby/jruby-complete-1.6.8.jar!/builtin/java/java.util.rb:7:in `each'
/usr/hdp/2.6.4.0-91/hbase/lib/ruby/hbase/table.rb:507:in `_scan_internal'
/usr/hdp/2.6.4.0-91/hbase/lib/ruby/shell/commands/scan.rb:109:in `scan'
/usr/hdp/2.6.4.0-91/hbase/lib/ruby/shell/commands/scan.rb:100:in `command'
org/jruby/RubyKernel.java:2113:in `send'
/usr/hdp/2.6.4.0-91/hbase/lib/ruby/shell/commands.rb:34:in `command_safe'
/usr/hdp/2.6.4.0-91/hbase/lib/ruby/shell/commands.rb:103:in `translate_hbase_exceptions'
/usr/hdp/2.6.4.0-91/hbase/lib/ruby/shell/commands.rb:34:in `command_safe'
/usr/hdp/2.6.4.0-91/hbase/lib/ruby/shell.rb:144:in `internal_command'
/usr/hdp/2.6.4.0-91/hbase/lib/ruby/shell.rb:136:in `command'
(eval):2:in `scan'
(hbase):1:in `evaluate'
org/jruby/RubyKernel.java:1112:in `eval'
file:/usr/hdp/2.6.4.0-91/hbase/lib/ruby/jruby-complete-1.6.8.jar!/META-INF/jruby.home/lib/ruby/1.8/irb/workspace.rb:81:in `evaluate'
file:/usr/hdp/2.6.4.0-91/hbase/lib/ruby/jruby-complete-1.6.8.jar!/META-INF/jruby.home/lib/ruby/1.8/irb/context.rb:219:in `evaluate'
file:/usr/hdp/2.6.4.0-91/hbase/lib/ruby/jruby-complete-1.6.8.jar!/META-INF/jruby.home/lib/ruby/1.8/irb.rb:158:in `eval_input'
file:/usr/hdp/2.6.4.0-91/hbase/lib/ruby/jruby-complete-1.6.8.jar!/META-INF/jruby.home/lib/ruby/1.8/irb.rb:271:in `signal_status'
file:/usr/hdp/2.6.4.0-91/hbase/lib/ruby/jruby-complete-1.6.8.jar!/META-INF/jruby.home/lib/ruby/1.8/irb.rb:155:in `eval_input'
file:/usr/hdp/2.6.4.0-91/hbase/lib/ruby/jruby-complete-1.6.8.jar!/META-INF/jruby.home/lib/ruby/1.8/irb/ruby-lex.rb:244:in `each_top_level_statement'
org/jruby/RubyKernel.java:1439:in `loop'
file:/usr/hdp/2.6.4.0-91/hbase/lib/ruby/jruby-complete-1.6.8.jar!/META-INF/jruby.home/lib/ruby/1.8/irb/ruby-lex.rb:230:in `each_top_level_statement'
org/jruby/RubyKernel.java:1212:in `catch'
file:/usr/hdp/2.6.4.0-91/hbase/lib/ruby/jruby-complete-1.6.8.jar!/META-INF/jruby.home/lib/ruby/1.8/irb/ruby-lex.rb:229:in `each_top_level_statement'
file:/usr/hdp/2.6.4.0-91/hbase/lib/ruby/jruby-complete-1.6.8.jar!/META-INF/jruby.home/lib/ruby/1.8/irb.rb:154:in `eval_input'
/usr/hdp/2.6.4.0-91/hbase/bin/hirb.rb:205:in `start'
org/jruby/RubyKernel.java:1212:in `catch'
/usr/hdp/2.6.4.0-91/hbase/bin/hirb.rb:204:in `start'
/usr/hdp/2.6.4.0-91/hbase/bin/hirb.rb:210:in `(root)'

Is there something wrong mit my command ?

Thanks in advance

Don't have an account?
Coming from Hortonworks? Activate your account here