Re: Add missing operator <->(box, point)

2019-07-08 Thread Alexander Korotkov
On Mon, Jul 8, 2019 at 11:39 PM Nikita Glukhov wrote: > On 08.07.2019 18:22, Alexander Korotkov wrote: > For me it doesn't look worth having two distinct functions > gist_box_distance_helper() and gist_bbox_distance(). What about > having just one and leave responsibility for recheck flag to the

Re: Add missing operator <->(box, point)

2019-07-08 Thread Nikita Glukhov
Attached 3rd version of the patches. On 02.07.2019 21:55, Alexander Korotkov wrote: On Tue, Jul 2, 2019 at 9:19 PM Nikita Glukhov wrote: We could use commuted "const <-> var" operators for kNN searches, but the current implementation requires the existence of "var <-> const" operators, and or

Re: Add missing operator <->(box, point)

2019-07-08 Thread Alexander Korotkov
On Mon, Mar 11, 2019 at 2:49 AM Nikita Glukhov wrote: > 2. Add <-> to GiST box_ops. >Extracted gist_box_distance_helper() common for gist_box_distance() and >gist_bbox_distance(). For me it doesn't look worth having two distinct functions gist_box_distance_helper() and gist_bbox_distance(

Re: Add missing operator <->(box, point)

2019-07-02 Thread Tom Lane
Alexander Korotkov writes: > On Tue, Jul 2, 2019 at 9:19 PM Nikita Glukhov wrote: >> We could use commuted "const <-> var" operators for kNN searches, but the >> current implementation requires the existence of "var <-> const" operators, >> and >> order-by-op clauses are rebuilt using them (see

Re: Add missing operator <->(box, point)

2019-07-02 Thread Alexander Korotkov
On Tue, Jul 2, 2019 at 9:19 PM Nikita Glukhov wrote: > We could use commuted "const <-> var" operators for kNN searches, but the > current implementation requires the existence of "var <-> const" operators, > and > order-by-op clauses are rebuilt using them (see match_clause_to_ordering_op() > at

Re: Add missing operator <->(box, point)

2019-07-02 Thread Nikita Glukhov
Attached 2nd version of the patches. On 20.04.2019 16:41, Fabien COELHO wrote: About the test, I'd suggest to name the result columns, eg "pt to box dist" and "box to pt dist", otherwise why all is repeated is unclear. Fixed. On 02.07.2019 7:01, Tom Lane wrote: [ warning, drive-by comment

Re: Add missing operator <->(box, point)

2019-07-01 Thread Tom Lane
[ warning, drive-by comment ahead ] Fabien COELHO writes: > I notice that other distance tests do not test for commutativity. Are they > also not implemented, or just not tested? If not implemented, I'd suggest > to add them in the same batch. Yeah ... just looking at operators named <->, I se

Re: Add missing operator <->(box, point)

2019-04-20 Thread Fabien COELHO
Hello Nikita, Attached patches add missing distance operator <->(box, point). Indeed. We already have reverse operator <->(point, box), but it can't be used for kNN search in GiST and SP-GiST. GiST and SP-GiST now support kNN searches over more complex polygons and circles, but do not su