You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Adrian Acosta Mitjans <am...@estudiantes.uci.cu> on 2013/04/20 18:12:05 UTC

hbase + mapreduce

Hello:

I'm working in a proyect, and i'm using hbase for storage the data, y have this method that work great but without the performance i'm looking for, so i want is to make the same but using mapreduce.


public ArrayList<MyObject> findZ(String z) throws IOException {

        ArrayList<MyObject> rows = new ArrayList<MyObject>();
        Configuration conf = HBaseConfiguration.create();
        HTable table = new HTable(conf, "test");
        Scan s = new Scan();
        s.addColumn(Bytes.toBytes("x"), Bytes.toBytes("y"));
        ResultScanner scanner = table.getScanner(s);
        try {
            for (Result rr : scanner) {
                if (Bytes.toString(rr.getValue(Bytes.toBytes("x"), Bytes.toBytes("y"))).equals(z)) {
                    rows.add(getInformation(Bytes.toString(rr.getRow())));
                }
            }
        } finally {
            scanner.close();
        }
        return archivos;
    }

the getInformation method take all the columns and convert the row in MyObject type.

I just want a example or a link to a tutorial that make something like this,  i want to get a result type as answer and not a number to count words, like many a found.
My natural language is spanish, so sorry if something is not well writing.

Thanths
http://www.uci.cu