1
votes

I executed this sentence en Pig and it works:

source = load 'hbase://DatosBicing' using org.apache.pig.backend.hadoop.hbase.HBaseStorage( 'datos:bikes', '-loadKey true') as (id1:int, bikes:int);

I try on to execute the same sentence in embeded Pig in java. The code is:

runMyQuery(pigServer,"hbase://DatosBicing");

pigServer.registerQuery("source = load '"+ inputFile + "' USING org.apache.pig.backend.hadoop.hbase.HBaseStorage( " + "'datos:bikes')"+ "as (id1:chararray, bikes:chararray) ;");

When I execute this code, I have the error:

org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1000: Error during parsing. Pig script failed to parse: pig script failed to validate: java.lang.RuntimeException: could not instantiate 'org.apache.pig.backend.hadoop.hbase.HBaseStorage' with arguments '[datos:bikes]'

Other parameters in Java code are:

PigServer pigServer = new PigServer("local");

   pigServer.registerJar("/usr/lib/hbase/lib/zookeeper.jar");
   pigServer.registerJar("/usr/lib/hbase/lib/protobuf-java-2.4.0a.jar");

Could someone help me?

1

1 Answers

0
votes

I think you can try the code below and show the result.

pigServer.registerQuery("source = load '"+ inputFile + "' USING org.apache.pig.backend.hadoop.hbase.HBaseStorage( " + "'datos:bikes', '-loadKey true')"+ "as (id1:chararray, bikes:chararray) ;");