You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Listas Discussões <li...@arianpasquali.com> on 2012/02/09 12:29:32 UTC
Is it possible to scan the whole table without specify column classifier?
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
Re: Is it possible to scan the whole table without specify column
classifier?
Posted by Doug Meil <do...@explorysmedical.com>.
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" <li...@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 <li...@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
Re: Is it possible to scan the whole table without specify column classifier?
Posted by Listas Discussões <li...@arianpasquali.com>.
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 <li...@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