[prev in list] [next in list] [prev in thread] [next in thread] 

List:       monetdb-checkins
Subject:    MonetDB: compressedcandidates - Add the alternative for straight...
From:       Martin Kersten <commits+mk=cwi.nl () monetdb ! org>
Date:       2017-12-31 14:28:31
Message-ID: hg.bf0a5df732c2.1514730511.6315528441665844383 () monetdb-vm0 ! spin-off ! cwi ! nl
[Download RAW message or body]

Changeset: bf0a5df732c2 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bf0a5df732c2
Modified Files:
	clients/Tests/MAL-signatures.stable.out
	clients/Tests/MAL-signatures.stable.out.int128
	clients/Tests/exports.stable.out
	monetdb5/modules/kernel/algebra.c
	monetdb5/modules/kernel/algebra.h
	monetdb5/modules/kernel/algebra.mal
	monetdb5/modules/mal/bitcandidates.c
	monetdb5/optimizer/opt_bitcandidates.c
Branch: compressedcandidates
Log Message:

Add the alternative for straight selects


diffs (127 lines):

diff --git a/clients/Tests/MAL-signatures.stable.out \
                b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -507,6 +507,8 @@ Ready.
 [ "algebra",	"reuse",	"command algebra.reuse(b:bat[:any_1]):bat[:any_1] \
",	"ALGreuse;",	"Reuse a temporary BAT if you can. Otherwise,\n\tallocate enough \
storage to accept result of an\n \toperation (not involving the heap)"	]  [ \
"algebra",	"select",	"command algebra.select(b:bat[:any_1], low:any_1, high:any_1, \
li:bit, hi:bit, anti:bit):bat[:oid] ",	"ALGselect1;",	"Select all head values for \
which the tail value is in range.\n\tInput is a dense-headed BAT, output is a \
dense-headed BAT with in\n\tthe tail the head value of the input BAT for which the \
tail value\n\tis between the values low and high (inclusive if li respectively\n\thi \
is set).  The output BAT is sorted on the tail value.  If low\n\tor high is nil, the \
boundary is not considered (effectively - and\n\t+ infinity).  If anti is set, the \
result is the complement.  Nil\n\tvalues in the tail are never matched, unless \
low=nil, high=nil,\n\tli=1, hi=1, anti=0.  All non-nil values are returned if \
low=nil,\n\thigh=nil, and li, hi are not both 1, or anti=1.\n\tNote that the output \
is suitable as second input for the other\n\tversion of this function."	]  [ \
"algebra",	"select",	"command algebra.select(b:bat[:any_1], s:bat[:oid], low:any_1, \
high:any_1, li:bit, hi:bit, anti:bit):bat[:oid] ",	"ALGselect2;",	"Select all head \
values of the first input BAT for which the tail value\n\tis in range and for which \
the head value occurs in the tail of the\n\tsecond input BAT.\n\tThe first input is a \
dense-headed BAT, the second input is a\n\tdense-headed BAT with sorted tail, output \
is a dense-headed BAT\n\twith in the tail the head value of the input BAT for which \
the\n\ttail value is between the values low and high (inclusive if li\n\trespectively \
hi is set).  The output BAT is sorted on the tail\n\tvalue.  If low or high is nil, \
the boundary is not considered\n\t(effectively - and + infinity).  If anti is set, \
the result is the\n\tcomplement.  Nil values in the tail are never matched, \
unless\n\tlow=nil, high=nil, li=1, hi=1, anti=0.  All non-nil values are\n\treturned \
if low=nil, high=nil, and li, hi are not both 1, or anti=1.\n\tNote that th  e output \
is suitable as second input for this\n\tfunction."	] +[ "algebra",	"select",	"command \
algebra.select(b:bat[:any_1], low:any_1, high:any_1, li:bit, hi:bit, \
anti:bit):bat[:msk] ",	"ALGselectMsk1;",	""	] +[ "algebra",	"select",	"command \
algebra.select(b:bat[:any_1], s:bat[:oid], low:any_1, high:any_1, li:bit, hi:bit, \
anti:bit):bat[:msk] ",	"ALGselectMsk2;",	""	]  [ "algebra",	"selectNotNil",	"command \
algebra.selectNotNil(b:bat[:any_2]):bat[:any_2] ",	"ALGselectNotNil;",	"Select all \
not-nil values"	]  [ "algebra",	"semijoin",	"command algebra.semijoin(l:bat[:any_1], \
r:bat[:any_1], sl:bat[:oid], sr:bat[:oid], nil_matches:bit, estimate:lng) \
(X_0:bat[:oid], X_1:bat[:oid]) ",	"ALGsemijoin;",	"Semi join with candidate lists"	]  \
[ "algebra",	"slice",	"command algebra.slice(b:bat[:any_1], x:lng, y:lng):bat[:any_1] \
                ",	"ALGslice;",	"Return the slice with the BUNs at position x till \
                y."	]
diff --git a/clients/Tests/MAL-signatures.stable.out.int128 \
                b/clients/Tests/MAL-signatures.stable.out.int128
--- a/clients/Tests/MAL-signatures.stable.out.int128
+++ b/clients/Tests/MAL-signatures.stable.out.int128
@@ -611,6 +611,8 @@ Ready.
 [ "algebra",	"reuse",	"command algebra.reuse(b:bat[:any_1]):bat[:any_1] \
",	"ALGreuse;",	"Reuse a temporary BAT if you can. Otherwise,\n\tallocate enough \
storage to accept result of an\n \toperation (not involving the heap)"	]  [ \
"algebra",	"select",	"command algebra.select(b:bat[:any_1], low:any_1, high:any_1, \
li:bit, hi:bit, anti:bit):bat[:oid] ",	"ALGselect1;",	"Select all head values for \
which the tail value is in range.\n\tInput is a dense-headed BAT, output is a \
dense-headed BAT with in\n\tthe tail the head value of the input BAT for which the \
tail value\n\tis between the values low and high (inclusive if li respectively\n\thi \
is set).  The output BAT is sorted on the tail value.  If low\n\tor high is nil, the \
boundary is not considered (effectively - and\n\t+ infinity).  If anti is set, the \
result is the complement.  Nil\n\tvalues in the tail are never matched, unless \
low=nil, high=nil,\n\tli=1, hi=1, anti=0.  All non-nil values are returned if \
low=nil,\n\thigh=nil, and li, hi are not both 1, or anti=1.\n\tNote that the output \
is suitable as second input for the other\n\tversion of this function."	]  [ \
"algebra",	"select",	"command algebra.select(b:bat[:any_1], s:bat[:oid], low:any_1, \
high:any_1, li:bit, hi:bit, anti:bit):bat[:oid] ",	"ALGselect2;",	"Select all head \
values of the first input BAT for which the tail value\n\tis in range and for which \
the head value occurs in the tail of the\n\tsecond input BAT.\n\tThe first input is a \
dense-headed BAT, the second input is a\n\tdense-headed BAT with sorted tail, output \
is a dense-headed BAT\n\twith in the tail the head value of the input BAT for which \
the\n\ttail value is between the values low and high (inclusive if li\n\trespectively \
hi is set).  The output BAT is sorted on the tail\n\tvalue.  If low or high is nil, \
the boundary is not considered\n\t(effectively - and + infinity).  If anti is set, \
the result is the\n\tcomplement.  Nil values in the tail are never matched, \
unless\n\tlow=nil, high=nil, li=1, hi=1, anti=0.  All non-nil values are\n\treturned \
if low=nil, high=nil, and li, hi are not both 1, or anti=1.\n\tNote that th  e output \
is suitable as second input for this\n\tfunction."	] +[ "algebra",	"select",	"command \
algebra.select(b:bat[:any_1], low:any_1, high:any_1, li:bit, hi:bit, \
anti:bit):bat[:msk] ",	"ALGselectMsk1;",	""	] +[ "algebra",	"select",	"command \
algebra.select(b:bat[:any_1], s:bat[:oid], low:any_1, high:any_1, li:bit, hi:bit, \
anti:bit):bat[:msk] ",	"ALGselectMsk2;",	""	]  [ "algebra",	"selectNotNil",	"command \
algebra.selectNotNil(b:bat[:any_2]):bat[:any_2] ",	"ALGselectNotNil;",	"Select all \
not-nil values"	]  [ "algebra",	"semijoin",	"command algebra.semijoin(l:bat[:any_1], \
r:bat[:any_1], sl:bat[:oid], sr:bat[:oid], nil_matches:bit, estimate:lng) \
(X_0:bat[:oid], X_1:bat[:oid]) ",	"ALGsemijoin;",	"Semi join with candidate lists"	]  \
[ "algebra",	"slice",	"command algebra.slice(b:bat[:any_1], x:lng, y:lng):bat[:any_1] \
                ",	"ALGslice;",	"Return the slice with the BUNs at position x till \
                y."	]
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -709,6 +709,8 @@ str ALGrangejoin(bat *r1, bat *r2, const
 str ALGreuse(bat *ret, const bat *bid);
 str ALGselect1(bat *result, const bat *bid, const void *low, const void *high, const \
bit *li, const bit *hi, const bit *anti);  str ALGselect2(bat *result, const bat \
*bid, const bat *sid, const void *low, const void *high, const bit *li, const bit \
*hi, const bit *anti); +str ALGselectMsk1(bat *result, const bat *bid, const void \
*low, const void *high, const bit *li, const bit *hi, const bit *anti); +str \
ALGselectMsk2(bat *result, const bat *bid, const bat *sid, const void *low, const \
void *high, const bit *li, const bit *hi, const bit *anti);  str ALGselectNotNil(bat \
*result, const bat *bid);  str ALGsemijoin(bat *r1, bat *r2, const bat *l, const bat \
*r, const bat *sl, const bat *sr, const bit *nil_matches, const lng *estimate);  str \
                ALGslice(bat *ret, const bat *bid, const lng *start, const lng *end);
diff --git a/monetdb5/modules/kernel/algebra.c b/monetdb5/modules/kernel/algebra.c
--- a/monetdb5/modules/kernel/algebra.c
+++ b/monetdb5/modules/kernel/algebra.c
@@ -265,12 +265,24 @@ ALGselect2(bat *result, const bat *bid, 
 }
 
 str
+ALGselectMsk2(bat *result, const bat *bid, const bat *sid, const void *low, const \
void *high, const bit *li, const bit *hi, const bit *anti) +{
+	return ALGselect2(result, bid, sid, low, high, li, hi, anti);
+}
+
+str
 ALGselect1(bat *result, const bat *bid, const void *low, const void *high, const bit \
*li, const bit *hi, const bit *anti)  {
 	return ALGselect2(result, bid, NULL, low, high, li, hi, anti);
 }
 
 str
+ALGselectMsk1(bat *result, const bat *bid, const void *low, const void *high, const \
bit *li, const bit *hi, const bit *anti) +{
+	return ALGselect2(result, bid, NULL, low, high, li, hi, anti);
+}
+
+str
 ALGthetaselect2(bat *result, const bat *bid, const bat *sid, const void *val, const \
char **op)  {
 	BAT *b, *s = NULL, *bn;
diff --git a/monetdb5/modules/kernel/algebra.h b/monetdb5/modules/kernel/algebra.h
--- a/monetdb5/modules/kernel/algebra.h
+++ b/monetdb5/modules/kernel/algebra.h
@@ -23,7 +23,9 @@ mal_export str ALGmaxany(ptr result, con
 mal_export str ALGgroupby(bat *res, const bat *gids, const bat *cnts);
 mal_export str ALGcard(lng *result, const bat *bid);
 mal_export str ALGselect1(bat *result, const bat *bid, const void *low, const void \
*high, const bit *li, const bit *hi, const bit *anti); +mal_export str \
ALGselectMsk1(bat *result, const bat *bid, const void *low, const void *high, const \
bit *li, const bit *hi, const bit *anti);  mal_export str ALGselect2(bat *result, \
const bat *bid, const bat *sid, const void *low, const void *high, const bit *li, \
const bit *hi, const bit *anti); +mal_export str ALGselectMsk2(bat *result, const bat \
*bid, const bat *sid, const void *low, const void *high, const bit *li, const bit \
*hi, const bit *anti);  mal_export str ALGthetaselect1(bat *result, const bat *bid, \
const void *val, const char **op);  mal_export str ALGthetaselectMsk1(bat *result, \
const bat *bid, const void *val, const char **op);  mal_export str \
ALGthetaselect2(bat *result, const bat *bid, const bat *sid, const void *val, const \
                char **op);
diff --git a/monetdb5/modules/kernel/algebra.mal \
                b/monetdb5/modules/kernel/algebra.mal
--- a/monetdb5/modules/kernel/algebra.mal
+++ b/monetdb5/modules/kernel/algebra.mal
@@ -37,6 +37,8 @@ address ALGexist
 comment "Returns whether 'val' occurs in b.";
 
 # The range selections are targeted at the tail of the BAT.
+command select(b:bat[:any_1], low:any_1, high:any_1, li:bit, hi:bit, anti:bit) \
:bat[:msk] +address ALGselectMsk1;
 command select(b:bat[:any_1], low:any_1, high:any_1, li:bit, hi:bit, anti:bit) \
:bat[:oid]  address ALGselect1
 comment "Select all head values for which the tail value is in range.
@@ -52,6 +54,8 @@ comment "Select all head values for whic
 	Note that the output is suitable as second input for the other
 	version of this function.";
 
+command select(b:bat[:any_1], s:bat[:oid], low:any_1, high:any_1, li:bit, hi:bit, \
anti:bit) :bat[:msk] +address ALGselectMsk2;
 command select(b:bat[:any_1], s:bat[:oid], low:any_1, high:any_1, li:bit, hi:bit, \
anti:bit) :bat[:oid]  address ALGselect2
 comment "Select all head values of the first input BAT for which the tail value
diff --git a/monetdb5/modules/mal/bitcandidates.c \
                b/monetdb5/modules/mal/bitcandidates.c
--- a/monetdb5/modules/mal/bitcandidates.c
+++ b/monetdb5/modules/mal/bitcandidates.c
@@ -146,6 +146,11 @@ BCLdecompress(Client cntxt, MalBlkPtr mb
 		BBPkeepref(*ret = *val);
 		return MAL_SUCCEED;
 	}
+	/* TODO until we really produce a mask, simply return */
+	if( b->ttype == TYPE_msk){
+		BBPkeepref(*ret = *val);
+		return MAL_SUCCEED;
+	}
 	bn = CANDdecompress(b);
 	if ( bn == NULL){
 		BBPunfix(*val);
diff --git a/monetdb5/optimizer/opt_bitcandidates.c \
                b/monetdb5/optimizer/opt_bitcandidates.c
--- a/monetdb5/optimizer/opt_bitcandidates.c
+++ b/monetdb5/optimizer/opt_bitcandidates.c
@@ -52,6 +52,10 @@ OPTbitcandidatesImplementation(Client cn
 			setVarType( mb, getArg(p,0), newBatType(TYPE_msk));
 			actions++;
 		}
+		if( getFunctionId(p) == selectRef && getModuleId(p) == algebraRef){
+			setVarType( mb, getArg(p,0), newBatType(TYPE_msk));
+			actions++;
+		}
 	}
 	for( ; i<slimit; i++)
 		if( old[i])
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic