gpt4 book ai didi

java - HBase 设置时间戳

转载 作者:可可西里 更新时间:2023-11-01 14:18:40 26 4
gpt4 key购买 nike

我在使用 java api 设置行时间戳时遇到问题。

当我尝试添加时间戳值以放入构造函数(或放入 put.add() 中)时,没有任何反应,并且在从表中读取行后,我得到了系统提供的时间戳。

public static boolean addRecord(String tableName, String rowKey,
String family, String qualifier, Object value)
{
try {
HTable table = new HTable(conf, tableName);
Put put = new Put(Bytes.toBytes(rowKey), 12345678l);
put.add(Bytes.toBytes(family), Bytes.toBytes(qualifier), Bytes.toBytes(value.toString()));
table.put(put);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}

HBase 0.92.1 以独立模式运行。

在此先感谢您的帮助!

最佳答案

很可能,您在表中已经有具有时间戳 > 12345678l 的行。要确认情况并非如此,请尝试使用非常大的时间戳值,比如 Long.MAX_VALUE

如果确实如此,您只需删除旧版本即可。然后将显示此条目。

关于java - HBase 设置时间戳,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10830922/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com