Changeset: f1cf6889426b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f1cf6889426b
Added Files:
        monetdb5/modules/mal/Tests/arrange01.mal
        monetdb5/modules/mal/Tests/arrange02.mal
Modified Files:
        clients/Tests/exports.stable.out
        monetdb5/modules/mal/Tests/All
        monetdb5/modules/mal/Tests/arrange00.mal
        monetdb5/modules/mal/Tests/arrange00.stable.out
        monetdb5/modules/mal/Tests/inspect05.stable.out
        monetdb5/modules/mal/Tests/inspect05.stable.out.int128
Branch: leftmart
Log Message:

A few simple selection cases


diffs (294 lines):

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
@@ -313,6 +313,9 @@ oid OIDbase(oid base);
 int OIDfromStr(const char *src, int *len, oid **dst);
 oid OIDnew(oid inc);
 int OIDtoStr(str *dst, int *len, const oid *src);
+bat ORDERgetidx(BAT *b);
+bat ORDERgetidx(BAT *b){ BATcheck(b, "ORDERgetidx", GDK_FAIL);
+gdk_return ORDERkeepidx(BAT *b, BAT *order);
 void PROPdestroy(PROPrec *p);
 BUN SORTfnd(BAT *b, const void *v);
 BUN SORTfndfirst(BAT *b, const void *v);
@@ -812,6 +815,7 @@ str ALGtunion(bat *result, const bat *li
 str ALGvariance(dbl *res, const bat *bid);
 str ALGvariancep(dbl *res, const bat *bid);
 str ARNGcreate(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
+str ARNGgetorder(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
 str ARNGmerge(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
 str AUTHaddUser(oid *ret, Client *c, str *user, str *pass);
 str AUTHchangePassword(Client *c, str *oldpass, str *passwd);
diff --git a/monetdb5/modules/mal/Tests/All b/monetdb5/modules/mal/Tests/All
--- a/monetdb5/modules/mal/Tests/All
+++ b/monetdb5/modules/mal/Tests/All
@@ -83,3 +83,5 @@ pqueue2
 pqueue3
 
 arrange00
+arrange01
+arrange02
diff --git a/monetdb5/modules/mal/Tests/arrange00.mal 
b/monetdb5/modules/mal/Tests/arrange00.mal
--- a/monetdb5/modules/mal/Tests/arrange00.mal
+++ b/monetdb5/modules/mal/Tests/arrange00.mal
@@ -5,17 +5,21 @@ bv:= bat.new(:oid,:int);
 barrier v:= 0:int;
     w:= mmath.rand();
     bat.append(bv,w);
-    redo v:= iterator.next(1:int,100:int);
+    redo v:= iterator.next(1:int,10:int);
 exit v;
 
 io.print(bv);
 
-bat.arrange(bv,4);
+bat.arrange(bv,3);
 
 ord := bat.getorder(bv);
 
 io.print(ord);
 
+seq := algebra.leftfetchjoin(ord,bv);
+
+io.print(seq);
+
 (k,l):= algebra.subsort(bv,0:bit,1:bit);
 
-io.print(l);
+io.print(k,l);
diff --git a/monetdb5/modules/mal/Tests/arrange00.stable.out 
b/monetdb5/modules/mal/Tests/arrange00.stable.out
--- a/monetdb5/modules/mal/Tests/arrange00.stable.out
+++ b/monetdb5/modules/mal/Tests/arrange00.stable.out
@@ -27,40 +27,72 @@ barrier v := 0:int;
 exit v;
     io.print(bv);
     bat.arrange(bv,3);
+    ord := bat.getorder(bv);
+    io.print(ord);
+    seq := algebra.leftfetchjoin(ord,bv);
+    io.print(seq);
+    (k,l) := algebra.subsort(bv,false:bit,true:bit);
+    io.print(k,l);
 end user.main;
 #--------------------------#
 # h    t  # name
 # void int  # type
 #--------------------------#
-[ 0@0, 1487234864  ]
-[ 1@0, 1592400937  ]
-[ 2@0, 701036934  ]
-[ 3@0, 1760828847  ]
-[ 4@0, 967339068  ]
-[ 5@0, 769106223  ]
-[ 6@0, 490462704  ]
-[ 7@0, 237432659  ]
-[ 8@0, 814072936  ]
-[ 9@0, 394304748  ]
+[ 0@0, 1259450400  ]
+[ 1@0, 1306172021  ]
+[ 2@0, 1746020427  ]
+[ 3@0, 579493610  ]
+[ 4@0, 714014678  ]
+[ 5@0, 1748910160  ]
+[ 6@0, 1064201586  ]
+[ 7@0, 759827975  ]
+[ 8@0, 1184618781  ]
+[ 9@0, 165829404  ]
 #bat.arrange pieces 3
-&1 0 11 1 11
-% .explain # table_name
-% mal # name
-% clob # type
-% 96 # length
+#--------------------------#
+# h    t  # name
+# void oid  # type
+#--------------------------#
+[ 0@0, 9@0  ]
+[ 1@0, 3@0  ]
+[ 2@0, 4@0  ]
+[ 3@0, 7@0  ]
+[ 4@0, 6@0  ]
+[ 5@0, 8@0  ]
+[ 6@0, 0@0  ]
+[ 7@0, 1@0  ]
+[ 8@0, 2@0  ]
+[ 9@0, 5@0  ]
+#--------------------------#
+# h    t  # name
+# void int  # type
+#--------------------------#
+[ 0@0, 165829404  ]
+[ 1@0, 579493610  ]
+[ 2@0, 714014678  ]
+[ 3@0, 759827975  ]
+[ 4@0, 1064201586  ]
+[ 5@0, 1184618781  ]
+[ 6@0, 1259450400  ]
+[ 7@0, 1306172021  ]
+[ 8@0, 1746020427  ]
+[ 9@0, 1748910160  ]
+#--------------------------#
+# h    t       t  # name
+# void int     oid  # type
+#--------------------------#
+[ 0@0, 165829404,      9@0  ]
+[ 1@0, 579493610,      3@0  ]
+[ 2@0, 714014678,      4@0  ]
+[ 3@0, 759827975,      7@0  ]
+[ 4@0, 1064201586,     6@0  ]
+[ 5@0, 1184618781,     8@0  ]
+[ 6@0, 1259450400,     0@0  ]
+[ 7@0, 1306172021,     1@0  ]
+[ 8@0, 1746020427,     2@0  ]
+[ 9@0, 1748910160,     5@0  ]
 
+# 21:21:13 >  
+# 21:21:13 >  "Done."
+# 21:21:13 >  
 
-
-
-
-
-
-
-
-
-
-
-# 20:25:42 >  
-# 20:25:42 >  "Done."
-# 20:25:42 >  
-
diff --git a/monetdb5/modules/mal/Tests/arrange01.mal 
b/monetdb5/modules/mal/Tests/arrange01.mal
new file mode 100644
--- /dev/null
+++ b/monetdb5/modules/mal/Tests/arrange01.mal
@@ -0,0 +1,39 @@
+# create sorted oid arrangement 
+include orderidx;
+
+bv:= bat.new(:oid,:int);
+barrier v:= 0:int;
+    w:= mmath.rand();
+    bat.append(bv,w);
+    redo v:= iterator.next(1:int,10:int);
+exit v;
+
+s0:= 
algebra.subselect(bv,nil:bat[:oid,:oid],nil:int,nil:int,false,false,false);
+io.print(s0,bv);
+
+s1:= 
algebra.subselect(bv,nil:bat[:oid,:oid],nil:int,846930886,true,true,false);
+io.print(s1,bv);
+
+s2:= 
algebra.subselect(bv,nil:bat[:oid,:oid],846930886,846930886,true,true,false);
+io.print(s2,bv);
+
+s3:= 
algebra.subselect(bv,nil:bat[:oid,:oid],1649760492,nil:int,true,true,false);
+io.print(s3,bv);
+
+# introduce an oid index, it should produce the same results
+bat.arrange(bv,3);
+ord := bat.getorder(bv);
+io.print(ord,bv);
+x0:= 
algebra.subselect(bv,nil:bat[:oid,:oid],nil:int,nil:int,false,false,false);
+io.print(x0,bv);
+
+x1:= 
algebra.subselect(bv,nil:bat[:oid,:oid],nil:int,846930886,true,true,false);
+io.print(x1,bv);
+
+x2:= 
algebra.subselect(bv,nil:bat[:oid,:oid],846930886,846930886,true,true,false);
+io.print(x2,bv);
+
+x3:= 
algebra.subselect(bv,nil:bat[:oid,:oid],1649760492,nil:int,true,true,false);
+io.print(x3,bv);
+
+
diff --git a/monetdb5/modules/mal/Tests/arrange02.mal 
b/monetdb5/modules/mal/Tests/arrange02.mal
new file mode 100644
--- /dev/null
+++ b/monetdb5/modules/mal/Tests/arrange02.mal
@@ -0,0 +1,42 @@
+# create sorted oid arrangement 
+include orderidx;
+
+bv:= bat.new(:oid,:int);
+barrier v:= 0:int;
+    w:= mmath.rand();
+    bat.append(bv,w);
+    redo v:= iterator.next(1:int,10:int);
+exit v;
+
+vv:= algebra.slice(bv,0,10);
+
+s0:= 
algebra.subselect(vv,nil:bat[:oid,:oid],nil:int,nil:int,false,false,false);
+io.print(s0,vv);
+
+s1:= 
algebra.subselect(vv,nil:bat[:oid,:oid],nil:int,846930886,true,true,false);
+io.print(s1,vv);
+
+s2:= 
algebra.subselect(vv,nil:bat[:oid,:oid],846930886,846930886,true,true,false);
+io.print(s2,vv);
+
+s3:= 
algebra.subselect(vv,nil:bat[:oid,:oid],1649760492,nil:int,true,true,false);
+io.print(s3,vv);
+
+# introduce an oid index, it should produce the same results
+bat.arrange(bv,3);
+ord := bat.getorder(bv);
+io.print(ord,vv);
+
+x0:= 
algebra.subselect(vv,nil:bat[:oid,:oid],nil:int,nil:int,false,false,false);
+io.print(x0,vv);
+
+x1:= 
algebra.subselect(vv,nil:bat[:oid,:oid],nil:int,846930886,true,true,false);
+io.print(x1,vv);
+
+x2:= 
algebra.subselect(vv,nil:bat[:oid,:oid],846930886,846930886,true,true,false);
+io.print(x2,vv);
+
+x3:= 
algebra.subselect(vv,nil:bat[:oid,:oid],1649760492,nil:int,true,true,false);
+io.print(x3,vv);
+
+
diff --git a/monetdb5/modules/mal/Tests/inspect05.stable.out 
b/monetdb5/modules/mal/Tests/inspect05.stable.out
--- a/monetdb5/modules/mal/Tests/inspect05.stable.out
+++ b/monetdb5/modules/mal/Tests/inspect05.stable.out
@@ -38,13 +38,10 @@ end user.main;
 # t    t       t       t       t  # name
 # str  str     str     str     str  # type
 #--------------------------#
-[ "append",    "pattern",      "bat",  
"(bv:bat[:oid,:any_1],l:bat[:oid,:oid]...):void ",      "ARNGmerge;"  ]
-[ "append",    "pattern",      "bat",  
"(bv:bat[:oid,:any_1],pieces:int):bat[:oid,:any_1] ",   "ARNGcreate;"  ]
-[ "append",    "pattern",      "bat",  "(bv:bat[:oid,:any_1]):void ",  
"ARNGcreate;"  ]
 [ "append",    "command",      "bat",  
"(i:bat[:oid,:any_1],u:any_1):bat[:oid,:any_1] ",       "BKCappend_val_wrap;"  ]
-[ "arrange",   "command",      "bat",  "(tt:int,heapfile:str):bat[:oid,:any_1] 
",      "BKCattach;"  ]
-[ "arrange",   "command",      "bat",  
"(i:bat[:oid,:any_1],u:any_1,force:bit):bat[:oid,:any_1] ",     
"BKCappend_val_force_wrap;"  ]
-[ "arrange",   "command",      "bat",  
"(i:bat[:oid,:any_1],u:bat[:oid,:any_1],force:bit):bat[:oid,:any_1] ",  
"BKCappend_force_wrap;"  ]
+[ "append",    "command",      "bat",  "(tt:int,heapfile:str):bat[:oid,:any_1] 
",      "BKCattach;"  ]
+[ "append",    "command",      "bat",  
"(i:bat[:oid,:any_1],u:any_1,force:bit):bat[:oid,:any_1] ",     
"BKCappend_val_force_wrap;"  ]
+[ "append",    "command",      "bat",  
"(i:bat[:oid,:any_1],u:bat[:oid,:any_1],force:bit):bat[:oid,:any_1] ",  
"BKCappend_force_wrap;"  ]
 [ "attach",    "command",      "bat",  
"(i:bat[:oid,:any_1],u:bat[:oid,:any_1]):bat[:oid,:any_1] ",    
"BKCappend_wrap;"  ]
 [ "delete",    "command",      "bat",  "(sz:wrd):bat[:oid,:oid] ",     
"BKCdensebat;"  ]
 [ "delete",    "command",      "bat",  
"(b:bat[:oid,:any_1],src:bat[:oid,:any_1]):bat[:oid,:any_1] ",  
"BKCdelete_bat_bun;"  ]
diff --git a/monetdb5/modules/mal/Tests/inspect05.stable.out.int128 
b/monetdb5/modules/mal/Tests/inspect05.stable.out.int128
--- a/monetdb5/modules/mal/Tests/inspect05.stable.out.int128
+++ b/monetdb5/modules/mal/Tests/inspect05.stable.out.int128
@@ -38,13 +38,10 @@ end user.main;
 # t    t       t       t       t  # name
 # str  str     str     str     str  # type
 #--------------------------#
-[ "append",    "pattern",      "bat",  
"(bv:bat[:oid,:any_1],l:bat[:oid,:oid]...):void ",      "ARNGmerge;"  ]
-[ "append",    "pattern",      "bat",  
"(bv:bat[:oid,:any_1],pieces:int):bat[:oid,:any_1] ",   "ARNGcreate;"  ]
-[ "append",    "pattern",      "bat",  "(bv:bat[:oid,:any_1]):void ",  
"ARNGcreate;"  ]
 [ "append",    "command",      "bat",  
"(i:bat[:oid,:any_1],u:any_1):bat[:oid,:any_1] ",       "BKCappend_val_wrap;"  ]
-[ "arrange",   "command",      "bat",  "(tt:int,heapfile:str):bat[:oid,:any_1] 
",      "BKCattach;"  ]
-[ "arrange",   "command",      "bat",  
"(i:bat[:oid,:any_1],u:any_1,force:bit):bat[:oid,:any_1] ",     
"BKCappend_val_force_wrap;"  ]
-[ "arrange",   "command",      "bat",  
"(i:bat[:oid,:any_1],u:bat[:oid,:any_1],force:bit):bat[:oid,:any_1] ",  
"BKCappend_force_wrap;"  ]
+[ "append",    "command",      "bat",  "(tt:int,heapfile:str):bat[:oid,:any_1] 
",      "BKCattach;"  ]
+[ "append",    "command",      "bat",  
"(i:bat[:oid,:any_1],u:any_1,force:bit):bat[:oid,:any_1] ",     
"BKCappend_val_force_wrap;"  ]
+[ "append",    "command",      "bat",  
"(i:bat[:oid,:any_1],u:bat[:oid,:any_1],force:bit):bat[:oid,:any_1] ",  
"BKCappend_force_wrap;"  ]
 [ "attach",    "command",      "bat",  
"(i:bat[:oid,:any_1],u:bat[:oid,:any_1]):bat[:oid,:any_1] ",    
"BKCappend_wrap;"  ]
 [ "delete",    "command",      "bat",  "(sz:wrd):bat[:oid,:oid] ",     
"BKCdensebat;"  ]
 [ "delete",    "command",      "bat",  
"(b:bat[:oid,:any_1],src:bat[:oid,:any_1]):bat[:oid,:any_1] ",  
"BKCdelete_bat_bun;"  ]
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to