Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
HBase, mail # user - BigDecimalColumnInterpreter


Copy link to this message
-
Re: BigDecimalColumnInterpreter
anil gupta 2012-09-06, 19:22
Yes, we do. :)
Let me know the outcome. If you look at the BD ColumnInterpreter, getValue
method is converting the byte array into BigDecimal. So you should not have
any problem. The BD ColumnInterpreter is pretty similar to
LongColumnInterpreter.

Here is the code snippet for getValue() method which will convert Byte[] to
BigDecimal:

@Override
public BigDecimal getValue(byte[] paramArrayOfByte1, byte[] paramArrayOfByte2,
KeyValue kv) throws IOException {
if ((kv == null || kv.getValue() == null))
      return null;
    return Bytes.toBigDecimal(kv.getValue());
}

Thanks,
Anil
On Thu, Sep 6, 2012 at 11:43 AM, Julian Wissmann
<[EMAIL PROTECTED]>wrote:

> 0.92.1 from cdh4. I assume we use the same thing.
>
> 2012/9/6 anil gupta <[EMAIL PROTECTED]>
>
> > I am using HBase0.92.1. Which version you are using?
> >
> >
> > On Thu, Sep 6, 2012 at 10:19 AM, anil gupta <[EMAIL PROTECTED]>
> wrote:
> >
> > > Hi Julian,
> > >
> > > You need to add the column qualifier explicitly in the scanner. You
> have
> > > only added the column family in the scanner.
> > > I am also assuming that you are writing a ByteArray of BigDecimal
> object
> > > as value of these cells in HBase. Is that right?
> > >
> > > Thanks,
> > > Anil
> > >
> > >
> > > On Thu, Sep 6, 2012 at 2:28 AM, Julian Wissmann <
> > [EMAIL PROTECTED]>wrote:
> > >
> > >> Hi, anil,
> > >>
> > >> I presume you mean something like this:
> > >>         Scan scan = new Scan(_start, _end);
> > >>         scan.addFamily(family.getBytes());
> > >>         final ColumnInterpreter<BigDecimal, BigDecimal> ci = new
> > >> mypackage.BigDecimalColumnInterpreter();
> > >>         AggregationClient ag = new org.apache.hadoop.hbase.
> > >> client.coprocessor.AggregationClient(config);
> > >>         BigDecimal sum = ag.sum(Bytes.toBytes(tableName), new
> > >> BigDecimalColumnInterpreter(), scan);
> > >>
> > >>
> > >> When I call this,with the Endpoint in place and loaded as a jar, I get
> > the
> > >> above error.
> > >> When I call it without the endpoint loaded as coprocessor, though, I
> get
> > >> this:
> > >>
> > >> java.util.concurrent.ExecutionException:
> > >> org.apache.hadoop.hbase.client.RetriesExhaustedException: Failed after
> > >> attempts=10, exceptions:
> > >> Thu Sep 06 11:07:39 CEST 2012,
> > >> org.apache.hadoop.hbase.ipc.ExecRPCInvoker$1@7bd6747b,
> > >> java.io.IOException:
> > >> IPC server unable to read call parameters: Error in readFields
> > >> Thu Sep 06 11:07:40 CEST 2012,
> > >> org.apache.hadoop.hbase.ipc.ExecRPCInvoker$1@7bd6747b,
> > >> java.io.IOException:
> > >> IPC server unable to read call parameters: Error in readFields
> > >> Thu Sep 06 11:07:41 CEST 2012,
> > >> org.apache.hadoop.hbase.ipc.ExecRPCInvoker$1@7bd6747b,
> > >> java.io.IOException:
> > >> IPC server unable to read call parameters: Error in readFields
> > >> Thu Sep 06 11:07:42 CEST 2012,
> > >> org.apache.hadoop.hbase.ipc.ExecRPCInvoker$1@7bd6747b,
> > >> java.io.IOException:
> > >> IPC server unable to read call parameters: Error in readFields
> > >> Thu Sep 06 11:07:44 CEST 2012,
> > >> org.apache.hadoop.hbase.ipc.ExecRPCInvoker$1@7bd6747b,
> > >> java.io.IOException:
> > >> IPC server unable to read call parameters: Error in readFields
> > >> Thu Sep 06 11:07:46 CEST 2012,
> > >> org.apache.hadoop.hbase.ipc.ExecRPCInvoker$1@7bd6747b,
> > >> java.io.IOException:
> > >> IPC server unable to read call parameters: Error in readFields
> > >> Thu Sep 06 11:07:50 CEST 2012,
> > >> org.apache.hadoop.hbase.ipc.ExecRPCInvoker$1@7bd6747b,
> > >> java.io.IOException:
> > >> IPC server unable to read call parameters: Error in readFields
> > >> Thu Sep 06 11:07:54 CEST 2012,
> > >> org.apache.hadoop.hbase.ipc.ExecRPCInvoker$1@7bd6747b,
> > >> java.io.IOException:
> > >> IPC server unable to read call parameters: Error in readFields
> > >> Thu Sep 06 11:08:02 CEST 2012,
> > >> org.apache.hadoop.hbase.ipc.ExecRPCInvoker$1@7bd6747b,
> > >> java.io.IOException:
> > >> IPC server unable to read call parameters: Error in readFields

Thanks & Regards,
Anil Gupta