Changeset: ce87909f7131 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ce87909f7131
Modified Files:
        sql/test/sciql/Tests/Msci00.mal
        sql/test/sciql/Tests/Msci01.mal
        sql/test/sciql/Tests/Msci02.mal
        sql/test/sciql/Tests/Msci03.mal
Branch: sciql
Log Message:

intermediate commit of work in progress


diffs (271 lines):

diff --git a/sql/test/sciql/Tests/Msci00.mal b/sql/test/sciql/Tests/Msci00.mal
--- a/sql/test/sciql/Tests/Msci00.mal
+++ b/sql/test/sciql/Tests/Msci00.mal
@@ -1,12 +1,36 @@
-#CREATE ARRAY A1( x integer DIMENSION[4], val float DEFAULT 0.0);
-#additional operations required for explicit indices
-x:bat[:oid,:int]:= sciql.newDimension("sys","A1","x",0,0,4,1);
+# Query: CREATE ARRAY A1( x integer DIMENSION[4], val float DEFAULT 0.0);
+# Note: additional operations required for explicit indices
+# Note: base arrays are initialized once in most situations considered!
+#       (appends are allowed)
+# Note: What is the storage model ? explicit dimensions? or implicit?
+#       explicit model, after definition we have to instanciate the array
+#       create the x- and y- bats, initialize with their value
 
-#CREATE ARRAY A2 ( x integer DIMENSION[0:4:1], val float DEFAULT 0.0);
-#additional operations required for explicit indices
-x:bat[:oid,:int]:= sciql.newDimension("sys","A2","x",0,0,4,1);
+# x:bat[:oid,:int]:= sciql.newDimension("sys","A1","x",0,0,4,1);
 
-CREATE SEQUENCE range AS integer START WITH 0 INCREMENT BY 1 MAXVALUE 3;
-#CREATE ARRAY A3 ( x integer DIMENSION range, val float DEFAULT 0.0);
-#additional operations required for explicit indices
-x:bat[:oid,:int]:= sciql.newDimension("sys","A3","x",0,0,4,1);
+function user.s0_1{autoCommit=true}():void;
+    sql.mvc();
+    sql.catalog(63,"sys":str,140473280789176:ptr,0:int); # DDL_CREATE_ARRAY==63
+    sql.exportOperation("");
+end s0_1;
+
+# Query: CREATE ARRAY A2 ( x integer DIMENSION[0:4:1], val float DEFAULT 0.0);
+function user.s1_1{autoCommit=true}():void;
+    sql.mvc();
+    sql.catalog(63,"sys":str,140473280789176:ptr,0:int); # DDL_CREATE_ARRAY==63
+    sql.exportOperation("");
+end s1_1;
+
+# Query: CREATE SEQUENCE range AS integer START WITH 0 INCREMENT BY 1 MAXVALUE 
3;
+#        CREATE ARRAY A3 ( x integer DIMENSION range, val float DEFAULT 0.0);
+function user.s2_1{autoCommit=true}():void;
+    sql.mvc();
+    sql.catalog(5,"sys":str,140473281519496:ptr,0:int);
+    sql.exportOperation("");
+end s2_1;
+function user.s3_1{autoCommit=true}():void;
+    sql.mvc();
+    sql.catalog(63,"sys":str,140473280789176:ptr,0:int); # DDL_CREATE_ARRAY==63
+    sql.exportOperation("");
+end s3_1;
+
diff --git a/sql/test/sciql/Tests/Msci01.mal b/sql/test/sciql/Tests/Msci01.mal
--- a/sql/test/sciql/Tests/Msci01.mal
+++ b/sql/test/sciql/Tests/Msci01.mal
@@ -1,17 +1,57 @@
-#CREATE ARRAY matrix ( x integer DIMENSION[4], y integer DIMENSION[4], val 
float DEFAULT 0.0 );
-#additional operations required for explicit indices
-(x:bat[:oid,:int],y:bat[:oid,:int]) := 
sciql.newDimension("sys","matrix","x",0,0,4,1,"y",0,4,1);
+# Query: CREATE ARRAY matrix (
+#            x integer DIMENSION[4],
+#            y integer DIMENSION[4],
+#            val float DEFAULT 0.0 );
 
+#(x:bat[:oid,:int],y:bat[:oid,:int]) := 
sciql.newDimension("sys","matrix","x",0,0,4,1,"y",0,4,1);
 
-#CREATE ARRAY grid( x integer DIMENSION[4] CHECK(mod(x,2) = 0), y integer 
DIMENSION[4], val float DEFAULT 0.0);
-#additional operations required for explicit indices
-(x:bat[:oid,:int],y:bat[:oid,:int]) := 
sciql.newDimension("sys","grid","x",0,0,4,1,"y",0,4,1);
+function user.s0_1{autoCommit=true}():void;
+    sql.mvc();
+    sql.catalog(63,"sys":str,140473280789176:ptr,0:int); # DDL_CREATE_ARRAY==63
+    sql.exportOperation("");
+end s0_1;
 
-#CREATE ARRAY diagonal( x integer DIMENSION[4], y integer DIMENSION[4] CHECK(x 
= y), val float );
-#additional operations required for explicit indices
-(x:bat[:oid,:int],y:bat[:oid,:int]) := 
sciql.newDimension("sys","diagonal","x",0,0,4,1,"y",0,4,1);
+# Query: CREATE ARRAY stripes(
+#            x integer DIMENSION[4],
+#            y integer DIMENSION[4] CHECK(mod(y,2) = 1),
+#            val float DEFAULT 0.0);
 
-#CREATE ARRAY sparse( x integer DIMENSION[4], y integer DIMENSION[4], val 
float DEFAULT 0.0 CHECK(val>0));
-#additional operations required for explicit indices
-(x:bat[:oid,:int],y:bat[:oid,:int]) := 
sciql.newDimension("sys","sparse","x",0,0,4,1,"y",0,4,1);
+function user.s1_1{autoCommit=true}():void;
+    sql.mvc();
+    sql.catalog(63,"sys":str,140473280789176:ptr,0:int); # DDL_CREATE_ARRAY==63
+    sql.exportOperation("");
+end s1_1;
 
+# Query: CREATE ARRAY diagonal(
+#            x integer DIMENSION[4],
+#            y integer DIMENSION[4] CHECK(x = y),
+#            val float DEFAULT 0.0);
+
+function user.s2_1{autoCommit=true}():void;
+    sql.mvc();
+    sql.catalog(63,"sys":str,140473280789176:ptr,0:int); # DDL_CREATE_ARRAY==63
+    sql.exportOperation("");
+end s2_1;
+
+# Query: CREATE ARRAY sparse(
+#            x integer DIMENSION[4],
+#            y integer DIMENSION[4],
+#            val float DEFAULT 0.0 CHECK(val>=0));
+
+function user.s3_1{autoCommit=true}():void;
+    sql.mvc();
+    sql.catalog(63,"sys":str,140473280789176:ptr,0:int); # DDL_CREATE_ARRAY==63
+    sql.exportOperation("");
+end s3_1;
+
+# Query: CREATE ARRAY stripes2(
+#            x integer DIMENSION,
+#            y integer DIMENSION,
+#            val float DEFAULT 0.0);
+
+function user.s1_1{autoCommit=true}():void;
+    sql.mvc();
+    sql.catalog(63,"sys":str,140473280789176:ptr,0:int); # DDL_CREATE_ARRAY==63
+    sql.exportOperation("");
+end s1_1;
+
diff --git a/sql/test/sciql/Tests/Msci02.mal b/sql/test/sciql/Tests/Msci02.mal
--- a/sql/test/sciql/Tests/Msci02.mal
+++ b/sql/test/sciql/Tests/Msci02.mal
@@ -1,10 +1,34 @@
-#CREATE TABLE experiment( 
-#      run timestamp DIMENSION[  TIMESTAMP '2010-01-01':*: INTERVAL'1' day], 
-#      payload float ARRAY[4][4] DEFAULT 0.0 );
+# Query: CREATE TABLE experiment( 
+#            run timestamp DIMENSION[TIMESTAMP '2010-01-01':*: INTERVAL'1' 
day], 
+#            payload float DEFAULT 0.0 );
 #additional operations required for explicit indices
-run:bat[:oid,:timestamp]:= 
array.newDimension("sys","experiment","run",0,"2010-01-01":timestamp,null:timestamp,"1:0:0":timestamp);
+#run:bat[:oid,:timestamp]:= 
array.newDimension("sys","experiment","run",0,"2010-01-01":timestamp,null:timestamp,"1:0:0":timestamp);
+function user.s0_1{autoCommit=true}():void;
+    sql.mvc();
+    sql.catalog(63,"sys":str,140473280789176:ptr,0:int); # DDL_CREATE_ARRAY==63
+    sql.exportOperation("");
+end s0_1;
 
-#CREATE TABLE timeseries( 
-#      run timestamp DIMENSION,
-#      payload float DEFAULT 0.0 );
-run:bat[:oid,:timestamp]:= 
array.newDimension("sys","timeseries","run",0,null:timestamp,null:timestamp,null:timestamp);
+# Query: CREATE ARRAY timeseries( 
+#            run timestamp DIMENSION,
+#            payload float DEFAULT 0.0 );
+#run:bat[:oid,:timestamp]:= 
array.newDimension("sys","timeseries","run",0,null:timestamp,null:timestamp,null:timestamp);
+function user.s1_1{autoCommit=true}():void;
+    sql.mvc();
+    sql.catalog(63,"sys":str,140473280789176:ptr,0:int); # DDL_CREATE_ARRAY==63
+    sql.exportOperation("");
+end s1_1;
+
+# Query: CREATE ARRAY experiment2(
+#            run date DIMENSION[TIMESTAMP '2010-01-01':*: INTERVAL'1' day],
+#            payload ARRAY (
+#                x integer DIMENSION[4],
+#                y integer DIMENSION[4],
+#                val float DEFAULT 0.0)
+#);
+function user.s2_1{autoCommit=true}():void;
+    sql.mvc();
+    sql.catalog(63,"sys":str,140473281784632:ptr,0:int); # DDL_CREATE_ARRAY==63
+    sql.exportOperation("");
+end s0_1;
+
diff --git a/sql/test/sciql/Tests/Msci03.mal b/sql/test/sciql/Tests/Msci03.mal
--- a/sql/test/sciql/Tests/Msci03.mal
+++ b/sql/test/sciql/Tests/Msci03.mal
@@ -1,44 +1,62 @@
-# CREATE ARRAY stripes( x int dimension[4], y int dimension[4], val float 
DEFAULT 0.0);
-#create table stripes (x int, y int, val float);
-#insert into stripes values(0,0,0.0), (0,1,1.0), (1,0,2.0), (1,1,3.0);
+# Query: UPDATE matrix SET v = CASE WHEN x>y THEN x + y WHEN x<y THEN x - y 
ELSE 0 END;
+function user.s0_1{autoCommit=true}():void;
+       _2 := sql.mvc();
+       # if we have a dimension with fixed bounds then there can not be updates
+       # pattern sciql.bind_dim(mvc:ptr, schema:str, table:str, column:str,
+       #                        access:int, low:any_1, hgh:any_1, 
stp:any_1):bat[:oid,:any_1]
+       _12:bat[:oid,:int]  := sciql.bind_dim(_2,"sys","matrix","x",0,0,4,1);
+       _21:bat[:oid,:int]  := sciql.bind_dim(_2,"sys","matrix","y",0,0,4,1);
+       _39 := bat.mirror(_12);
+       _44 := aggr.count(_39);
+       _40 := bat.reverse(_39);
+       _26:bat[:oid,:bit]  := batcalc.>(_12,_21);
+       _27:bat[:oid,:bit]  := batcalc.isnil(_26);
+       _28:bat[:oid,:bit]  := batcalc.ifthenelse(_27,false:bit,_26);
+       _29:bat[:oid,:int]  := batcalc.+(_12,_21);
+       _30:bat[:oid,:bit]  := batcalc.<(_12,_21);
+       _31:bat[:oid,:bit]  := batcalc.isnil(_30);
+       _32:bat[:oid,:bit]  := batcalc.ifthenelse(_31,false:bit,_30);
+       _33:bat[:oid,:int]  := batcalc.-(_12,_21);
+       _34:bat[:oid,:int]  := batcalc.ifthenelse(_32,_33,0:int);
+       _35:bat[:oid,:int]  := batcalc.ifthenelse(_28,_29,_34);
+       _36 := batcalc.dbl(_35);
+       _41 := algebra.join(_40,_36);
+       sql.update(_2,"sys","matrix","v":str,_41);
+       sql.affectedRows(_44,"");
+end s0_1;
 
-# base arrays are initialized once in most situations considered! (appends are 
allowed)
+# Query: UPDATE diagonal SET v = x + y; 
+function user.s1_1{autoCommit=true}():void;
+       _2 := sql.mvc();
+       # if we have a dimension with fixed bounds then there can not be updates
+       _3:bat[:oid,:int]  := sciql.bind_dim(_2,"sys","diagonal","x",0,0,4,1);
+       _23:bat[:oid,:int]  := sciql.bind_dim(_2,"sys","diagonal","y",0,0,4,1);
+       _4:bat[:int,:oid]  := bat.reverse(_3);
+       _5:bat[:oid,:oid]  := bat.mirror(_4);
+       _32:bat[:oid,:int]  := batcalc.+(_3,_23);
+       _33 := batcalc.dbl(_32);
+       _34 := algebra.join(_5,_33);
+       _37:= aggr.count(_34);
+       sql.update(_2,"sys","stripes","val",_34);
+       sql.affectedRows(_37,"");
+end s1_1;
 
-#UPDATE stripes SET val = x + y; 
-# What is the storage model ? explicit dimensions? or implicit?
-
-# explicit model, after definition we have to instanciate the array
-       # create the x- and y- bats, initialize with their value
-
-function user.s1_1{autoCommit=true}():void;
-    _2 := sql.mvc();
-#if we have a dimension with fixed bounds then there can not be updates
-   (_3:bat[:oid,:int],_23:bat[:oid,:int])  := 
sciql.dimension(_2,"sys","stripes","x",0,0,4,1,"y",0,4,1);
-   _4:bat[:int,:oid]  := bat.reverse(_3);
-   _5:bat[:oid,:oid]  := bat.mirror(_4);
-   _32:bat[:oid,:int]  := batcalc.+(_3,_23);
-    _33 := batcalc.dbl(_32);
-    _34 := algebra.join(_5,_33);
-    _37:= aggr.count(_34);
-    sql.update(_2,"sys","stripes","val",_34);
-    sql.affectedRows(_37,"");
-end s1_1;
+# Query: UPDATE stripes SET v = MOD(RAND(),16);
 
 #-- for stripes2 it becomes
 function user.s1_1{autoCommit=true}():void;
-    _2 := sql.mvc();
+       _2 := sql.mvc();
 #if we have a dimension with free bounds then we need an explicit 
representation of x
-   (_3:bat[:oid,:int],_23:bat[:oid,:int])  := 
sciql.dimension(_2,"sys","stripes","x",null:int,null:int,null:int,"y",null:int,null:int,null:int);
-   _4:bat[:int,:oid]  := bat.reverse(_3);
-   _5:bat[:oid,:oid]  := bat.mirror(_4);
-   _32:bat[:oid,:int]  := batcalc.+(_3,_23);
-    _33 := batcalc.dbl(_32);
-    _34 := algebra.join(_5,_33);
-    _37:= aggr.count(_34);
-    sql.update(_2,"sys","stripes","val",_34);
-    sql.affectedRows(_37,"");
+       (_3:bat[:oid,:int],_23:bat[:oid,:int])  := 
sciql.dimension(_2,"sys","stripes","x",null:int,null:int,null:int,"y",null:int,null:int,null:int);
+       _4:bat[:int,:oid]  := bat.reverse(_3);
+       _5:bat[:oid,:oid]  := bat.mirror(_4);
+       _32:bat[:oid,:int]  := batcalc.+(_3,_23);
+       _33 := batcalc.dbl(_32);
+       _34 := algebra.join(_5,_33);
+       _37:= aggr.count(_34);
+       sql.update(_2,"sys","stripes","val",_34);
+       sql.affectedRows(_37,"");
 end s1_1; 
 
-#UPDATE grid
-#SET val = CASE WHEN x > y THEN x + y  WHEN X<y THEN x - y ELSE 0 END;
-#UPDATE diagonal SET val = x +y; UPDATE sparse SET val = mod(rand(),16);
+# Query: UPDATE stripes2 SET x = x+1;  -- what does it mean
+# Note: if we have a dimension with fixed bounds then there can not be updates
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to