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


PHP Hbase Thrift client returns array instead of TRowResult

我们使用Thrift客户端从PHP访问Hbase。HBase版本是hbase-0.90.4-cdh3u3。

我的问题(嗯,这更像是一个疑问)是Thrift API应该为许多方法返回TRowResult,例如:scannerGetgetRowWithColumns...相反,它返回一个包含单个TRowResult实例的数组。

有谁知道这是为什么?当这些方法(通常应该返回一行或无)返回多个TRowResult实例时,是否存在任何情况?我可以简单地在我的包装类中弹出这一行并返回它而不是返回数组(如果有空数组,则返回 null)吗?

.thrift 文档非常清楚地说明了应该返回的内容:

/** 
 * 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(

(虽然@throws NotFound已经过时了)

谢谢!

有 getRows() 和 scannerGetList() 方法,它们返回 TRowResult 对象的数组。我使用了 cdh3u4 中的 hbase,不知道 cdh3u3 中是否存在这些方法。顺便说一句,cdh4应该已经包含hbase 0.92并支持扫描过滤器;)