Changeset: 076fbd7c78a6 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=076fbd7c78a6
Modified Files:
monetdb5/extras/bwd/operations.c
monetdb5/extras/bwd/opt_bwd.mal
monetdb5/extras/bwd/pusher.c
Branch: bwd
Log Message:
* removed redundant projection(semijoin) when evaluating single-predicate
queries
Unterschiede (104 Zeilen):
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
@@ -472,7 +472,7 @@ static inline size_t clDeviceAddressByte
static inline void superverboseprintf(const char * format, ... ){};
-static inline str uselect(bat *res, bat *bid, ptr val, char *OP, ptr val2,
char *OP2, Client cntxt){
+static inline str uselect(bat *res, bat *bid, ptr val, char *OP, ptr val2,
char *OP2, int tailType, Client cntxt){
BAT* data = BATdescriptor(*bid);
BAT* result;
if(data == NULL)
@@ -480,7 +480,7 @@ static inline str uselect(bat *res, bat
assert(ATOMstorage(BATttype(data)) == TYPE_int); // type specific
if(!batTailIsDecomposed(data))
throw (MAL, "bwd problem", "while running %s, I noticed that
bat is not decomposed: %s", __func__, resolveBatToAttribute(data->batCacheid,
cntxt));
- result = BATnew(BAThtype(data), TYPE_void, data->batCount); //TODO: not
sure if we actually need to allocate space here (count could be 0)
+ result = BATnew(BAThtype(data), tailType, 0); //TODO: not sure if we
actually need to allocate space here (count could be 0)
{
const clTail dataHeader =
getTailHeader(batTailApproximation(data));
@@ -576,7 +576,7 @@ static inline str uselect(bat *res, bat
}
str BWDThetauselectApproximate(bat *res, bat *bid, ptr val, str *OP, Client
context) {
- return uselect(res, bid, val, *OP, 0, NULL, context);
+ return uselect(res, bid, val, *OP, 0, NULL, TYPE_void, context);
}
static inline unsigned int refinementLoop(str OP, str OP2, const int value1,
const int value2, const size_t candidateCount,
@@ -856,7 +856,14 @@ str BWDmirror(int *res, int *bid){
str BWDUselectInclusiveApproximate(int *result, int *bid, ptr low, ptr high,
bit *lin, bit *rin, Client context){
- return uselect(result, bid, low, *lin?">=":">", high, *rin?"<=":"<",
context);
+ return uselect(result, bid, low, *lin?">=":">", high, *rin?"<=":"<",
TYPE_void, context);
+}
+
+str BWDUselectInclusiveApproximateWithTail(int *result, int *bid, ptr low, ptr
high, bit *lin, bit *rin, Client context){
+ BAT* input = BATdescriptor(*bid);
+ const int tailType = BATttype(input);
+ BBPreleaseref(input->batCacheid);
+ return uselect(result, bid, low, *lin?">=":">", high, *rin?"<=":"<",
tailType, context);
}
str BWDUselectInclusiveRefine(int *result, int *bid, ptr low, ptr high, bit
*lin, bit *rin, int *approx, Client context){
diff --git a/monetdb5/extras/bwd/opt_bwd.mal b/monetdb5/extras/bwd/opt_bwd.mal
--- a/monetdb5/extras/bwd/opt_bwd.mal
+++ b/monetdb5/extras/bwd/opt_bwd.mal
@@ -37,6 +37,10 @@ command uselectapproximate(b:bat[:any_1,
li:bit, hi:bit) :bat[:any_1,:void]
address BWDUselectInclusiveApproximate;
+command uselectapproximate(b:bat[:any_1,:any_2], low:any_2, high:any_2,
+ li:bit, hi:bit) :bat[:any_1,:any_2]
+address BWDUselectInclusiveApproximateWithTail;
+
command uselectrefine(b:bat[:any_1,:any_2], low:any_2, high:any_2,
li:bit, hi:bit, approximation:bat[:any_1,:void] )
:bat[:any_1,:void]
address BWDUselectInclusiveRefine;
diff --git a/monetdb5/extras/bwd/pusher.c b/monetdb5/extras/bwd/pusher.c
--- a/monetdb5/extras/bwd/pusher.c
+++ b/monetdb5/extras/bwd/pusher.c
@@ -39,6 +39,7 @@ static inline int OPTBWDPusherImplementa
int filterPathTop = getDestVar(oldProgram[i]);
int selectionAttribute = 0;
int* variableProducers =
malloc(sizeof(InstrPtr)*malBlock->vsize);
+ int insertedFilters = 0;
{
int k = 0;
@@ -69,6 +70,7 @@ static inline int OPTBWDPusherImplementa
}
pushInstruction(malBlock, filter);
+ insertedFilters++;
filterPathTop = getDestVar(filter);
} else if(match_function(oldProgram[i], "bwd",
"semijoinapproximate")){
selectionAttribute = getArg(oldProgram[i], 1);
@@ -78,13 +80,17 @@ static inline int OPTBWDPusherImplementa
}
i = firstUselectStatement+1;
if(i < instructionCount){
- InstrPtr project = newInstruction(malBlock,
ASSIGNsymbol);
- rename_function(project, BWD, "semijoinapproximate",
&actions, client);
- project = pushReturn(malBlock, project,
newTmpVariable(malBlock, getArgType(malBlock,
oldProgram[firstUselectStatement], 1)));
- project = pushArgument(malBlock, project,
getArg(oldProgram[firstUselectStatement], 1));
- project = pushArgument(malBlock, project,
filterPathTop);
- pushInstruction(malBlock, project);
- filterPathTop = getDestVar(project);
+ if(insertedFilters > 0){
+ InstrPtr project = newInstruction(malBlock,
ASSIGNsymbol);
+ rename_function(project, BWD,
"semijoinapproximate", &actions, client);
+ project = pushReturn(malBlock, project,
newTmpVariable(malBlock, getArgType(malBlock,
oldProgram[firstUselectStatement], 1)));
+ project = pushArgument(malBlock, project,
getArg(oldProgram[firstUselectStatement], 1));
+ project = pushArgument(malBlock, project,
filterPathTop);
+ pushInstruction(malBlock, project);
+ filterPathTop = getDestVar(project);
+ } else {
+ setDestType(malBlock,
oldProgram[firstUselectStatement], getArgType(malBlock,
oldProgram[firstUselectStatement], 1));
+ }
}
mapping[getDestVar(oldProgram[firstUselectStatement])] =
filterPathTop;
}
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list