For the null key you should use NullWritable class, as discussed here: http://stackoverflow.com/questions/16198752/advantages-of-using-nullwritable-in-hadoop
Regards, Shahab On Mon, Apr 13, 2015 at 7:01 AM, Jean-Marc Spaggiari < [email protected]> wrote: > Hi Silvio, > > What is the key you try to write into your HBase table? From your code, > sound like you want your key to be null for all your values, which is not > possible in HBase. > > JM > > 2015-04-13 6:37 GMT-04:00 Silvio Di gregorio <[email protected] > >: > > > Hi, > > In Reduce phase when i write to Hbase Table "PFTableNa" > > context.write(null , put); > > Eclipse say me: > > *"The method write(ImmutableBytesWritable, Writable) in the type > > > TaskInputOutputContext<Text,BytesWritable,ImmutableBytesWritable,Writable> > > is not applicable for the arguments (null, Put)"* > > > > *put *is org > > > > > <eclipse-javadoc:%E2%98%82=LoadUnico/C:%5C/Users%5C/sdigregorio%5C/workspace-luna%5C/hbase-client-0.96.0-hadoop1.jar%3Corg> > > .apache > > > > > <eclipse-javadoc:%E2%98%82=LoadUnico/C:%5C/Users%5C/sdigregorio%5C/workspace-luna%5C/hbase-client-0.96.0-hadoop1.jar%3Corg.apache> > > .hadoop > > > > > <eclipse-javadoc:%E2%98%82=LoadUnico/C:%5C/Users%5C/sdigregorio%5C/workspace-luna%5C/hbase-client-0.96.0-hadoop1.jar%3Corg.apache.hadoop> > > .hbase > > > > > <eclipse-javadoc:%E2%98%82=LoadUnico/C:%5C/Users%5C/sdigregorio%5C/workspace-luna%5C/hbase-client-0.96.0-hadoop1.jar%3Corg.apache.hadoop.hbase> > > .client > > > > > <eclipse-javadoc:%E2%98%82=LoadUnico/C:%5C/Users%5C/sdigregorio%5C/workspace-luna%5C/hbase-client-0.96.0-hadoop1.jar%3Corg.apache.hadoop.hbase.client> > > .Put > > > > > <eclipse-javadoc:%E2%98%82=LoadUnico/C:%5C/Users%5C/sdigregorio%5C/workspace-luna%5C/hbase-client-0.96.0-hadoop1.jar%3Corg.apache.hadoop.hbase.client(Put.class%E2%98%83Put>.Put(byte[] > > row) > > byte[] rowkey = key.getBytes(); > > Put put = new Put(rowkey); > > > > the signature of the reduce method: > > reduce( Text key,Iterable<BytesWritable> values, Context context) > > > > and > > > > public static class Reduce extends TableReducer<Text, BytesWritable, > > ImmutableBytesWritable>{ > > > > in the main method: > > Configuration conf = HBaseConfiguration.create(); > > Job job = new Job(conf, "LetturaFileHDFS2HBase"); > > ... > > TableMapReduceUtil.initTableReducerJob("PFTableNa", Reduce.class, job); > > > > Thanks a lot > > Silvio > > >
