简体   繁体   English

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

[英]PHP Hbase Thrift client returns array instead of TRowResult

We are using the Thrift client to access Hbase from PHP. 我们正在使用Thrift客户端从PHP访问Hbase。 Hbase version is hbase-0.90.4-cdh3u3. Hbase版本是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. 我的问题(更像是一个疑问)是Thrift API应该为许多方法返回TRowResult ,例如: scannerGetgetRowWithColumns ...而是返回带有单个TRowResult实例的数组。

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? 这些方法(通常应该返回一行或不返回)是否返回多个TRowResult实例? 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)? 我可以简单地在包装类中弹出这一行并返回它而不是返回数组吗(如果有空数组,则返回null)?

The .thrift documentation is pretty clear about what is supposed to be returned: .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(

(Although @throws NotFound is obsolete) (尽管@throws NotFound已过时)

Thanks! 谢谢!

There are getRows() and scannerGetList() methods, which returns array of TRowResult objects. 有getRows()和ScannerGetList()方法,它们返回TRowResult对象的数组。 I used hbase from cdh3u4, don't know if theese methods exists in cdh3u3. 我使用了来自cdh3u4的hbase,不知道cese3u3中是否存在这些方法。 BTW, cdh4 should already containn hbase 0.92 and support scan filters ;) 顺便说一句,cdh4应该已经包含hbase 0.92并支持扫描过滤器;)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM