hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stack <st...@duboce.net>
Subject Re: a problem with HTable getRow and getScanner method (trunk)
Date Mon, 16 Jun 2008 16:48:29 GMT
acure wrote:
> hi
>  i use recent ver of trunk - and i'm realy know what it implicates (:)).
>
>  first - sugesion :
>
>     there are group of methods "getRow" and group "getScanner" - both 
> get as param array of collumns
>     but in "getRow" methods we have to put it without ":" at the end 
> of column family name, and for "getScanner" the colon is necessary.
>     i think that it will be good to make it identical.

Agreed.  This stuff was all recently refactored.  That should be fixed.  
I filed an issue.


> and the problem :
> there is table : "allusers_counters" with columnfamilies :  
> "pageSize:", "childrenCount:", "data:"
>
>        conf = new HBaseConfiguration();
>        conf.set("hbase.master", "localhost:60000");
>        HConnection connection = HConnectionManager.getConnection(conf);

Out of interest, why did you do the above?  Did you think you needed to?


>                   HTable htable = new HTable(conf, "allusers_counters");
>          BatchUpdate batch = new BatchUpdate("123456".getBytes());

In the API, you can not just pass String.  HTable does the getBytes for you.

>          batch.put("pageSize", "10".getBytes());
>          batch.put("childrenCount", "0".getBytes());
>          htable.commit(batch);                  System.out.println(" 
> data inserted ");
>                byte[][] cols = new byte[][]{ "pageSize".getBytes() 
> };       <----------------- there the colon is useless
>                             RowResult row = 
> htable.getRow("123456".getBytes(), cols);
>          System.out.println(" row = " + 
> row.get("pageSize".getBytes()).toString());
>                  // <-----------------------------  STEP 1
>
>          cols = new byte[][]{ "pageSize:".getBytes() };       
> <---------------------------   there the colon is necessary
>                  Scanner scanner = htable.getScanner(cols, 
> "123456".getBytes());                System.out.println(" ----- " + 
> scanner.iterator().hasNext());
>
>          // <-------------------------------- STEP 2
>
>
>
>   getRow - STEP 1 - returns value of cell
>
>   getScanner - STEP 2 - returns the iterator, which tell me that there 
> are no rows in this table.
>
>    there something work wrong, or i make something wrong...

Can you add more than one row and try it?  Perhaps you are suffering 
HBASE-686?

Thanks,
St.Ack



>
>             Best regards - Acure
>       
>


Mime
View raw message