It looks like you're using Pig to scan HBase results from Java. Why does this need to be done in Java code on the client? Typically iterating over relations is done via a MR job in the tasks. Could you instead write a Pig script to achieve your goals with a UDF?
Or if it needs to be done in a single Java thread, why not just use the HBase client directly? More context around what you're trying to do would be helpful. thanks, Bill On Tue, Feb 28, 2012 at 12:25 AM, chethan <[email protected]> wrote: > hi, > > I am implementing PIG in java. following is the code that i am using to > achieve. > > 1. I am appending the result that is being taken from the HBASE table into > TUPLE which is defined outside. > 2. I want to reuse that TUPLE back in PIG commands > > public static void runIdQuery(PigServer pigServer, String inputFile, > String columnname, int version) throws IOException { > String result = null; > TupleFactory TUPLEFACTORY = TupleFactory.getInstance(); > Tuple resultuple = TUPLEFACTORY.newTuple(1); > Tuple t ; > pigServer.registerJar(inputFile); > > // fetching the data from HBASE table. > pigServer.registerQuery("b = load 'hbase://logdata' using > HBase.HBaseStorage('cf:" + columnname + "','-loadKey true -gt " + > startindex + " -lte " + endindex + "') as > (id:chararray,name:chararray);"); > > Iterator<Tuple> it_b = pigServer.openIterator("b"); > while (it_b.hasNext()) { > > // the result is being added to a tuple which is external to the PIG > t = it_b.next(); > resultuple.set(version, t.get(1).toString()); > result = t.get(1).toString(); > System.out.println("result b : " + result); > } > > // now i want to use that tuple again back inside PIG > pigServer.store("t", "id.out"); > } > > Thanks & Regards > Chethan Prakash > -- *Note that I'm no longer using my Yahoo! email address. Please email me at [email protected] going forward.*
