2727#include "learn_cache.h"
2828
2929
30+ #define AQO_DATA_COLUMNS (7)
3031HTAB * deactivated_queries = NULL ;
3132
3233static ArrayType * form_matrix (double * * matrix , int nrows , int ncols );
@@ -402,8 +403,8 @@ load_fss(uint64 fs, int fss, OkNNrdata *data, List **relids)
402403 bool find_ok = false;
403404 IndexScanDesc scan ;
404405 ScanKeyData key [2 ];
405- Datum values [6 ];
406- bool isnull [6 ];
406+ Datum values [AQO_DATA_COLUMNS ];
407+ bool isnull [AQO_DATA_COLUMNS ];
407408 bool success = true;
408409
409410 if (!open_aqo_relation ("public" , "aqo_data" ,
@@ -434,6 +435,7 @@ load_fss(uint64 fs, int fss, OkNNrdata *data, List **relids)
434435 deform_matrix (values [3 ], data -> matrix );
435436
436437 deform_vector (values [4 ], data -> targets , & (data -> rows ));
438+ deform_vector (values [6 ], data -> rfactors , & (data -> rows ));
437439
438440 if (relids != NULL )
439441 * relids = deform_oids_vector (values [5 ]);
@@ -487,9 +489,9 @@ update_fss(uint64 fhash, int fsshash, OkNNrdata *data, List *relids)
487489 TupleDesc tupDesc ;
488490 HeapTuple tuple ,
489491 nw_tuple ;
490- Datum values [6 ];
491- bool isnull [6 ] = { false, false, false, false, false, false } ;
492- bool replace [6 ] = { false, false, false, true, true, false };
492+ Datum values [AQO_DATA_COLUMNS ];
493+ bool isnull [AQO_DATA_COLUMNS ] ;
494+ bool replace [AQO_DATA_COLUMNS ] = { false, false, false, true, true, false, true };
493495 bool shouldFree ;
494496 bool find_ok = false;
495497 bool update_indexes ;
@@ -506,6 +508,7 @@ update_fss(uint64 fhash, int fsshash, OkNNrdata *data, List *relids)
506508 RowExclusiveLock , & hrel , & irel ))
507509 return false;
508510
511+ memset (isnull , 0 , sizeof (bool ) * AQO_DATA_COLUMNS );
509512 tupDesc = RelationGetDescr (hrel );
510513 InitDirtySnapshot (snap );
511514 scan = index_beginscan (hrel , irel , & snap , 2 , 0 );
@@ -535,6 +538,7 @@ update_fss(uint64 fhash, int fsshash, OkNNrdata *data, List *relids)
535538 values [5 ] = PointerGetDatum (form_oids_vector (relids ));
536539 if ((void * ) values [5 ] == NULL )
537540 isnull [5 ] = true;
541+ values [6 ] = PointerGetDatum (form_vector (data -> rfactors , data -> rows ));
538542 tuple = heap_form_tuple (tupDesc , values , isnull );
539543
540544 /*
@@ -558,8 +562,8 @@ update_fss(uint64 fhash, int fsshash, OkNNrdata *data, List *relids)
558562 isnull [3 ] = true;
559563
560564 values [4 ] = PointerGetDatum (form_vector (data -> targets , data -> rows ));
561- nw_tuple = heap_modify_tuple ( tuple , tupDesc ,
562- values , isnull , replace );
565+ values [ 6 ] = PointerGetDatum ( form_vector ( data -> rfactors , data -> rows ));
566+ nw_tuple = heap_modify_tuple ( tuple , tupDesc , values , isnull , replace );
563567 if (my_simple_heap_update (hrel , & (nw_tuple -> t_self ), nw_tuple ,
564568 & update_indexes ))
565569 {
0 commit comments