diff --git a/src/ivfbuild.c b/src/ivfbuild.c index 85a247f..cb5a78c 100644 --- a/src/ivfbuild.c +++ b/src/ivfbuild.c @@ -254,7 +254,7 @@ InsertTuples(Relation index, IvfflatBuildState * buildstate, ForkNumber forkNum) IndexTuple itup = NULL; /* silence compiler warning */ int64 inserted = 0; - TupleTableSlot *slot = MakeSingleTupleTableSlot(buildstate->tupdesc, &TTSOpsMinimalTuple); + TupleTableSlot *slot = MakeSingleTupleTableSlot(buildstate->sortdesc, &TTSOpsMinimalTuple); TupleDesc tupdesc = RelationGetDescr(index); pgstat_progress_update_param(PROGRESS_CREATEIDX_SUBPHASE, PROGRESS_IVFFLAT_PHASE_LOAD); @@ -356,12 +356,12 @@ InitBuildState(IvfflatBuildState * buildstate, Relation heap, Relation index, In errmsg("dimensions must be greater than one for this opclass"))); /* Create tuple description for sorting */ - buildstate->tupdesc = CreateTemplateTupleDesc(3); - TupleDescInitEntry(buildstate->tupdesc, (AttrNumber) 1, "list", INT4OID, -1, 0); - TupleDescInitEntry(buildstate->tupdesc, (AttrNumber) 2, "tid", TIDOID, -1, 0); - TupleDescInitEntry(buildstate->tupdesc, (AttrNumber) 3, "vector", RelationGetDescr(index)->attrs[0].atttypid, -1, 0); + buildstate->sortdesc = CreateTemplateTupleDesc(3); + TupleDescInitEntry(buildstate->sortdesc, (AttrNumber) 1, "list", INT4OID, -1, 0); + TupleDescInitEntry(buildstate->sortdesc, (AttrNumber) 2, "tid", TIDOID, -1, 0); + TupleDescInitEntry(buildstate->sortdesc, (AttrNumber) 3, "vector", RelationGetDescr(index)->attrs[0].atttypid, -1, 0); - buildstate->slot = MakeSingleTupleTableSlot(buildstate->tupdesc, &TTSOpsVirtual); + buildstate->slot = MakeSingleTupleTableSlot(buildstate->sortdesc, &TTSOpsVirtual); buildstate->centers = VectorArrayInit(buildstate->lists, buildstate->dimensions, buildstate->typeInfo->itemSize(buildstate->dimensions)); buildstate->listInfo = palloc(sizeof(ListInfo) * buildstate->lists); @@ -633,7 +633,7 @@ IvfflatParallelScanAndSort(IvfflatSpool * ivfspool, IvfflatShared * ivfshared, S InitBuildState(&buildstate, ivfspool->heap, ivfspool->index, indexInfo); memcpy(buildstate.centers->items, ivfcenters, buildstate.centers->itemsize * buildstate.centers->maxlen); buildstate.centers->length = buildstate.centers->maxlen; - ivfspool->sortstate = InitBuildSortState(buildstate.tupdesc, sortmem, coordinate); + ivfspool->sortstate = InitBuildSortState(buildstate.sortdesc, sortmem, coordinate); buildstate.sortstate = ivfspool->sortstate; scan = table_beginscan_parallel(ivfspool->heap, ParallelTableScanFromIvfflatShared(ivfshared)); @@ -950,7 +950,7 @@ AssignTuples(IvfflatBuildState * buildstate) } /* Begin serial/leader tuplesort */ - buildstate->sortstate = InitBuildSortState(buildstate->tupdesc, maintenance_work_mem, coordinate); + buildstate->sortstate = InitBuildSortState(buildstate->sortdesc, maintenance_work_mem, coordinate); /* Add tuples to sort */ if (buildstate->heap != NULL) diff --git a/src/ivfflat.h b/src/ivfflat.h index 8518317..73cf565 100644 --- a/src/ivfflat.h +++ b/src/ivfflat.h @@ -198,7 +198,7 @@ typedef struct IvfflatBuildState /* Sorting */ Tuplesortstate *sortstate; - TupleDesc tupdesc; + TupleDesc sortdesc; TupleTableSlot *slot; /* Memory */