You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by chethan <ch...@gmail.com> on 2012/02/29 12:14:16 UTC

Problem in storing records into HBase using HBaseStorage

Hi,

I am having a UDF function that returns Tuple and that Tuple is going into
HBaseStorage.

these are the commands:

pigServer.registerJar("/home/chethan/UPPER.jar");
        pigServer.registerQuery("raw_data = LOAD
'/home/chethan/sample_data.csv' USING PigStorage( ',' ) AS (listing_id:
chararray,fname: chararray,lname: bytearray );");
        pigServer.registerQuery("B = FOREACH raw_data GENERATE
myudfs.UPPER('testlog');");

pigServer.registerQuery("STORE B INTO 'hbase://materialformation' USING
 HBase.HBaseStorage('cf:depth cf:sand cf:limestone cf:dolomite
cf:shales');");

it is giving exception, No columns to insert.

i am generating schema for B: {(depth: float,sandstone: float,limestone:
float,dolomite: float,shales: float)}

generating schema like this:

public Schema outputSchema(Schema input) {
        try{
            Schema tupleSchema = new Schema();
            tupleSchema.add(new Schema.FieldSchema("depth",
DataType.FLOAT));
            tupleSchema.add(new Schema.FieldSchema("sandstone",
DataType.FLOAT));
            tupleSchema.add(new Schema.FieldSchema("limestone",
DataType.FLOAT));
            tupleSchema.add(new Schema.FieldSchema("dolomite",
DataType.FLOAT));
            tupleSchema.add(new Schema.FieldSchema("shales",
DataType.FLOAT));
            System.out.println("inside schema");
            return tupleSchema;
            //return new Schema(new
Schema.FieldSchema(getSchemaName(this.getClass().getName().toLowerCase(),
input),

  //tupleSchema, DataType.TUPLE));

        }catch (Exception e){
                return null;
        }
    }

but still getting this error,

Re: Problem in storing records into HBase using HBaseStorage

Posted by Bill Graham <bi...@gmail.com>.
What happens when you remove the store to HBase and just do a store to
HDFS? Do you see data? Get that working first, then try writing to HBase.

Also, you'd udf catches an exception and swallows it before returning null.
That's a great way to hide a bug. I'd recommend doing something more
informative there like logging an error and incrementing a counter.


On Wed, Feb 29, 2012 at 3:14 AM, chethan <ch...@gmail.com> wrote:

> Hi,
>
> I am having a UDF function that returns Tuple and that Tuple is going into
> HBaseStorage.
>
> these are the commands:
>
> pigServer.registerJar("/home/chethan/UPPER.jar");
>        pigServer.registerQuery("raw_data = LOAD
> '/home/chethan/sample_data.csv' USING PigStorage( ',' ) AS (listing_id:
> chararray,fname: chararray,lname: bytearray );");
>        pigServer.registerQuery("B = FOREACH raw_data GENERATE
> myudfs.UPPER('testlog');");
>
> pigServer.registerQuery("STORE B INTO 'hbase://materialformation' USING
>  HBase.HBaseStorage('cf:depth cf:sand cf:limestone cf:dolomite
> cf:shales');");
>
> it is giving exception, No columns to insert.
>
> i am generating schema for B: {(depth: float,sandstone: float,limestone:
> float,dolomite: float,shales: float)}
>
> generating schema like this:
>
> public Schema outputSchema(Schema input) {
>        try{
>            Schema tupleSchema = new Schema();
>            tupleSchema.add(new Schema.FieldSchema("depth",
> DataType.FLOAT));
>            tupleSchema.add(new Schema.FieldSchema("sandstone",
> DataType.FLOAT));
>            tupleSchema.add(new Schema.FieldSchema("limestone",
> DataType.FLOAT));
>            tupleSchema.add(new Schema.FieldSchema("dolomite",
> DataType.FLOAT));
>            tupleSchema.add(new Schema.FieldSchema("shales",
> DataType.FLOAT));
>            System.out.println("inside schema");
>            return tupleSchema;
>            //return new Schema(new
> Schema.FieldSchema(getSchemaName(this.getClass().getName().toLowerCase(),
> input),
>
>  //tupleSchema, DataType.TUPLE));
>
>        }catch (Exception e){
>                return null;
>        }
>    }
>
> but still getting this error,
>



-- 
*Note that I'm no longer using my Yahoo! email address. Please email me at
billgraham@gmail.com going forward.*