Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit501e8c6

Browse files
committed
Bugfix. Initialization of kNN data structure was omitted in one newly
added case.
1 parent351e135 commit501e8c6

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

‎storage.c

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,6 +1465,7 @@ aqo_data_store(uint64 fs, int fss, AqoDataArgs *data, List *reloids)
14651465
}
14661466
}
14671467
aqo_state->data_changed= true;
1468+
Assert(entry->rows>0);
14681469
end:
14691470
result=aqo_state->data_changed;
14701471
LWLockRelease(&aqo_state->data_lock);
@@ -1505,22 +1506,27 @@ build_knn_matrix(OkNNrdata *data, const OkNNrdata *temp_data, double *features)
15051506
if (features!=NULL)
15061507
{
15071508
intold_rows=data->rows;
1508-
intk=old_rows;
1509+
intk=(old_rows<0) ?0 :old_rows;
15091510

15101511
if (data->cols>0)
15111512
{
15121513
inti;
15131514

1514-
for (i=0;i<data->rows;i++)
1515+
Assert(data->cols==temp_data->cols);
1516+
1517+
for (i=0;i<temp_data->rows;i++)
15151518
{
1516-
if (k<aqo_K&& !neirest_neighbor(data->matrix,old_rows,data->matrix[i],data->cols))
1519+
if (k<aqo_K&& !neirest_neighbor(data->matrix,old_rows,
1520+
temp_data->matrix[i],
1521+
data->cols))
15171522
{
15181523
memcpy(data->matrix[k],temp_data->matrix[i],data->cols*sizeof(double));
15191524
data->rfactors[k]=temp_data->rfactors[i];
15201525
data->targets[k]=temp_data->targets[i];
15211526
k++;
15221527
}
15231528
}
1529+
data->rows=k;
15241530
}
15251531
}
15261532
else
@@ -1605,11 +1611,13 @@ _fill_knn_data(const DataEntry *entry, List **reloids)
16051611
}
16061612

16071613
/*
1608-
* Return on feature subspace, unique defined by its class (fs) and hash value
1609-
* (fss).
1610-
* If reloids is NULL, skip loading of this list.
1614+
* By given feature space and subspace, build kNN data structure.
1615+
*
16111616
* If wideSearch is true - make seqscan on the hash table to see for relevant
16121617
* data across neighbours.
1618+
* If reloids is NULL - don't fill this list.
1619+
*
1620+
* Return false if the operation was unsuccessful.
16131621
*/
16141622
bool
16151623
load_aqo_data(uint64fs,intfss,OkNNrdata*data,List**reloids,
@@ -1634,7 +1642,7 @@ load_aqo_data(uint64 fs, int fss, OkNNrdata *data, List **reloids,
16341642
gotoend;
16351643

16361644
/* One entry with all correctly filled fields is found */
1637-
Assert(entry);
1645+
Assert(entry&&entry->rows>0);
16381646
Assert(DsaPointerIsValid(entry->data_dp));
16391647

16401648
if (entry->cols!=data->cols)
@@ -1643,12 +1651,14 @@ load_aqo_data(uint64 fs, int fss, OkNNrdata *data, List **reloids,
16431651
elog(LOG,"[AQO] Does a collision happened? Check it if possible "
16441652
"(fs: "UINT64_FORMAT", fss: %d).",
16451653
fs,fss);
1646-
found= false;
1654+
found= false;/* Sign of unsuccessful operation */
16471655
gotoend;
16481656
}
16491657

16501658
temp_data=_fill_knn_data(entry,reloids);
1659+
Assert(temp_data->rows>0);
16511660
build_knn_matrix(data,temp_data,features);
1661+
Assert(data->rows>0);
16521662
}
16531663
else
16541664
/* Iterate across all elements of the table. XXX: Maybe slow. */
@@ -1662,6 +1672,8 @@ load_aqo_data(uint64 fs, int fss, OkNNrdata *data, List **reloids,
16621672
{
16631673
List*tmp_oids=NIL;
16641674

1675+
Assert(entry->rows>0);
1676+
16651677
if (entry->key.fss!=fss||entry->cols!=data->cols)
16661678
continue;
16671679

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp