mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-01 10:11:20 +08:00
Handle nulls
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "storage/bufmgr.h"
|
||||
#include "storage/lmgr.h"
|
||||
#include "utils/memutils.h"
|
||||
#include "utils/varbit.h"
|
||||
|
||||
/*
|
||||
* Algorithm 5 from paper
|
||||
@@ -73,7 +74,22 @@ GetScanValue(IndexScanDesc scan)
|
||||
Datum value;
|
||||
|
||||
if (scan->orderByData->sk_flags & SK_ISNULL)
|
||||
value = PointerGetDatum(InitVector(GetDimensions(scan->indexRelation)));
|
||||
{
|
||||
Oid typid = TupleDescAttr(scan->indexRelation->rd_att, 0)->atttypid;
|
||||
int dimensions = GetDimensions(scan->indexRelation);
|
||||
|
||||
if (typid == BITOID || typid == VARBITOID)
|
||||
{
|
||||
int len = VARBITTOTALLEN(dimensions);
|
||||
VarBit *v = (VarBit *) palloc0(len);
|
||||
|
||||
SET_VARSIZE(v, len);
|
||||
VARBITLEN(v) = dimensions;
|
||||
value = PointerGetDatum(v);
|
||||
}
|
||||
else
|
||||
value = PointerGetDatum(InitVector(dimensions));
|
||||
}
|
||||
else
|
||||
{
|
||||
value = scan->orderByData->sk_argument;
|
||||
|
||||
Reference in New Issue
Block a user