简体   繁体   中英

PHP Hbase Thrift client returns array instead of 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!

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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