You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Edward Capriolo <ed...@gmail.com> on 2009/12/07 21:54:45 UTC
Scanner API Question
I have spend some time writing an app to load random data into HBASE
and record the performance from proof of concept type work.
My table definition:
//create 'webdata', {NAME => 'image'},{NAME => 'anchor'},{NAME => 'raw_data'}
hbase(main):003:0> scan 'webdata' ,{ LIMIT => 1 }
ROW COLUMN+CELL
http://www.Eleni.com/Achlam column=anchor:Alverta Angstrom
cathodegraph , timestamp=1259967232947, value=xkot
ydeae qtlx
http://www.Eleni.com/Achlam column=anchor:Polypoda abidingly ,
timestamp=1259967232947, value=fsenekwe
ydeae
http://www.Eleni.com/Achlam column=anchor:antimetropic Lecuona
ovariotomize , timestamp=1259967232947, value=
ydeae bq
http://www.Eleni.com/Achlam column=anchor:delightsomeness Egyptiac
archaism , timestamp=1259967232947, value=
ydeae http://www.mhtwhf.com/ppmgwhblg
http://www.Eleni.com/Achlam column=anchor:disrump Darach
unzealousness , timestamp=1259967232947, value=http:
ydeae //www.qso.com/mridqddt
http://www.Eleni.com/Achlam column=anchor:endoradiosonde Ursel ,
timestamp=1259967232947, value=http://www.sb
ydeae j.com/vplwkd
http://www.Eleni.com/Achlam column=anchor:gaw ,
timestamp=1259967232947, value=http://www.cpl.com/teaok
I wrote a Java scanner
-----------------------------------------
public static void main (String [] args) throws IOException {
HBaseConfiguration h = new HBaseConfiguration();
HTable table = new HTable("webdata");
Scan s = new Scan();
s.addFamily( Bytes.toBytes("anchor") );
ResultScanner scanner = table.getScanner(s);
int rowCount=0;
try {
for (Result rr:scanner){
rowCount++;
KeyValue [] kvs = rr.raw();
for (KeyValue kv : kvs){
System.out.println("col:"+new String(kv.getColumn()) );
System.out.println("fam:"+new String(kv.getFamily()) );
System.out.println("val:"+new String(kv.getValue()) );
}//end kv
} //end rr
----------------------------------------------
which returns as a first row correctly.
As does
s.addColumn( Bytes.toBytes("anchor") ); (without s.addFamily(
Bytes.toBytes("anchor") ); )
----------------------------------------------
col:anchor:Alverta Angstrom cathodegraph
fam:anchor
val:xkotqtlx
--------------------------------------------
Now i am trying other scanner addColumn methods with no results:
s.addColumn( Bytes.toBytes("anchor"), Bytes.toBytes("anchor") );
s.addColumn( Bytes.toBytes("anchor"),
Bytes.toBytes("anchor:Alverta Angstrom cathodegraph") );
s.addColumn( Bytes.toBytes("anchor"), Bytes.toBytes("Alverta
Angstrom cathodegraph") );
Any hints?
Thank you
Re: Scanner API Question
Posted by Edward Capriolo <ed...@gmail.com>.
On Mon, Dec 7, 2009 at 6:18 PM, Erik Holstad <er...@gmail.com> wrote:
> Hey Edward!
>
> s.addColumn( Bytes.toBytes("anchor"), Bytes.toBytes("anchor") );
> this looks for "anchor:anchor", which I don't see
>
> s.addColumn( Bytes.toBytes("anchor"), Bytes.toBytes("anchor:Alverta Angstrom
> cathodegraph") );
> this looks for "anchor:anchor:Alverta Angstrom cathodegraph" which I don't
> see
>
> s.addColumn( Bytes.toBytes("anchor"), Bytes.toBytes("Alverta Angstrom
> cathodegraph") );
> this looks for "anchor:Alverta Angstrom cathodegraph", this should work, not
> sure why it isn't
> would recommend to check the KeyValue being returned from the family scan
> and compare it
> to what you are adding to your scanner, might be some weirdness with the
> spaces.
>
> Regards Erik
>
Doh! Correct. Trailing white space for the insert. HBase is now the
most recent medium for me to make this mistake!
Thanks
Re: Scanner API Question
Posted by Erik Holstad <er...@gmail.com>.
Hey Edward!
s.addColumn( Bytes.toBytes("anchor"), Bytes.toBytes("anchor") );
this looks for "anchor:anchor", which I don't see
s.addColumn( Bytes.toBytes("anchor"), Bytes.toBytes("anchor:Alverta Angstrom
cathodegraph") );
this looks for "anchor:anchor:Alverta Angstrom cathodegraph" which I don't
see
s.addColumn( Bytes.toBytes("anchor"), Bytes.toBytes("Alverta Angstrom
cathodegraph") );
this looks for "anchor:Alverta Angstrom cathodegraph", this should work, not
sure why it isn't
would recommend to check the KeyValue being returned from the family scan
and compare it
to what you are adding to your scanner, might be some weirdness with the
spaces.
Regards Erik