Changeset: 03849f068626 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=03849f068626
Modified Files:
        monetdb5/modules/kernel/arrays.c
Branch: arrays
Log Message:

make sure to keep already existing values in non-dimensional columns when 
projecting them and adding the missing values


diffs (47 lines):

diff --git a/monetdb5/modules/kernel/arrays.c b/monetdb5/modules/kernel/arrays.c
--- a/monetdb5/modules/kernel/arrays.c
+++ b/monetdb5/modules/kernel/arrays.c
@@ -197,7 +197,7 @@ str ALGnonDimensionLeftfetchjoin1(bat* r
 str ALGnonDimensionLeftfetchjoin2(bat* result, const bat *tids, const bat 
*vals, const ptr *dims) {
        BAT *materialisedBAT = NULL;
        BAT *nonDimensionalBAT = NULL;
-       BUN neededCellsNum;
+       BUN totalCellsNum, neededCellsNum;
 
        gdk_array *array = (gdk_array*)*dims;
 
@@ -206,19 +206,26 @@ str ALGnonDimensionLeftfetchjoin2(bat* r
     }
        (void)*tids; //ignore the tids
 
-       neededCellsNum = arrayCellsNum(array) - BATcount(nonDimensionalBAT);
+       totalCellsNum = arrayCellsNum(array);
+       neededCellsNum = totalCellsNum - BATcount(nonDimensionalBAT);
        
        /*TODO: fix this so that I can have the real default value of the 
column */
        materialisedBAT = 
materialise_nonDimensional_column(ATOMtype(BATttype(nonDimensionalBAT)), 
neededCellsNum, NULL);
-
-       BBPunfix(nonDimensionalBAT->batCacheid);
-
-       if(materialisedBAT) {
-        BBPkeepref(*result = materialisedBAT->batCacheid);
-        return MAL_SUCCEED;
+       if(!materialisedBAT) {
+               BBPunfix(nonDimensionalBAT->batCacheid);
+               throw(MAL, "algebra.leftfetchjoin", "Problem materialising 
non-dimensional column");
        }
 
-       throw(MAL, "algebra.leftfetchjoin", "Problem materialising 
non-dimensional column");
+
+       /*append the missing values to the BAT */
+       BATappend(nonDimensionalBAT, materialisedBAT, TRUE);
+       BATsetcount(nonDimensionalBAT, totalCellsNum);
+       
+       BBPunfix(materialisedBAT->batCacheid);
+       BBPkeepref(*result = nonDimensionalBAT->batCacheid);
+        
+       return MAL_SUCCEED;
+
 }
 
 static str emptyCandidateResults(ptr *candsRes_dims, bat* candsRes_bid) {
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to