mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-12 07:36:55 +08:00
Simplify lists for IvfflatScanOpaque [skip ci]
This commit is contained in:
@@ -278,7 +278,7 @@ typedef struct IvfflatScanOpaqueData
|
|||||||
pairingheap *listQueue;
|
pairingheap *listQueue;
|
||||||
BlockNumber *listPages;
|
BlockNumber *listPages;
|
||||||
int listIndex;
|
int listIndex;
|
||||||
IvfflatScanList lists[FLEXIBLE_ARRAY_MEMBER]; /* must come last */
|
IvfflatScanList *lists;
|
||||||
} IvfflatScanOpaqueData;
|
} IvfflatScanOpaqueData;
|
||||||
|
|
||||||
typedef IvfflatScanOpaqueData * IvfflatScanOpaque;
|
typedef IvfflatScanOpaqueData * IvfflatScanOpaque;
|
||||||
|
|||||||
@@ -280,7 +280,7 @@ ivfflatbeginscan(Relation index, int nkeys, int norderbys)
|
|||||||
if (maxProbes > lists)
|
if (maxProbes > lists)
|
||||||
maxProbes = lists;
|
maxProbes = lists;
|
||||||
|
|
||||||
so = (IvfflatScanOpaque) palloc(offsetof(IvfflatScanOpaqueData, lists) + maxProbes * sizeof(IvfflatScanList));
|
so = (IvfflatScanOpaque) palloc(sizeof(IvfflatScanOpaqueData));
|
||||||
so->typeInfo = IvfflatGetTypeInfo(index);
|
so->typeInfo = IvfflatGetTypeInfo(index);
|
||||||
so->first = true;
|
so->first = true;
|
||||||
so->probes = probes;
|
so->probes = probes;
|
||||||
@@ -314,6 +314,7 @@ ivfflatbeginscan(Relation index, int nkeys, int norderbys)
|
|||||||
so->listQueue = pairingheap_allocate(CompareLists, scan);
|
so->listQueue = pairingheap_allocate(CompareLists, scan);
|
||||||
so->listPages = palloc(maxProbes * sizeof(BlockNumber));
|
so->listPages = palloc(maxProbes * sizeof(BlockNumber));
|
||||||
so->listIndex = 0;
|
so->listIndex = 0;
|
||||||
|
so->lists = palloc(maxProbes * sizeof(IvfflatScanList));
|
||||||
|
|
||||||
scan->opaque = so;
|
scan->opaque = so;
|
||||||
|
|
||||||
@@ -409,6 +410,7 @@ ivfflatendscan(IndexScanDesc scan)
|
|||||||
tuplesort_end(so->sortstate);
|
tuplesort_end(so->sortstate);
|
||||||
FreeAccessStrategy(so->bas);
|
FreeAccessStrategy(so->bas);
|
||||||
FreeTupleDesc(so->tupdesc);
|
FreeTupleDesc(so->tupdesc);
|
||||||
|
pfree(so->lists);
|
||||||
|
|
||||||
/* TODO Free vslot and mslot without freeing TupleDesc */
|
/* TODO Free vslot and mslot without freeing TupleDesc */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user