hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Meil <doug.m...@explorysmedical.com>
Subject Re: Is it possible to scan the whole table without specify column classifier?
Date Thu, 09 Feb 2012 17:45:06 GMT

Yep!  You got it.

Don't forget to always close the ResultScanner....
http://hbase.apache.org/book.html#data_model_operations






On 2/9/12 6:35 AM, "Listas Discussões" <listas@arianpasquali.com> wrote:

>I've just realized how to do it
>there is no need to specify column at the scan.
>
>here is the code
>
>Scan s = new Scan();
>
> HTable table = new HTable(conf,tableName);
>ResultScanner scanner= table.getScanner(s);
>
>// Scanners return Result instances.
>// Now, for the actual iteration. One way is to use a while loop like so:
>for (Result rr = scanner.next(); rr != null; rr = scanner.next()) {
>// print out the row we found and the columns we were looking for
>System.out.println("Found row: " + rr);
>result.add(rr);
>}
>
>// The other approach is to use a foreach loop. Scanners are iterable!
>// for (Result rr : scanner) {
>//   System.out.println("Found row: " + rr);
>// }
>
>scanner.close();
>
>
>tks
>arian
>
>2012/2/9 Listas Discussões <listas@arianpasquali.com>
>
>> I have a table with classifiers not defined correctly.
>> I would like to scan all of them and after that reorganize the schema.
>>
>> So the question is
>> - Is it possible to scan the whole table without specify column
>>classifier?
>> and if it is not, there is some how to read all the table classifiers?
>>
>> tks
>>
>>
>>
>
>
>-- 
>Arian Pasquali
>FEUP researcher
>twitter: @arianpasquali
>www.arianpasquali.com



Mime
View raw message