Changeset: acf562afa12d for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=acf562afa12d
Modified Files:
        monetdb5/extras/bwd/cl_program_utilities.c
        monetdb5/extras/bwd/operations.c
Branch: bwd
Log Message:

* fixed correctness of the projective join (returned bat should be [void:value] 
if the input is [void:any],[any:value])


Unterschiede (95 Zeilen):

diff --git a/monetdb5/extras/bwd/cl_program_utilities.c 
b/monetdb5/extras/bwd/cl_program_utilities.c
--- a/monetdb5/extras/bwd/cl_program_utilities.c
+++ b/monetdb5/extras/bwd/cl_program_utilities.c
@@ -30,7 +30,6 @@ cl_program getProjectionLeftjoinProgram(
                        "__global const char* approximation\n"
                        ") {\n"
                        "  const int offset = 
inputTail->positions[get_global_id(0)]*%1$d;\n"
-                       "  printf(\"projecting value %%d, position: %%d\\n\", 
get_global_id(0), inputTail->positions[get_global_id(0)]);"
                        "  for(int i = 0; i < %1$d; i++){\n"
                                "    
outputTail->values[get_global_id(0)*%1$d+i] = approximation[offset + i];\n"
                                "}"
diff --git a/monetdb5/extras/bwd/operations.c b/monetdb5/extras/bwd/operations.c
--- a/monetdb5/extras/bwd/operations.c
+++ b/monetdb5/extras/bwd/operations.c
@@ -19,7 +19,7 @@ static const int activateWorkInProgress 
 
 #pragma mark Actual MAL Operations Implementation
 
-
+static const char* typeNames[] = {[TYPE_int] = "int", [TYPE_void] = "void", 
[TYPE_oid] = "oid"};
 
 typedef struct {
        int count;
@@ -58,7 +58,7 @@ str BWDLeftJoinApproximate(bat * res, ba
        ALGODEBUG printf("#BWDfetchjoin: approximating;\n");
        BAT* right = BATdescriptor(*r);
        if(!batTailIsDecomposed(right)){
-               printf("bwd.%s : bat is not decomposed: %d, no approximation 
can be provided", __func__, *r);
+               printf("bwd.%s : bat is not decomposed: %d, no approximation 
can be provided\n", __func__, *r);
                BBPreleaseref(right->batCacheid);
                return MAL_SUCCEED;
        }
@@ -150,7 +150,7 @@ str BWDLeftJoinApproximate(bat * res, ba
        return MAL_SUCCEED;
 };
 
-static inline int decompressIntValue(int i, int approximationbits, clTail* 
compressedTail, char* residuals, int residualI){
+static inline int decompressIntValue(int i, int approximationbits, clTail* 
compressedTail, const unsigned char* residuals, int residualI){
        /* const int index = compressedHead->positions[i];                      
                 */
        const int residualBits = 32-approximationbits;
        const unsigned int residualMask = (1 << residualBits)-1;
@@ -165,21 +165,24 @@ static inline int decompressIntValue(int
 
 str BWDLeftJoinRefine(bat * res, bat * l, bat * r, bat * approx){
        if (!approx || !*approx) {
-               printf("bwd.%s : no approximation provided, falling back to 
normal leftjoin", __func__);
+               printf("bwd.%s : no approximation provided, falling back to 
normal leftjoin\n", __func__);
     return ALGleftjoin(res, l, r);
        }
        ALGODEBUG printf("#BWDfetchjoin: approximating;\n");
        BAT* left = BATdescriptor(*l);
        BAT* right = BATdescriptor(*r);
+       
 
+       BAT* refinement;
        BAT* approximation = BATdescriptor(*approx);
        const register size_t approximationBits = 
batTailApproximationBits(right);
-       BAT* refinement = BATnew(ATOMtype(left->htype), ATOMtype(right->ttype), 
left->batCount);
                /* BATnew(approximation->htype, approximation->ttype, 
approximation->batCount); */
-       BATsetcount(refinement, approximation->batCount);
        if(BAThvoid(left) && BATtvoid(left) && BAThvoid(right) && 
right->tseqbase != oid_nil){
                if(!batTailIsDecomposed(right))
                        throw (MAL, "bwd.BWDLeftJoinApproximate", "bat is not 
decomposed: %d", *r);
+               refinement = BATnew(ATOMtype(left->htype), 
ATOMtype(right->ttype), left->batCount);
+               printf ("%s returning bat of type [%s, %s]\n", __func__, 
typeNames[BAThtype(refinement)], typeNames[BATttype(refinement)]);
+               BATsetcount(refinement, approximation->batCount);
                const unsigned char* residuals = batTailResiduals(right);
                const register unsigned int residualBytes = 
(32-approximationBits)/8;
                int i;
@@ -192,8 +195,6 @@ str BWDLeftJoinRefine(bat * res, bat * l
                // we essentially perform a merge-join of the precise positions 
(left tail) and the approximate positions to get the approximate values of the 
super result set
                // this is okay because the approximate positions are a 
superset of the precise positions and the position lists have the same 
permutation
                // we reconstruct the precise values in the same loop
-               /* cl_mem leftColumn = batTailApproximation(left); */
-               /* if(!leftColumn) leftColumn = 
batHeadApproximation(BATmirror(left)); */
                size_t bufferSize;
                getPositionsColumn(batTailPositions(approximation), NULL, 
&bufferSize);
                clHead* supersetPositionsColumn = 
getPositionsColumn(batTailPositions(approximation), malloc(bufferSize), 
&bufferSize);
@@ -203,6 +204,8 @@ str BWDLeftJoinRefine(bat * res, bat * l
                clTail* supersetApproximateValuesColumn = 
getApproximateValuesColumn(batTailApproximation(approximation), 
malloc(bufferSize), &bufferSize);
 
 
+               refinement = BATnew(TYPE_void, ATOMtype(right->ttype), 
left->batCount);
+               printf ("%s returning bat of type [%s, %s]\n", __func__, 
typeNames[BAThtype(refinement)], typeNames[BATttype(refinement)]);
                int* refinementRegion = (int*) Tloc(refinement, 
BUNfirst(refinement));
 
                oid* positionRegion = (oid*) Tloc(left, BUNfirst(left));
@@ -217,6 +220,7 @@ str BWDLeftJoinRefine(bat * res, bat * l
                        /* while() */
                }
                BATsetcount(refinement, refinementCount);
+               BATseqbase(refinement, 0);
                
                
                free(supersetPositionsColumn);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to