Navyah
Navyah

Reputation: 1680

How to generate RowId automatically in Hbase MapReduce program

I need to load a dataset file into hbase table.I googled some examples and with that examples i tried reading a file and load it in Hbase. but only the first row is reading.Only one row of data is reading, i need to read all the data , i dont know where i went wrong I have the file in this format

year  class    days   mm   
   1964   9     20.5     8.8          
   1964  10     13.6     4.2      
   1964  11     11.8     4.7     
   1964  12      7.7     0.1       
   1965   1      7.3     0.8       
   1965   2     6.5     0.1         
   1965   3     10.8     1.4         
   1965   4     13.2     3.5         
   1965   5     16.1     7.0         
   1965   6     19.0     9.2          
   1965   7     18.7    10.7       
   1965   8     19.9    10.9          
   1965   9      16.6     8.2 

please can any one correct me, where i went wrong, i need to load all the data contain in the file, but i can load only first row of data

Upvotes: 2

Views: 927

Answers (2)

Ran
Ran

Reputation: 11

I guess it's because the rowkeys of your table are by default taking the value of the first column which is 'year' so hbase will only read it once since a rowkey cannot be duplicated. Try to set your rowkey to a different column.

Upvotes: 0

Tagar
Tagar

Reputation: 14939

https://github.com/imyousuf/smart-dao/tree/hbase/smart-hbase/hbase-auto-long-rowid-incrementor/ Did not test, but seems to be what you're looking for.

Also, look Hbase auto increment any column/row-key

Monolitically increasing row keys are not recommended in HBase, see this for reference: http://hbase.apache.org/book/rowkey.design.html, p.6.3.2. In fact, using globally ordered row keys would cause all instances of your distributed application write to the same region, which will become a bottleneck.

Upvotes: 1

Related Questions