Changeset: 9075f5a79ec5 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9075f5a79ec5
Modified Files:
        monetdb5/modules/mal/Tests/All
        monetdb5/modules/mal/Tests/array02.mal
        monetdb5/modules/mal/Tests/array02.stable.out
        monetdb5/modules/mal/Tests/array03.mal
        monetdb5/modules/mal/Tests/array03.stable.out
        monetdb5/modules/mal/array.mx
Branch: sciql
Log Message:

Introduce operation 'unmap'
The reverse mapping from cell id to index vectors is denoted as unmap.


diffs (166 lines):

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
@@ -58,6 +58,12 @@
 tokenizer00
 zorder
 
+array00
+array01
+array02
+array03
+array04
+
 #HAVE_RAPTOR?rdf
 
 # might show different output if openssl is compiled without full sha2
diff --git a/monetdb5/modules/mal/Tests/array02.mal 
b/monetdb5/modules/mal/Tests/array02.mal
--- a/monetdb5/modules/mal/Tests/array02.mal
+++ b/monetdb5/modules/mal/Tests/array02.mal
@@ -23,10 +23,10 @@
 io.print(y);
 
 #fetch the index column
-z1:= array.map(x,v);
+z1:= array.unmap(x,v);
 io.print(z1);
 
-(zx:bat[:oid,:int],zy:bat[:oid,:int]):= array.map(y,mx,my);
+(zx:bat[:oid,:int],zy:bat[:oid,:int]):= array.unmap(y,mx,my);
 io.print(zx);
 io.print(zy);
 io.print(zx,zy);
diff --git a/monetdb5/modules/mal/Tests/array02.stable.out 
b/monetdb5/modules/mal/Tests/array02.stable.out
--- a/monetdb5/modules/mal/Tests/array02.stable.out
+++ b/monetdb5/modules/mal/Tests/array02.stable.out
@@ -38,9 +38,9 @@
     bat.insert(y,7@0,2@0);
     io.print(y);
 #fetch the index column 
-    z1 := array.map(x,v);
+    z1 := array.unmap(x,v);
     io.print(z1);
-    (zx:bat[:oid,:int] ,zy:bat[:oid,:int] ) := array.map(y,mx,my);
+    (zx:bat[:oid,:int] ,zy:bat[:oid,:int] ) := array.unmap(y,mx,my);
     io.print(zx);
     io.print(zy);
     io.print(zx,zy);
diff --git a/monetdb5/modules/mal/Tests/array03.mal 
b/monetdb5/modules/mal/Tests/array03.mal
--- a/monetdb5/modules/mal/Tests/array03.mal
+++ b/monetdb5/modules/mal/Tests/array03.mal
@@ -19,6 +19,7 @@
 io.print(x);
 xv:= bat.new(:oid,:int);
 bat.insert(xv,0@0,999);
+bat.insert(xv,0@0,998);
 io.print(xv);
 y:= bat.new(:oid,:oid);
 bat.insert(y, 2@0,0@0);
diff --git a/monetdb5/modules/mal/Tests/array03.stable.out 
b/monetdb5/modules/mal/Tests/array03.stable.out
--- a/monetdb5/modules/mal/Tests/array03.stable.out
+++ b/monetdb5/modules/mal/Tests/array03.stable.out
@@ -35,6 +35,7 @@
     io.print(x);
     xv := bat.new(:oid,:int);
     bat.insert(xv,0@0,999);
+    bat.insert(xv,0@0,998);
     io.print(xv);
     y := bat.new(:oid,:oid);
     bat.insert(y,2@0,0@0);
@@ -88,6 +89,7 @@
 # void int       # type
 #-----------------#
 [ 0@0,   999     ]
+[ 0@0,   998     ]
 #-----------------#
 # h    t         # name
 # void int       # type
@@ -95,7 +97,36 @@
 [ 0@0,   123     ]
 [ 3@0,   234     ]
 [ 4@0,   345     ]
-!MALException:array.replace:unbalanced array arguments
+#-------------------------#
+# h    t       t         # name
+# void int     int       # type
+#-------------------------#
+[ 0@0,   0,      0       ]
+[ 1@0,   1,      999     ]
+[ 2@0,   2,      6       ]
+[ 3@0,   3,      9       ]
+#-----------------#
+# h    t         # name
+# oid  oid       # type
+#-----------------#
+[ 2@0,   1@0     ]
+[ 1@0,   0@0     ]
+#---------------------------------#
+# h    t       t       t         # name
+# void int     int     int       # type
+#---------------------------------#
+[ 0@0,   0,      0,      0       ]
+[ 1@0,   0,      1,      -1      ]
+[ 2@0,   0,      2,      -1      ]
+[ 3@0,   0,      3,      3       ]
+[ 4@0,   2,      0,      4       ]
+[ 5@0,   2,      1,      5       ]
+[ 6@0,   2,      2,      6       ]
+[ 7@0,   2,      3,      7       ]
+[ 8@0,   4,      0,      8       ]
+[ 9@0,   4,      1,      9       ]
+[ 10@0,          4,      2,      10      ]
+[ 11@0,          4,      3,      11      ]
 
 # 22:31:10 >  
 # 22:31:10 >  Done.
diff --git a/monetdb5/modules/mal/array.mx b/monetdb5/modules/mal/array.mx
--- a/monetdb5/modules/mal/array.mx
+++ b/monetdb5/modules/mal/array.mx
@@ -62,8 +62,8 @@
 of the target array and the second one holds the index values of interest. The 
result is a column
 with the oid positions of the elements in target. ";
 
-pattern map(cells:bat[:oid,:oid], dims:bat[:oid,:any]...):bat[:oid,:any]...
-address ARRAYmapReverse
+pattern unmap(cells:bat[:oid,:oid], dims:bat[:oid,:any]...):bat[:oid,:any]...
+address ARRAYumap
 comment "Extract the index columns from a shape based on the cell identifier 
list";
 
 pattern isFixed(dims:bat[:oid,:any]...):bit
@@ -136,7 +136,7 @@
 array_export str ARRAYproduct(int *ret, int *bid, int *rid);
 array_export str ARRAYfiller(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr p);
 array_export str ARRAYmap(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
p);
-array_export str ARRAYmapReverse(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr p);
+array_export str ARRAYumap(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
p);
 array_export str ARRAYreplace(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr p);
 array_export str ARRAYreplaceScalar(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr p);
 array_export str ARRAYtiles(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
@@ -399,7 +399,7 @@
 }
 
 str
-ARRAYmapReverse(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
+ARRAYumap(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
 {
        BAT *b, *bn, *bo;
        int i;
@@ -407,15 +407,15 @@
        (void) cntxt;
        (void) mb;
        if ( (pci->argc -1 - pci->retc) != pci->retc)
-               throw(MAL, "array.map", "Unbalanced index arguments and return 
list");
+               throw(MAL, "array.unmap", "Unbalanced index arguments and 
return list");
        if ((b = BATdescriptor(*(int*)getArgReference(stk,pci,pci->retc))) == 
NULL) 
-               throw(MAL, "array.map", RUNTIME_OBJECT_MISSING);
+               throw(MAL, "array.unmap", RUNTIME_OBJECT_MISSING);
        
        for ( i=pci->retc+1; i<pci->argc; i++){
                bo = BATdescriptor(*(int*)getArgReference(stk,pci,i));
                if ( bo == NULL){
                        BBPreleaseref(b->batCacheid);
-                       throw(MAL, "array.map", RUNTIME_OBJECT_MISSING);
+                       throw(MAL, "array.unmap", RUNTIME_OBJECT_MISSING);
                }
                bn = BATsemijoin( bo,b);
                if ( bn ) {
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to