You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by Abdel Hakim Deneche <ad...@maprtech.com> on 2016/02/26 18:51:26 UTC

Question about DrillAggFunc

Looking at VarCharAggrFunctions.java I see the following (edited for the
sake of this email):

setup() {
>    ...
>    value = new ObjectHolder();
>    value.obj = new DrillByteArray()
> }
> add() {
>    ...
>    // accesses value.obj.getLength()
> }
> reset() {
>    ...
>    value = new ObjectHolder()
>    // we don't set value.obj
> }


The code expects setup() to be called whenever we call reset() otherwise we
hit a NullPointerException when we call add()

Is this the expected behavior ? or should reset() make sure value.obj is
set properly ??

Thanks

-- 

Abdelhakim Deneche

Software Engineer

  <http://www.mapr.com/>


Now Available - Free Hadoop On-Demand Training
<http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available>

Re: Question about DrillAggFunc

Posted by Abdel Hakim Deneche <ad...@maprtech.com>.
Thanks Jacques,

I will submit a patch.

On Fri, Feb 26, 2016 at 7:33 PM, Jacques Nadeau <ja...@dremio.com> wrote:

> I agree that reset() should set properly.
>
> --
> Jacques Nadeau
> CTO and Co-Founder, Dremio
>
> On Fri, Feb 26, 2016 at 9:51 AM, Abdel Hakim Deneche <
> adeneche@maprtech.com>
> wrote:
>
> > Looking at VarCharAggrFunctions.java I see the following (edited for the
> > sake of this email):
> >
> > setup() {
> > >    ...
> > >    value = new ObjectHolder();
> > >    value.obj = new DrillByteArray()
> > > }
> > > add() {
> > >    ...
> > >    // accesses value.obj.getLength()
> > > }
> > > reset() {
> > >    ...
> > >    value = new ObjectHolder()
> > >    // we don't set value.obj
> > > }
> >
> >
> > The code expects setup() to be called whenever we call reset() otherwise
> we
> > hit a NullPointerException when we call add()
> >
> > Is this the expected behavior ? or should reset() make sure value.obj is
> > set properly ??
> >
> > Thanks
> >
> > --
> >
> > Abdelhakim Deneche
> >
> > Software Engineer
> >
> >   <http://www.mapr.com/>
> >
> >
> > Now Available - Free Hadoop On-Demand Training
> > <
> >
> http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available
> > >
> >
>



-- 

Abdelhakim Deneche

Software Engineer

  <http://www.mapr.com/>


Now Available - Free Hadoop On-Demand Training
<http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available>

Re: Question about DrillAggFunc

Posted by Jacques Nadeau <ja...@dremio.com>.
I agree that reset() should set properly.

--
Jacques Nadeau
CTO and Co-Founder, Dremio

On Fri, Feb 26, 2016 at 9:51 AM, Abdel Hakim Deneche <ad...@maprtech.com>
wrote:

> Looking at VarCharAggrFunctions.java I see the following (edited for the
> sake of this email):
>
> setup() {
> >    ...
> >    value = new ObjectHolder();
> >    value.obj = new DrillByteArray()
> > }
> > add() {
> >    ...
> >    // accesses value.obj.getLength()
> > }
> > reset() {
> >    ...
> >    value = new ObjectHolder()
> >    // we don't set value.obj
> > }
>
>
> The code expects setup() to be called whenever we call reset() otherwise we
> hit a NullPointerException when we call add()
>
> Is this the expected behavior ? or should reset() make sure value.obj is
> set properly ??
>
> Thanks
>
> --
>
> Abdelhakim Deneche
>
> Software Engineer
>
>   <http://www.mapr.com/>
>
>
> Now Available - Free Hadoop On-Demand Training
> <
> http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available
> >
>