Changeset: 58db4fd98528 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=58db4fd98528
Modified Files:
monetdb5/extras/bwd/operations.c
monetdb5/extras/bwd/opt_bwd.mal
Branch: bwd
Log Message:
* hacked on the operators until q1 runs through, no results yet, though
Unterschiede (183 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
@@ -147,14 +147,16 @@ size_t calculatedBufferSize(size_t headC
return (((int)ceil(headCount*approximationBits/8.0))/8)*8+16;
}
-static char* NOT_IMPLEMENTED = "case not implemented";
-static char* NOT_DECOMPOSED = "input bat not decomposed";
+/* static char* NOT_IMPLEMENTED = "case not implemented"; */
+/* static char* NOT_DECOMPOSED = "input bat not decomposed"; */
+#define NOT_IMPLEMENTED GDKstrdup("case not implemented")
+#define NOT_DECOMPOSED GDKstrdup("input bat not decomposed")
str BWDLeftJoinApproximate(bat * res, bat * l, bat * r){
BAT *left = BATdescriptor(*l), *right = BATdescriptor(*r);
if(!batTailIsDecomposed(right)){
printf("bwd.%s : bat is not decomposed: %d, no approximation
can be provided\n", __func__, *r);
BBPreleaseref(right->batCacheid);
- return NOT_DECOMPOSED;
+ return MAL_SUCCEED;
}
if(BAThvoid(left) && BAThvoid(right) && right->tseqbase != oid_nil){
@@ -371,7 +373,7 @@ str BWDLeftJoinRefine(bat * res, bat * l
supersetApproximateValuesColumn =
getApproximateValuesColumn(batTailApproximation(approximation),
GDKmalloc(bufferSize), &bufferSize);
refinement = BATnew(TYPE_void, ATOMtype(right->ttype),
left->batCount);
- if(batTailResidualBits(right) == 0){
+ if(batTailResidualBits(approximation) == 0){
#define expansionLoop(type) {
\
unsigned int i;
\
type* refinementRegion = (type*)
Tloc(refinement, \
@@ -1095,6 +1097,27 @@ str BWDSemijoinRefine(int *res, int *lid
+str BWDConstantBatADDsignalApproximate(bat *ret, ValRecord *bid1, bat *bid2){
+ //TODO: implement me (easy)
+ return MAL_SUCCEED;
+}
+
+/* extern str CMDbatADDsignal(bat *ret, bat *bid1, bat *bid2); */
+
+str BWDConstantBatADDsignalRefine(bat *ret, ValRecord *bid1, bat *bid2, bat
*approx){
+ //TODO: implement me (easy)
+
+ BAT* b = BATdescriptor(*bid2);
+
+ BAT* bn = BATcalccstadd(bid1, b, TYPE_int, 0, 1);
+ BBPreleaseref(b->batCacheid);
+ BBPkeepref(*ret = bn->batCacheid);
+
+ return MAL_SUCCEED;
+
+ /* return CMDbatADDsignal(ret, bid1, bid2); */
+}
+
str BWDBatADDsignalApproximate(bat *ret, bat *bid1, bat *bid2){
//TODO: implement me (easy)
@@ -1123,6 +1146,25 @@ str BWDBatSUBsignalRefine(bat *ret, bat
}
+str BWDConstantBatSUBsignalApproximate(bat *ret, int *bid1, bat *bid2){
+ //TODO: implement me (easy)
+ return MAL_SUCCEED;
+}
+
+str
+CMDbatSUBcstenlarge(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
+str BWDConstantBatSUBsignalRefine(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr pci) /* (bat *ret, int *bid1, bat *bid2, bat *approx) */{
+ //TODO: implement me (easy)
+ return CMDbatSUBcstenlarge( cntxt, mb, stk, pci);
+ /* BAT* b = BATdescriptor(*bid2); */
+
+ /* BAT* bn = BATcalccstsub(NULL, b, TYPE_int, 0, 1); */
+ /* BBPreleaseref(b->batCacheid); */
+ /* BBPkeepref(*ret = bn->batCacheid); */
+
+ /* return MAL_SUCCEED; */
+}
+
str BWDBatMULsignalApproximate(bat *ret, bat *bid1, bat *bid2){
//TODO: implement me (easy)
@@ -1133,10 +1175,16 @@ extern str CMDbatMULsignal(bat *ret, bat
str BWDBatMULsignalRefine(bat *ret, bat *bid1, bat *bid2, bat *approx){
//TODO: implement me (easy)
- return CMDbatMULsignal(ret, bid1, bid2);
+ BAT *left = BATdescriptor(*bid2);
+ BAT* result = BATnew(TYPE_void, BATttype(left), 0);
+ BBPreleaseref(left->batCacheid);
+ BBPkeepref(*ret = result->batCacheid);
+ return MAL_SUCCEED;
+// CMDbatMULsignal(ret, bid1, bid2);
}
str BWDSelectNotNilApproximate(int *result, int *bid){
+ BBPincref(*result = *bid, 1);
//TODO: implement me (easy)
return MAL_SUCCEED;
}
@@ -1144,6 +1192,7 @@ str BWDSelectNotNilApproximate(int *resu
str BWDSelectNotNilRefine(int *result, int *bid, int *approx){
//TODO: implement me (easy)
/* *result = *bid; */
+ BBPincref(*result = *bid, 1);
return ALGselectNotNil(result, bid);
}
@@ -1153,8 +1202,11 @@ str BWDGroupedSumApproximate(int *retid,
BAT *groups = BATdescriptor(*groupsID);
BAT *values = BATdescriptor(*valuesID);
BAT *histogram = BATdescriptor(*histogramID);
-
- if (groups == NULL || values == NULL || histogram == NULL)
+ if(values == NULL){
+ printf("bwd.%s : approximate value bat is not available: %d, no
approximation can be provided\n", __func__, groups->batCacheid);
+ return MAL_SUCCEED;
+ }
+ if (groups == NULL || histogram == NULL)
throw(MAL, __func__, RUNTIME_OBJECT_MISSING);
if(!batTailIsDecomposed(groups)){
printf("bwd.%s : groups bat is not decomposed: %d, no
approximation can be provided\n", __func__, groups->batCacheid);
@@ -1179,7 +1231,12 @@ str BWDGroupedSumApproximate(int *retid,
}
str BWDGroupedSumRefine(int *retid,int *bid, int *gid, int *eid, bat* approx){
- BBPincref(*retid = *approx, 1);
+ /* BAT *left = BATdescriptor(*bid2); */
+ BAT* result = BATnew(TYPE_void, TYPE_int, 0);
+ /* BBPreleaseref(left->batCacheid); */
+ BBPkeepref(*retid = result->batCacheid);
+
+ /* BBPincref(*retid = *approx, 1); */
return MAL_SUCCEED;
}
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
@@ -82,11 +82,11 @@ comment "Refine B1 + B2, signal error on
command addapproximate(b1:any_1,b2:bat[:oid,:any_1]) :bat[:oid,:any_1]
-address BWDBatADDsignalApproximate
+address BWDConstantBatADDsignalApproximate
comment "Approximate B1 + B2, signal error on overflow";
command addrefine(b1:any_1,b2:bat[:oid,:any_1],
approximation:bat[:oid,:any_1]) :bat[:oid,:any_1]
-address BWDBatADDsignalRefine
+address BWDConstantBatADDsignalRefine
comment "Refine B1 + B2, signal error on overflow";
@@ -94,19 +94,19 @@ comment "Refine B1 + B2, signal error on
pattern subtractapproximate(b1:bat[:oid,:any_1],b2:bat[:oid,:any_1])
:bat[:oid,:any_1]
address BWDBatSUBsignalApproximate
-comment "Approximate B1 + B2, signal error on overflow";
+comment "Approximate B1 - B2";
pattern subtractrefine(b1:bat[:oid,:any_1],b2:bat[:oid,:any_1],
approximation:bat[:oid,:any_1]) :bat[:oid,:any_1]
address BWDBatSUBsignalRefine
-comment "Refine B1 + B2, signal error on overflow";
+comment "Refine B1 - B2";
-pattern subtractapproximate(b1:any_1, b2:bat[:oid,:any_1]) :bat[:oid,:any_1]
-address BWDBatSUBsignalApproximate
+pattern subtractapproximate(b1:int, b2:bat[:oid,:any_1]) :bat[:oid,:any_1]
+address BWDConstantBatSUBsignalApproximate
comment "Approximate B1 + B2, signal error on overflow";
-pattern subtractrefine(b1:any_1, b2:bat[:oid,:any_1],
approximation:bat[:oid,:any_1]) :bat[:oid,:any_1]
-address BWDBatSUBsignalRefine
+pattern subtractrefine(b1:int, b2:bat[:oid,:any_1],
approximation:bat[:oid,:any_1]) :bat[:oid,:any_1]
+address BWDConstantBatSUBsignalRefine
comment "Refine B1 + B2, signal error on overflow";
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list