Karthikeyan V
Karthikeyan V

Reputation: 53

Number Format Exception while Exporting data from Hbase

I am planning to export a table by mentioning starttime and endtime in hbase. Since I am new to this I assumed that the start time and end time is the timestamp which is inserted along with the rows.

My table consists of:

ROW        COLUMN+CELL
 1         column=d:A, timestamp=1439284609013, value=HHHH
 1         column=d:B, timestamp=1439284620216, value=HHHH111
 2         column=d:A, timestamp=1439284637133, value=HHHH
 2         column=d:B, timestamp=1439284641872, value=HHHH111
 3         column=d:A, timestamp=1439284646830, value=HHHH
 3         column=d:B, timestamp=1439284651527, value=HHHH111
 3         column=d:C, timestamp=1439284665492, value=HHHH

I have executed:

hbase org.apache.hadoop.hbase.mapreduce.Export emp1 ~/KT/bkp 1439284609013 1439284641872

I got:

Exception in thread "main" java.lang.NumberFormatException: For input string: "1439284609013"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.lang.Integer.parseInt(Integer.java:495)
    at java.lang.Integer.parseInt(Integer.java:527)
    at org.apache.hadoop.hbase.mapreduce.Export.getConfiguredScanForJob(Export.java:112)
    at org.apache.hadoop.hbase.mapreduce.Export.createSubmittableJob(Export.java:96)
    at org.apache.hadoop.hbase.mapreduce.Export.main(Export.java:201)

Help me what to do

Upvotes: 0

Views: 838

Answers (3)

meskobalazs
meskobalazs

Reputation: 16031

The exact cause of the exception is, that the number 1439284609013 is too big to fit into Integer.

However, the actual issue lies elsewhere. I have looked at the source code, your parameters seem to be wrong:

emp1 ~/KT/bkp 1439284609013 1439284641872

You have given a String, another String and two Longs, these are the

  • args[0]: tableName
  • args[1]: outputDir
  • args[2]: startTime
  • args[3]: endTime

the problem is, that you are missing an argument: args[2] should be an Integer,startTime should become args[3] and endTime should become args[4].

In the source, that expected third, Integer argument is called versions, however I don't exactly know what that means.


Official documentation

Going through the source is one thing, but the official docs also give the syntax of Export the following:

$ bin/hbase org.apache.hadoop.hbase.mapreduce.Export <tablename> <outputdir> [<versions> [<starttime> [<endtime>]]]

By default, the Export tool only exports the newest version of a given cell, regardless of the number of versions stored. To export more than one version, replace <versions> with the desired number of versions.


Wrapping it up

To achive what you wanted originally, just simple add 1 as the third argument:

hbase org.apache.hadoop.hbase.mapreduce.Export emp1 ~/KT/bkp 1 1439284609013 1439284641872

Upvotes: 4

Karthikeyan V
Karthikeyan V

Reputation: 53

I entered only the start time and end time. Export is expecting versions before start and end time. So finally I entered the version number it worked.

./hbase org.apache.hadoop.hbase.mapreduce.Export emp1 ~/KT/bkp 2147483647 1439284609013 1439284646830

Upvotes: 0

Weslor
Weslor

Reputation: 22440

Timestamps are usually associated to Long types, that have 64 bits

Integers have 32 bits and the range is only -2,147,483,648 to 2,147,483,647 in Java

Upvotes: 3

Related Questions