hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stack <st...@duboce.net>
Subject Re: HBase: scanner with custom filter causes Exception
Date Wed, 11 Feb 2009 07:02:01 GMT
On Mon, Feb 9, 2009 at 11:09 PM, Michael Seibold <seibold@in.tum.de> wrote:

> Hi,
>
> I will try that now. How does that mechanism work?
>
> The custom filter is serialized according to the Writable interface by
> writing it to a DataOutput. How is the Object reconstructed from that?


The class name is passed.  The filters knows how to serialize itself being a
Writable.  On other side, name of class is read and using reflection an
instance is constructed.  This latter fails if the class is not in the
CLASSPATH serverside.  To get class name, does obj.getClass().getName().

St.Ack


>
> Does HBase use reflection for that? How does HBase know the class name?
>
> Kind regards,
> Michael
>
> El lun, 09-02-2009 a las 09:07 -0800, stack escribió:
> > Your new class needs to be on the server's CLASSPATH as well as on the
> > client-side.
> > St.Ack
> >
> >
> >
> > On Mon, Feb 9, 2009 at 4:26 AM, Michael Seibold <seibold@in.tum.de>
> wrote:
> >
> > > Hi,
> > >
> > > I want to create a scanner with a custom filter, but always get the
> > > exception below.
> > >
> > > 1. I have implemented the RowFilterInterface:
> > >
> > > public abstract class CustomFilter implements RowFilterInterface {
> > >
> > > //...implemented method from interface RowFilterInterface
> > >
> > >        public boolean filterRowKey(byte[] rowKey) {
> > > ...
> > >
> > >
> > > //...implemented method from interface Writable
> > >        public void write(DataOutput out) throws IOException {
> > >                out.writeUTF(str);
> > >        }
> > >
> > >        public void readFields(DataInput in) throws IOException {
> > >                str = in.readUTF();
> > >        }
> > >
> > >        public static CustomFilter read(DataInput in) throws IOException
> > >        {
> > >                CustomFilter f = new CustomFilter();
> > >                f.readFields(in);
> > >                return f;
> > >        }
> > > }
> > >
> > > 2. I create the scanner the following way:
> > >
> > > RowFilterInterface customScanFilter = new CustomFilter();
> > > table.getScanner(scanColumns, scanStartRow, customScanFilter);
> > >
> > >
> > > 3. I get the following exception in the region server:
> > > ERROR org.apache.hadoop.hbase.regionserver.HRegionServer
> > > : org.apache.hadoop.hbase.UnknownScannerException: Name: -1
> > > INFO org.apache.hadoop.ipc.HBaseServer: IPC Server handl
> > > call next(-1, 30) from 127.0.0.1:54631: error: org.apache.hadoop.
> > > hbase.UnknownScannerException: Name: -1
> > > org.apache.hadoop.hbase.UnknownScannerException: Name: -1
> > >        at
> > > org.apache.hadoop.hbase.regionserver.HRegionServer.next(HRegionServer
> > > .java:1568)
> > >        at sun.reflect.GeneratedMethodAccessor12.invoke(Unknown Source)
> > >        at
> > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> > > sorImpl.java:25)
> > >        at java.lang.reflect.Method.invoke(Method.java:597)
> > >        at org.apache.hadoop.hbase.ipc.HBaseRPC
> > > $Server.call(HBaseRPC.java:632)
> > >        at org.apache.hadoop.hbase.ipc.HBaseServer
> > > $Handler.run(HBaseServer.java:
> > > 895)
> > >
> > > What am I doing wrong? Does the region server need the java source code
> > > of my custom filter? Currently java source code of my custom filter is
> > > only available on the client machine, not on the machine where the
> > > region server is installed? How is this "mobile-code" via the Writable
> > > interface supposed to work? How do I make my custom scanner available
> > > for the region server?
> > >
> > > Kind regards,
> > > Michael
> > >
> > >
> > >
> > >
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message