Reputation: 11
I have the following code:
table = new HTable(hbaseConf, targetTable);
byte[] key = "key7".getBytes();
Put put1 = new Put(key);
put1.add(OUT_CF, DATA_COL, Bytes.toBytes("data"));
table.put(put1);
When debugging I see that the default TS I am getting for the put object is 9223372036854775807. After the put I see in hbase shell that the TS is 1394640871745 (current time in ms as expected). Does anyone knows why? How to do the conversion?
Upvotes: 0
Views: 1256
Reputation: 44061
Personally I don't know Hadoop, but following code produces same output as the default timestamp of your Put
object:
System.out.println(Long.MAX_VALUE);
// Output: 9223372036854775807
So I assume that the Put
-object just initializes its timestamp to Long.MAX_VALUE
. Unfortunately I have not found this behaviour documented on the Apache website.
Edit:
Since the documentation of Apache is very poor (not even explained what kind of timestamp they talk about) I have studied the source code and found my suspicion confirmed:
public static final long LATEST_TIMESTAMP = Long.MAX_VALUE;
See also this code excerpt:
public Put(byte [] row) {
this(row, null);
}
public Put(byte [] row, RowLock rowLock) {
this(row, HConstants.LATEST_TIMESTAMP, rowLock);
}
Upvotes: 1