Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
HBase >> mail # user >> doing a scan that will return random columns in a table's family


Copy link to this message
-
RE: doing a scan that will return random columns in a table's family
Result is just the client-side class which wraps whatever the server returns.  The ability to do this query is not really about whether Result has the methods to get at this data, but rather whether Scan supports this type of query (it does).

Scan.addFamily(family) will make it so that every column in the specified family is returned.

The Result that gets returned can be used in many different ways, including those described by David.  However, I generally recommend using Result.raw() and just operating directly on the KeyValues that are returned.  There is a non-zero cost to generating the maps via the convenience methods in Result.  Some of the more recent javadoc is a bit more explicit about that.

JG

> -----Original Message-----
> From: Peter Haidinyak [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, February 03, 2011 8:59 AM
> To: [EMAIL PROTECTED]
> Subject: RE: doing a scan that will return random columns in a table's family
>
> Thanks
>
> -----Original Message-----
> From: Buttler, David [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, February 03, 2011 8:53 AM
> To: [EMAIL PROTECTED]
> Subject: RE: doing a scan that will return random columns in a table's family
>
> By default that is what you get.  You do have to navigate through the results:
>
> Result.getFamilyMap():
>
> /**
>    * Map of qualifiers to values.
>    * <p>
>    * Returns a Map of the form: <code>Map<qualifier,value></code>
>    * @param family column family to get
>    * @return map of qualifiers to values
>    */
>   public NavigableMap<byte[], byte[]> getFamilyMap(byte [] family)
>
>
> Or if you don't know the family name even, use the Result.getMap() function
>
> /**
>    * Map of families to all versions of its qualifiers and values.
>    * <p>
>    * Returns a three level Map of the form:
>    *
> <code>Map<family,Map<qualifier,Map<timestamp,value>>></code>
>    * <p>
>    * Note: All other map returning methods make use of this map internally.
>    * @return map from families to qualifiers to versions
>    */
>   public NavigableMap<byte[], NavigableMap<byte[], NavigableMap<Long,
> byte[]>>> getMap()
>
> -----Original Message-----
> From: Pete Haidinyak [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, February 03, 2011 12:01 AM
> To: [EMAIL PROTECTED]
> Subject: doing a scan that will return random columns in a table's family
>
> Hi,
> If I have a table:family where I add new columns with computer
> generated column name (I won't know what they are to add them to a scan)
> is it possible to do a scan that returns every column in a row?
>
> Thanks
>
> -Pete
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB