Re: Bug in GiST paring heap comparator

2019-09-24 Thread Alexander Korotkov
On Wed, Sep 25, 2019 at 1:22 AM Nikita Glukhov wrote: > Attached another one-line patch that fixes incorrect number of distances used > in pairingheap_SpGistSearchItem_cmp(): > > -for (i = 0; i < so->numberOfOrderBys; i++) > +for (i = 0; i < so->numberOfNonNullOrderBys; i++) > > > This cha

Re: Bug in GiST paring heap comparator

2019-09-24 Thread Nikita Glukhov
On 20.09.2019 0:15, Nikita Glukhov wrote: On 19.09.2019 22:14, Alexander Korotkov wrote: Pushed. Attached patch fixes premature xs_orderbynulls[] assignment.  The old value of NULL flag, not the new, should be checked before pfree()ing the old value. Attached another one-line patch that fixes

Re: Bug in GiST paring heap comparator

2019-09-19 Thread Nikita Glukhov
On 19.09.2019 22:14, Alexander Korotkov wrote: Pushed. Attached patch fixes premature xs_orderbynulls[] assignment.  The old value of NULL flag, not the new, should be checked before pfree()ing the old value. -- Nikita Glukhov Postgres Professional: http://www.postgrespro.com The Russian Post

Re: Bug in GiST paring heap comparator

2019-09-19 Thread Alexander Korotkov
On Mon, Sep 16, 2019 at 10:30 PM Alexander Korotkov < a.korot...@postgrespro.ru> wrote: > On Mon, Sep 16, 2019 at 3:47 PM Nikita Glukhov > wrote: > > On 13.09.2019 20:17, Alexander Korotkov wrote: > > > > On Fri, Sep 13, 2019 at 5:23 PM Nikita Glukhov > wrote: > > > > I have moved handling of NU

Re: Bug in GiST paring heap comparator

2019-09-16 Thread Alexander Korotkov
On Mon, Sep 16, 2019 at 3:47 PM Nikita Glukhov wrote: > On 13.09.2019 20:17, Alexander Korotkov wrote: > > On Fri, Sep 13, 2019 at 5:23 PM Nikita Glukhov > wrote: > > I have moved handling of NULL ordering keys from opclasses to the common > SP-GiST code, but really I don't like how it is implem

Re: Bug in GiST paring heap comparator

2019-09-16 Thread Nikita Glukhov
On 13.09.2019 20:17, Alexander Korotkov wrote: On Fri, Sep 13, 2019 at 5:23 PM Nikita Glukhov wrote: I have moved handling of NULL ordering keys from opclasses to the common SP-GiST code, but really I don't like how it is implemented now. Maybe it's worth to move handling of NULL order-by keys

Re: Bug in GiST paring heap comparator

2019-09-13 Thread Alexander Korotkov
On Fri, Sep 13, 2019 at 5:23 PM Nikita Glukhov wrote: > I have moved handling of NULL ordering keys from opclasses to the common > SP-GiST code, but really I don't like how it is implemented now. Maybe it's > worth to move handling of NULL order-by keys to the even more higher > level so, > that A

Re: Bug in GiST paring heap comparator

2019-09-13 Thread Nikita Glukhov
On 12.09.2019 16:45, Alexander Korotkov wrote: On Wed, Sep 11, 2019 at 3:34 AM Nikita Glukhov wrote: On 09.09.2019 22:47, Alexander Korotkov wrote: On Mon, Sep 9, 2019 at 8:32 PM Nikita Glukhov wrote: On 08.09.2019 22:32, Alexander Korotkov wrote: On Fri, Sep 6, 2019 at 5:44 PM Alexander K

Re: Bug in GiST paring heap comparator

2019-09-12 Thread Alexander Korotkov
On Wed, Sep 11, 2019 at 3:34 AM Nikita Glukhov wrote: > On 09.09.2019 22:47, Alexander Korotkov wrote: > > On Mon, Sep 9, 2019 at 8:32 PM Nikita Glukhov wrote: > > On 08.09.2019 22:32, Alexander Korotkov wrote: > > On Fri, Sep 6, 2019 at 5:44 PM Alexander Korotkov > wrote: > > I'm going to push

Re: Bug in GiST paring heap comparator

2019-09-10 Thread Nikita Glukhov
On 09.09.2019 22:47, Alexander Korotkov wrote: On Mon, Sep 9, 2019 at 8:32 PM Nikita Glukhov wrote: On 08.09.2019 22:32, Alexander Korotkov wrote: On Fri, Sep 6, 2019 at 5:44 PM Alexander Korotkov wrote: I'm going to push both if no objections. So, pushed! Two years ago there was a simil

Re: Bug in GiST paring heap comparator

2019-09-09 Thread Alexander Korotkov
On Mon, Sep 9, 2019 at 8:32 PM Nikita Glukhov wrote: > On 08.09.2019 22:32, Alexander Korotkov wrote: > > > On Fri, Sep 6, 2019 at 5:44 PM Alexander Korotkov > > wrote: > >> I'm going to push both if no objections. > > So, pushed! > > Two years ago there was a similar patch for this issue: > http

Re: Bug in GiST paring heap comparator

2019-09-09 Thread Nikita Glukhov
On 08.09.2019 22:32, Alexander Korotkov wrote: On Fri, Sep 6, 2019 at 5:44 PM Alexander Korotkov wrote: I'm going to push both if no objections. So, pushed! Two years ago there was a similar patch for this issue: https://www.postgresql.org/message-id/1499c9d0-075a-3014-d2aa-ba59121b3728%40p

Re: Bug in GiST paring heap comparator

2019-09-08 Thread Alexander Korotkov
On Fri, Sep 6, 2019 at 5:44 PM Alexander Korotkov wrote: > I'm going to push both if no objections. So, pushed! -- Alexander Korotkov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company

Re: Bug in GiST paring heap comparator

2019-09-06 Thread Alexander Korotkov
On Mon, Sep 2, 2019 at 9:28 AM Heikki Linnakangas wrote: > On 02/09/2019 07:54, Alexander Korotkov wrote: > > NULL and '(NaN,NaN)' are swapped. It happens so, because we assume > > distance to NULL to be Inf, while float8_cmp_internal() assumes NaN to > > be greater than NULL. If even we would a

Re: Bug in GiST paring heap comparator

2019-09-02 Thread Heikki Linnakangas
On 02/09/2019 07:54, Alexander Korotkov wrote: Andrey Borodin noticed me that results of some KNN-GIST tests are obviously wrong and don't match results of sort node. SELECT * FROM point_tbl ORDER BY f1 <-> '0,1'; f1 --- (10,10) (NaN,NaN) (0,0) (1e-300,-1e-300)

Re: Bug in GiST paring heap comparator

2019-09-01 Thread Andrey Borodin
> 2 сент. 2019 г., в 9:54, Alexander Korotkov > написал(а): > > It appears to be related to implementation of comparison function in > pairing heap used as priority queue for KNN. It used plain float > comparison, which doesn't handle Inf and Nan values well. Attached > patch replaced it wi

Bug in GiST paring heap comparator

2019-09-01 Thread Alexander Korotkov
Hi! Andrey Borodin noticed me that results of some KNN-GIST tests are obviously wrong and don't match results of sort node. SELECT * FROM point_tbl ORDER BY f1 <-> '0,1'; f1 --- (10,10) (NaN,NaN) (0,0) (1e-300,-1e-300) (-3,4) (-10,0) (-5,-12) (5.1,34.5) (1e+300,I