Created 07-06-2016 12:43 PM
I am using HDP2.4 sandbox and I have a Hive external table on top of HBase, my application suppose to load data from Hive.
Below JRuby program runs once in a day to give me custom filter on my INT column values.
import org.apache.hadoop.hbase.HBaseConfiguration import org.apache.hadoop.hbase.client.HTable import org.apache.hadoop.hbase.client.Get import org.apache.hadoop.hbase.util.Bytes import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.client.ResultScanner; import org.apache.hadoop.hbase.client.Result; import java.util.ArrayList; def delete_get_some() var_table = "tiny_hbase_table1" htable = HTable.new(HBaseConfiguration.new, var_table) rs = htable.getScanner(Bytes.toBytes("o"), Bytes.toBytes("kingdomKey")) output = ArrayList.new output.add "ROW\t\t\t\t\t\tCOLUMN\+CELL" rs.each { |r| r.raw.each { |kv| row = Bytes.toInt(kv.getRow) fam = kv.getFamily ql = Bytes.toString(kv.getQualifier) ts = kv.getTimestamp val = Bytes.toInt(kv.getValue) rowval = Bytes.toInt(kv.getRow) output.add "#{row} #{ql} #{val}" } } output.each {|line| puts "#{line}\n"} end delete_get_some
But i am getting "NoMethodError: undefined method `add' for nil:NilClass" error while running this program.
Suggestions or advice please on this issue...
Created 07-06-2016 01:14 PM
@Mukesh Could you check your syntax?
It should be the one below
output = ArrayList.new output.add "ROW\t\t\t\t\t\tCOLUMN\+CELL"
Created 07-06-2016 01:14 PM
@Mukesh Could you check your syntax?
It should be the one below
output = ArrayList.new output.add "ROW\t\t\t\t\t\tCOLUMN\+CELL"
Created 07-06-2016 01:24 PM
Thankyou!!! yes its syntax error caused the issue and now i am able to run program successfully...
Created 07-06-2016 01:15 PM
Please post the error
Created 07-06-2016 01:22 PM
Error Message is below:-
hbase(main):027:0* delete_get_some NameError: undefined local variable or method `output' for #<Object:0x714863bd>