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 ;)

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

报告相同问题?

悬赏问题

  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化