dspvin19712 2012-06-13 13:04
浏览 170
已采纳

PHP Hbase Thrift客户端返回数组而不是TRowResult

We are using the Thrift client to access Hbase from PHP. Hbase version is hbase-0.90.4-cdh3u3.

My problem (well, it's more like a doubt) is that the Thrift API is supposed to return TRowResult for a number of methods, for example: scannerGet, getRowWithColumns... Instead, it returns an array with a single TRowResult instance.

Does anyone know why is that? Is there any case when these methods - that typically are supposed to return a single row or none - return more than one TRowResult instances? Can I simply pop this one row in my wrapper class and return it instead of returning the array (or null if there's empty array)?

The .thrift documentation is pretty clear about what is supposed to be returned:

/** 
 * Get the specified columns for the specified table and row at the latest
 * timestamp. Returns an empty list if the row does not exist.
 * 
 * @return TRowResult containing the row and map of columns to TCells
 */
list<TRowResult> getRowWithColumns(

[...]

/**
 * Returns the scanner's current row value and advances to the next
 * row in the table.  When there are no more rows in the table, or a key
 * greater-than-or-equal-to the scanner's specified stopRow is reached,
 * an empty list is returned.
 *
 * @return a TRowResult containing the current row and a map of the columns to TCells.
 *
 * @throws IllegalArgument if ScannerID is invalid
 *
 * @throws NotFound when the scanner reaches the end
 */
list<TRowResult> scannerGet(

(Although @throws NotFound is obsolete)

Thanks!

  • 写回答

1条回答 默认 最新

  • duankanjian4642 2012-06-14 10:58
    关注

    There are getRows() and scannerGetList() methods, which returns array of TRowResult objects. I used hbase from cdh3u4, don't know if theese methods exists in cdh3u3. BTW, cdh4 should already containn hbase 0.92 and support scan filters ;)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥17 pro*C预编译“闪回查询”报错SCN不能识别
  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)