Re: [PATCH] Improve geometric types

From: Emre Hasegeli <emre(at)hasegeli(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>, Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>, Aleksander Alekseev <a(dot)alekseev(at)postgrespro(dot)ru>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Improve geometric types
Date: 2017-11-05 14:54:19
Message-ID: CAE2gYzzngpYgrQbJ-2TjzZ+MZBa0D0Xzj8tjjJLv6C3CPARMGw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> I am not sure how useful NaNs are in geometric types context, but we
> allow them, so inconsistent hypot() would be a problem. I will change
> my patches to keep pg_hypot().

New versions of the patches are attached with 2 additional ones. The
new versions leave pg_hypot() in place. One of the new patches
improves the test coverage. The line coverage of geo_ops.c increases
from 55% to 81%. The other one fixes -0 values to 0 on float
operators. I am not sure about performance implication of this, so
kept it separate. It may be a better idea to check this only on the
platforms that has tendency to produce -0.

While working on the tests, I found some unreachable code and removed
it. I also found that lseg ## lseg operator returning wrong results.
It is defined as "closest point to first segment on the second
segment", but:

> # select '[(1,2),(3,4)]'::lseg ## '[(0,0),(6,6)]'::lseg;
> ?column?
> ----------
> (1,2)
> (1 row)

I appended the fix to the patches. This is also effecting lseg ## box operator.

I also changed recently band-aided point ## lseg operator to return
the point instead of NULL when it cannot find the correct result to
avoid the operators depending on this one to crash.

Attachment Content-Type Size
0001-geo-funcs-v05.patch application/octet-stream 80.5 KB
0002-float-header-v09.patch application/octet-stream 84.2 KB
0003-geo-float-v06.patch application/octet-stream 99.2 KB
0004-line-fixes-v05.patch application/octet-stream 11.1 KB
0005-float-zero-v01.patch application/octet-stream 2.0 KB
0006-geo-tests-v01.patch application/octet-stream 398.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Paul Ramsey 2017-11-05 15:23:51 Re: Parallel Plans and Cost of non-filter functions
Previous Message Robert Haas 2017-11-05 14:22:31 Re: [POC] Faster processing at Gather node