mirror of
https://github.com/postgres/postgres.git
synced 2025-07-03 20:02:46 +03:00
Fix handling of NULL distances in KNN-GiST
In order to implement NULL LAST semantic GiST previously assumed distance to the NULL value to be Inf. However, our distance functions can return Inf and NaN for non-null values. In such cases, NULL LAST semantic appears to be broken. This commit fixes that by introducing separate array of null flags for distances. Backpatch to all supported versions. Discussion: https://postgr.es/m/CAPpHfdsNvNdA0DBS%2BwMpFrgwT6C3-q50sFVGLSiuWnV3FqOJuQ%40mail.gmail.com Author: Alexander Korotkov Backpatch-through: 9.4
This commit is contained in:
@ -929,6 +929,7 @@ spggettuple(IndexScanDesc scan, ScanDirection dir)
|
||||
if (so->numberOfOrderBys > 0)
|
||||
index_store_float8_orderby_distances(scan, so->orderByTypes,
|
||||
so->distances[so->iPtr],
|
||||
NULL,
|
||||
so->recheckDistances[so->iPtr]);
|
||||
so->iPtr++;
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user