【发布时间】:2016-07-06 07:21:27
【问题描述】:
如果我尝试使用此代码从 HBase 表中检索数据:
val get = new Get(Bytes.toBytes(extracted.user.rowKey.toString))
val res = table.get(get)
我不确定val res = table.get(get) 行是否会返回结果,因为带有此行键的行:extracted.socialUser.socialUserConnectionId.toString 传递给 Get 构造函数可能不存在于 HBase 表中。
我正在尝试这样的事情:
val get = new Get(Bytes.toBytes(extracted.socialUser.socialUserConnectionId.toString))
val res = table.get(get)
if (!res) {
/* Create the row in the HBase table */
}
但它在 if 语句中给了我一个错误:Expression of this type result doesn't convert to type Boolean。有什么办法可以解决这个问题吗?
【问题讨论】: