Re: [HACKERS] PATCH: multivariate histograms and MCV lists

From: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
To: david(dot)rowley(at)2ndquadrant(dot)com
Cc: tomas(dot)vondra(at)2ndquadrant(dot)com, dean(dot)a(dot)rasheed(at)gmail(dot)com, alvherre(at)2ndquadrant(dot)com, michael(at)paquier(dot)xyz, andres(at)anarazel(dot)de, thomas(dot)munro(at)enterprisedb(dot)com, bruce(at)momjian(dot)us, hornschnorter(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] PATCH: multivariate histograms and MCV lists
Date: 2019-03-14 11:56:23
Message-ID: 20190314.205623.235434357.horiguchi.kyotaro@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At Wed, 13 Mar 2019 19:37:45 +1300, David Rowley <david(dot)rowley(at)2ndquadrant(dot)com> wrote in <CAKJS1f_6qDQj9m2H0jF4bRkZVLpfc7O9E+MxdXrq0wgv0z1NrQ(at)mail(dot)gmail(dot)com>
> On Wed, 13 Mar 2019 at 17:20, Kyotaro HORIGUCHI
> <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp> wrote:
> > bms_member_index seems working differently than maybe expected.
> >
> > bms_member_index((2, 4), 0) => 0, (I think) should be -1
> > bms_member_index((2, 4), 1) => 0, should be -1
> > bms_member_index((2, 4), 2) => 0, should be 0
> > bms_member_index((2, 4), 3) => 1, should be -1
> > bms_member_index((2, 4), 4) => 1, should be 1
> > bms_member_index((2, 4), 5) => 2, should be -1
> > bms_member_index((2, 4), 6) => 2, should be -1
> > ...
> > bms_member_index((2, 4), 63) => 2, should be -1
> > bms_member_index((2, 4), 64) => -1, correct
> >
> > It works correctly only when x is a member - the way the function
> > is maybe actually used in this patch -, or needs to change the
> > specifiction (or the comment) of the function.
>
> Looks like:
>
> + if (wordnum >= a->nwords)
> + return -1;
>
> should be:
>
> + if (wordnum >= a->nwords ||
> + (a->word[wordnum] & ((bitmapword) 1 << bitnum)) == 0)
> + return -1;

Yeah, seems right.

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2019-03-14 12:25:53 Re: [Proposal] Table-level Transparent Data Encryption (TDE) and Key Management Service (KMS)
Previous Message Kyotaro HORIGUCHI 2019-03-14 11:50:16 Re: [HACKERS] PATCH: multivariate histograms and MCV lists