Changeset: 461faf5b45d1 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=461faf5b45d1
Modified Files:
        monetdb5/mal/mal_interpreter.c
        monetdb5/modules/kernel/algebra.c
        monetdb5/modules/mal/batMask.c
        monetdb5/optimizer/opt_mask.c
Branch: msk-type
Log Message:

Framework for the optimizer. Still use :oid instead of :msk


diffs (83 lines):

diff --git a/monetdb5/mal/mal_interpreter.c b/monetdb5/mal/mal_interpreter.c
--- a/monetdb5/mal/mal_interpreter.c
+++ b/monetdb5/mal/mal_interpreter.c
@@ -678,9 +678,9 @@ str runMALsequence(Client cntxt, MalBlkP
                                                bat bid = stk->stk[a].val.bval;
                                                t = getBatType(t);
                                                assert(stk->stk[a].vtype == 
TYPE_bat);
-                                               assert(is_bat_nil(bid) ||
-                                                          t == TYPE_any ||
-                                                          
ATOMtype(BBP_desc(bid)->ttype) == ATOMtype(t));
+                                               assert( !is_bat_nil(bid));
+                                               assert(t != TYPE_any);
+                                               assert( 
ATOMtype(BBP_desc(bid)->ttype) == ATOMtype(t));
                                        } else {
                                                assert(t == stk->stk[a].vtype);
                                        }
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
@@ -1463,7 +1463,7 @@ MSKselect2(bat *result, const bat *bid, 
 static str
 MSKselect2nil(bat *result, const bat *bid, const bat *sid, const void *low, 
const void *high, const bit *li, const bit *hi, const bit *anti, const bit 
*unknown)
 {
-       ALGselect2nil(result, bid, sid, low, high, li, hi, anti, unknown);
+       return ALGselect2nil(result, bid, sid, low, high, li, hi, anti, 
unknown);
 }
 
 static str
@@ -1514,6 +1514,7 @@ mel_func algebra_init_funcs[] = {
  command("algebra", "thetaselect", ALGthetaselect2, false, "Select all head 
values of the first input BAT for which the tail value\nobeys the relation 
value OP VAL and for which the head value occurs in\nthe tail of the second 
input BAT.\nInput is a dense-headed BAT, output is a dense-headed BAT with 
in\nthe tail the head value of the input BAT for which the\nrelationship holds. 
 The output BAT is sorted on the tail value.", args(1,5, 
batarg("",oid),batargany("b",1),batarg("s",oid),argany("val",1),arg("op",str))),
  command("algebra", "selectNotNil", ALGselectNotNil, false, "Select all 
not-nil values", args(1,2, batargany("",2),batargany("b",2))),
 
+ // Convert result to a :msk TODO
   command("mask", "select", MSKselect1, false, "Select all head values for 
which the tail value is in range.\nInput is a dense-headed BAT, output is a 
dense-headed BAT with in\nthe tail the head value of the input BAT for which 
the tail value\nis between the values low and high (inclusive if li 
respectively\nhi is set).  The output BAT is sorted on the tail value.  If 
low\nor high is nil, the boundary is not considered (effectively - and\n+ 
infinity).  If anti is set, the result is the complement.  Nil\nvalues in the 
tail are never matched, unless low=nil, high=nil,\nli=1, hi=1, anti=0.  All 
non-nil values are returned if low=nil,\nhigh=nil, and li, hi are not both 1, 
or anti=1.\nNote that the output is suitable as second input for the 
other\nversion of this function.", args(1,7, 
batarg("",oid),batargany("b",1),argany("low",1),argany("high",1),arg("li",bit),arg("hi",bit),arg("anti",bit))),
  command("mask", "select", MSKselect2, false, "Select all head values of the 
first input BAT for which the tail value\nis in range and for which the head 
value occurs in the tail of the\nsecond input BAT.\nThe first input is a 
dense-headed BAT, the second input is a\ndense-headed BAT with sorted tail, 
output is a dense-headed BAT\nwith in the tail the head value of the input BAT 
for which the\ntail value is between the values low and high (inclusive if 
li\nrespectively hi is set).  The output BAT is sorted on the tail\nvalue.  If 
low or high is nil, the boundary is not considered\n(effectively - and + 
infinity).  If anti is set, the result is the\ncomplement.  Nil values in the 
tail are never matched, unless\nlow=nil, high=nil, li=1, hi=1, anti=0.  All 
non-nil values are\nreturned if low=nil, high=nil, and li, hi are not both 1, 
or anti=1.\nNote that the output is suitable as second input for 
this\nfunction.", args(1,8, 
batarg("",oid),batargany("b",1),batarg("s",oid),argany("low",1)
 ,argany("high",1),arg("li",bit),arg("hi",bit),arg("anti",bit))),
  command("mask", "select", MSKselect1nil, false, "With unknown set, each nil 
!= nil", args(1,8, 
batarg("",oid),batargany("b",1),argany("low",1),argany("high",1),arg("li",bit),arg("hi",bit),arg("anti",bit),arg("unknown",bit))),
diff --git a/monetdb5/modules/mal/batMask.c b/monetdb5/modules/mal/batMask.c
--- a/monetdb5/modules/mal/batMask.c
+++ b/monetdb5/modules/mal/batMask.c
@@ -67,8 +67,10 @@ MSKumask(Client cntxt, MalBlkPtr mb, Mal
 
 #include "mel.h"
 mel_func batMask_init_funcs[] = {
- pattern("mask", "mask", MSKmask, false, "", args(1,2, batargany("",1))),
- pattern("mask", "umask", MSKumask, false, "", args(1,2, batargany("",1))),
+//pattern("mask", "mask", MSKmask, false, "", args(1,2, batarg("r", msk), 
batarg("b",oid))),
+//pattern("mask", "umask", MSKumask, false, "", args(1,2, batarg("r", oid), 
batarg("b",msk))),
+ pattern("mask", "mask", MSKmask, false, "", args(1,2, batarg("r", oid), 
batarg("b",oid))),
+ pattern("mask", "umask", MSKumask, false, "", args(1,2, batarg("r", oid), 
batarg("b",oid))),
  { .imp=NULL }
 };
 #include "mal_import.h"
diff --git a/monetdb5/optimizer/opt_mask.c b/monetdb5/optimizer/opt_mask.c
--- a/monetdb5/optimizer/opt_mask.c
+++ b/monetdb5/optimizer/opt_mask.c
@@ -15,7 +15,7 @@
 str
 OPTmaskImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
 {
-       int i, k, se,limit, slimit;
+       int i, k, limit, slimit;
        InstrPtr p=0, q=0, *old= mb->stmt;
        int actions = 0;
        int *varused=0;
@@ -49,11 +49,13 @@ OPTmaskImplementation(Client cntxt, MalB
                pushInstruction(mb, p);
 
                if ( getModuleId(p) == algebraRef && (getFunctionId(p) == 
selectRef || getFunctionId(p) == thetaselectRef)){
-                       k = getArg(p,0);
-                       q = newInstruction(mb, batRef, umaskRef);
-                       setDestVar(q, newTmpVariable(mb, newBatType(TYPE_msk)));
-                       getArg(p,0) = getArg(q,0);
-                       setArgType(mb, q, 0, newBatType(TYPE_msk));
+                       k=  getArg(p,0);
+                       // setDestVar(p, newTmpVariable(mb, 
newBatType(TYPE_msk))); TODO
+                       setDestVar(p, newTmpVariable(mb, newBatType(TYPE_oid)));
+                       setModuleId(p, maskRef);
+
+                       q = newInstruction(mb, maskRef, umaskRef);
+                       getArg(q,0) = k;
                        q= pushArgument(mb, q, getArg(p,0));
                        pushInstruction(mb,q);
                        actions ++;
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to