Search code examples
hadoophivehbasehortonworks-data-platform

Import TSV file into hbase table


I'm using hortonworks 2.1 with hbase and hive. I want to create a hbase table from tsv file. The file is here:

  id    c1  c2
row1    1   22
row2    e1  42
row3    g1  f2
row4    f1  c2
row5    d1  c2
row6    c1  42
row7    e1  c2
row8    c1  c2
row9    c1  c2
row10   c1  22

The command I used is:

bin/hbase org.apache.hadoop.hbase.mapreduce.ImportTsv -Dimporttsv.columns= HBASE_ROW_KEY,d:c1,d:c2 hbaseTable /tmp/testTSV.tsv

But I got this error:

SyntaxError: (hbase):5: syntax error, unexpected tSYMBEG

this is the error:

hbase(main):007:0> ImportTsv -Dimporttsv.columns= HBASE_ROW_KEY,d:c1,d:c2 hbaseTable/tmp/testTSV.tsv
SyntaxError: (hbase):7: syntax error, unexpected tSYMBEG

ImportTsv -Dimporttsv.columns= HBASE_ROW_KEY,d:c1,d:c2 hbaseTable /tmp/testTSV.tsv
                                              ^

Solution

  • Do you have a table already created in Hbase ? You will first have to create a table in Hbase with 'd' as a column family and then you can import this tsv file into that table.